- ::unsweetenPatterns no longer clobbers non-FILTER args.
This commit is contained in:
Paul Beckingham 2014-10-19 18:19:27 -04:00
parent f809f2d819
commit 83ab844ba4

View file

@ -813,27 +813,32 @@ void CLI::unsweetenPatterns ()
std::vector <A>::iterator a; std::vector <A>::iterator a;
for (a = _args.begin (); a != _args.end (); ++a) for (a = _args.begin (); a != _args.end (); ++a)
{ {
Nibbler n (a->attribute ("raw")); if (a->hasTag ("FILTER"))
std::string pattern;
if (n.getQuoted ('/', pattern) &&
n.depleted () &&
pattern.length () > 0)
{ {
A lhs ("argPattern", "description"); Nibbler n (a->attribute ("raw"));
lhs.tag ("ATT"); std::string pattern;
lhs.tag ("FILTER");
reconstructed.push_back (lhs);
A op ("argPattern", "~"); if (n.getQuoted ('/', pattern) &&
op.tag ("OP"); n.depleted () &&
op.tag ("FILTER"); pattern.length () > 0)
reconstructed.push_back (op); {
A lhs ("argPattern", "description");
lhs.tag ("ATT");
lhs.tag ("FILTER");
reconstructed.push_back (lhs);
A rhs ("argPattern", "'" + pattern + "'"); A op ("argPattern", "~");
rhs.tag ("LITERAL"); op.tag ("OP");
rhs.tag ("FILTER"); op.tag ("FILTER");
reconstructed.push_back (rhs); reconstructed.push_back (op);
A rhs ("argPattern", "'" + pattern + "'");
rhs.tag ("LITERAL");
rhs.tag ("FILTER");
reconstructed.push_back (rhs);
}
else
reconstructed.push_back (*a);
} }
else else
reconstructed.push_back (*a); reconstructed.push_back (*a);