- Implemented ::findStrayModifications to spot FILTER args detected before 'add'
  or 'log' commands, and upgrade them to MODIFICATIONs.
This commit is contained in:
Paul Beckingham 2014-11-08 14:22:25 -05:00
parent b9b998c769
commit 26f8d8c45d
2 changed files with 28 additions and 0 deletions

View file

@ -341,6 +341,7 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */)
findUUIDs ();
insertIDExpr ();
desugarTags ();
findStrayModifications ();
desugarAttributes ();
desugarAttributeModifiers ();
desugarPatterns ();
@ -907,6 +908,32 @@ void CLI::desugarTags ()
}
}
////////////////////////////////////////////////////////////////////////////////
void CLI::findStrayModifications ()
{
bool changes = false;
std::string command = getCommand ();
if (command == "add" ||
command == "log")
{
std::vector <A>::iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
{
if (a->hasTag ("FILTER"))
{
a->unTag ("FILTER");
a->tag ("MODIFICATION");
changes = true;
}
}
}
if (changes)
if (context.config.getInteger ("debug.parser") >= 3)
context.debug (context.cli.dump ("CLI::analyze findStrayModifications"));
}
////////////////////////////////////////////////////////////////////////////////
// <name>:['"][<value>]['"] --> name = value
void CLI::desugarAttributes ()

View file

@ -93,6 +93,7 @@ private:
void categorize ();
bool exactMatch (const std::string&, const std::string&) const;
void desugarTags ();
void findStrayModifications ();
void desugarAttributes ();
void desugarAttributeModifiers ();
void desugarPatterns ();