CLI2: Added special case handling for '<name>:<value>', using operator '='

- By adding the special case, the desugarFilterAttributes and
  desugarFilterAttributeModifiers methods can be merged.
This commit is contained in:
Paul Beckingham 2015-06-21 15:57:21 -04:00
parent e504149a43
commit 8085b15b50

View file

@ -953,10 +953,6 @@ void CLI2::desugarFilterAttributes ()
if (! canonicalize (canonical, "attribute", name))
canonicalize (canonical, "uda", name);
// <name>:<value> is an assumed <name> is <value>
if (mod == "")
mod = "is";
// TODO The "!" modifier is being dropped.
A2 lhs (name, Lexer::Type::dom);
@ -970,7 +966,13 @@ void CLI2::desugarFilterAttributes ()
A2 rhs ("", Lexer::Type::string);
rhs.tag ("FILTER");
if (mod == "before" || mod == "under" || mod == "below")
// Special case for '<name>:<value>'.
if (mod == "")
{
op.attribute ("raw", "=");
rhs.attribute ("raw", value);
}
else if (mod == "before" || mod == "under" || mod == "below")
{
op.attribute ("raw", "<");
rhs.attribute ("raw", value);
@ -1051,12 +1053,6 @@ void CLI2::desugarFilterAttributes ()
found = true;
}
/*
std::string operatorLiteral = "=";
if (canonical == "status")
operatorLiteral = "==";
*/
if (found)
changes = true;
else