diff --git a/src/CLI.cpp b/src/CLI.cpp index 235930e66..1e87a56c5 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -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 ::const_iterator, std::multimap ::const_iterator> c; + c = _entities.equal_range ("operator"); + + // Extract a list of entities for category. + std::vector options; + std::multimap ::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 ::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: // diff --git a/src/CLI.h b/src/CLI.h index ffcae07eb..676d65a9e 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -86,6 +86,7 @@ private: void desugarPatterns (); void desugarIDs (); void desugarUUIDs (); + void findOperators (); void insertJunctions (); void decomposeModAttributes (); void decomposeModAttributeModifiers ();