- Implemented ::desugarPlainArgs to upgrade WORD to PATTERN when found in a
  FILTER context.
This commit is contained in:
Paul Beckingham 2014-10-25 16:15:31 -04:00
parent 0c4b447c77
commit a780bd0193
2 changed files with 36 additions and 0 deletions

View file

@ -318,6 +318,7 @@ void CLI::analyze ()
desugarPatterns ();
desugarIDs ();
desugarUUIDs ();
//desugarPlainArgs ();
findOperators ();
insertJunctions ();
@ -1250,6 +1251,40 @@ void CLI::desugarUUIDs ()
_args = reconstructed;
}
////////////////////////////////////////////////////////////////////////////////
void CLI::desugarPlainArgs ()
{
std::vector <A> reconstructed;
std::vector <A>::iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
{
if (a->hasTag ("FILTER") &&
! a->hasTag ("ATTRIBUTE") &&
! a->hasTag ("OP") &&
! a->hasTag ("LITERAL"))
{
A lhs ("argPattern", "description");
lhs.tag ("ATTRIBUTE");
lhs.tag ("FILTER");
reconstructed.push_back (lhs);
A op ("argPattern", "~");
op.tag ("OP");
op.tag ("FILTER");
reconstructed.push_back (op);
A rhs ("argPattern", "'" + a->attribute ("raw") + "'");
rhs.tag ("LITERAL");
rhs.tag ("FILTER");
reconstructed.push_back (rhs);
}
else
reconstructed.push_back (*a);
}
_args = reconstructed;
}
////////////////////////////////////////////////////////////////////////////////
void CLI::findOperators ()
{

View file

@ -87,6 +87,7 @@ private:
void desugarPatterns ();
void desugarIDs ();
void desugarUUIDs ();
void desugarPlainArgs ();
void findOperators ();
void insertJunctions ();
void decomposeModAttributes ();