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