- Implemented ::findOperators.
This commit is contained in:
Paul Beckingham 2014-10-23 00:45:20 -04:00
parent fab9fe2a7d
commit 7f3cc3897e
2 changed files with 23 additions and 0 deletions

View file

@ -312,6 +312,7 @@ void CLI::analyze ()
desugarPatterns ();
desugarIDs ();
desugarUUIDs ();
findOperators ();
insertJunctions ();
// Decompose the elements for MODIFICATIONs.
@ -1191,6 +1192,27 @@ void CLI::desugarUUIDs ()
_args = reconstructed;
}
////////////////////////////////////////////////////////////////////////////////
void CLI::findOperators ()
{
// Find the category.
std::pair <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
c = _entities.equal_range ("operator");
// Extract a list of entities for category.
std::vector <std::string> options;
std::multimap <std::string, std::string>::const_iterator e;
for (e = c.first; e != c.second; ++e)
options.push_back (e->second);
// Walk the arguments and tag as OP.
std::vector <A>::iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
if (a->hasTag ("FILTER"))
if (std::find (options.begin (), options.end (), a->attribute ("raw")) != options.end ())
a->tag ("OP");
}
////////////////////////////////////////////////////////////////////////////////
// Two consecutive FILTER, ID or UUID arguments:
//