- Allow ::getWords to run ::analyze but skip the desugar and decomposition
  steps.
This commit is contained in:
Paul Beckingham 2014-10-25 16:51:35 -04:00
parent 0ca4b34f75
commit 0138c13833
2 changed files with 24 additions and 18 deletions

View file

@ -271,7 +271,7 @@ void CLI::add (const std::string& arg)
// Intended to be called after ::initialize() and ::add(), to perform the final
// analysis. Analysis is also performed directly after the above, because there
// is a need to extract overrides early, before entities are proviedd.
void CLI::analyze ()
void CLI::analyze (bool parse /* = true */)
{
// Clean what needs to be cleaned. Most in this case.
_args.clear ();
@ -311,22 +311,25 @@ void CLI::analyze ()
findOverrides ();
categorize ();
// Remove all the syntactic sugar for FILTERs.
desugarTags ();
desugarAttributes ();
desugarAttributeModifiers ();
desugarPatterns ();
desugarIDs ();
desugarUUIDs ();
//desugarPlainArgs ();
findOperators ();
insertJunctions ();
if (parse)
{
// Remove all the syntactic sugar for FILTERs.
desugarTags ();
desugarAttributes ();
desugarAttributeModifiers ();
desugarPatterns ();
desugarIDs ();
desugarUUIDs ();
findOperators ();
insertJunctions ();
desugarPlainArgs ();
// Decompose the elements for MODIFICATIONs.
decomposeModAttributes ();
decomposeModAttributeModifiers ();
decomposeModTags ();
decomposeModSubstitutions ();
// Decompose the elements for MODIFICATIONs.
decomposeModAttributes ();
decomposeModAttributeModifiers ();
decomposeModTags ();
decomposeModSubstitutions ();
}
}
////////////////////////////////////////////////////////////////////////////////
@ -361,8 +364,11 @@ const std::string CLI::getFilter ()
////////////////////////////////////////////////////////////////////////////////
const std::vector <std::string> CLI::getWords ()
{
std::vector <std::string> words;
// Re-analyze the arguments, but do not de-sugar or decompose any. Analysis
// only.
analyze (false);
std::vector <std::string> words;
std::vector <A>::const_iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
{

View file

@ -69,7 +69,7 @@ public:
void entity (const std::string&, const std::string&);
void initialize (int, const char**);
void add (const std::string&);
void analyze ();
void analyze (bool parse = true);
const std::string getFilter ();
const std::vector <std::string> getWords ();
const std::vector <std::string> getModifications ();