diff --git a/src/CLI2.cpp b/src/CLI2.cpp index cfaa13323..19ea424af 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -1075,180 +1075,6 @@ void CLI2::desugarFilterAttributes () } } -/* -//////////////////////////////////////////////////////////////////////////////// -// .[~][:=]['"]['"] --> name value -void CLI2::desugarFilterAttributeModifiers () -{ - bool changes = false; - std::vector reconstructed; - for (auto& a : _args) - { - if (a.hasTag ("FILTER")) - { - // Look for a valid attribute name. - bool found = false; - Nibbler n (a.attribute ("raw")); - std::string name; - if (n.getUntil (".", name) && - name.length ()) - { - std::string canonical; - if (canonicalize (canonical, "attribute", name) || - canonicalize (canonical, "uda", name)) - { - if (n.skip ('.')) - { - std::string sense = "+"; - if (n.skip ('~')) - sense = "-"; - - std::string modifier; - n.getUntilOneOf (":=", modifier); - - if (n.skip (':') || - n.skip ('=')) - { - std::string value; - if (n.getQuoted ('"', value) || - n.getQuoted ('\'', value) || - n.getUntilEOS (value) || - n.depleted ()) - { - if (value == "") - value = "''"; - - A lhs ("argAttMod", name); - lhs.tag ("ATTMOD"); - lhs.tag ("FILTER"); - - lhs.attribute ("name", canonical); - lhs.attribute ("modifier", modifier); - lhs.attribute ("sense", sense); - - A op ("argAttmod", ""); - op.tag ("FILTER"); - op.tag ("OP"); - - A rhs ("argAttMod", ""); - rhs.tag ("FILTER"); - - if (modifier == "before" || modifier == "under" || modifier == "below") - { - op.attribute ("raw", "<"); - rhs.attribute ("raw", value); - rhs.tag ("LITERAL"); - } - else if (modifier == "after" || modifier == "over" || modifier == "above") - { - op.attribute ("raw", ">"); - rhs.attribute ("raw", value); - rhs.tag ("LITERAL"); - } - else if (modifier == "none") - { - op.attribute ("raw", "=="); - rhs.attribute ("raw", "''"); - rhs.tag ("LITERAL"); - } - else if (modifier == "any") - { - op.attribute ("raw", "!="); - rhs.attribute ("raw", "''"); - rhs.tag ("LITERAL"); - } - else if (modifier == "is" || modifier == "equals") - { - op.attribute ("raw", "=="); - rhs.attribute ("raw", "'" + value + "'"); - rhs.tag ("LITERAL"); - } - else if (modifier == "isnt" || modifier == "not") - { - op.attribute ("raw", "!=="); - rhs.attribute ("raw", "'" + value + "'"); - rhs.tag ("LITERAL"); - } - else if (modifier == "has" || modifier == "contains") - { - op.attribute ("raw", "~"); - rhs.attribute ("raw", "'" + value + "'"); - rhs.tag ("LITERAL"); - } - else if (modifier == "hasnt") - { - op.attribute ("raw", "!~"); - rhs.attribute ("raw", "'" + value + "'"); - rhs.tag ("LITERAL"); - } - else if (modifier == "startswith" || modifier == "left") - { - op.attribute ("raw", "~"); - rhs.attribute ("raw", "'^" + value + "'"); - rhs.tag ("REGEX"); - } - else if (modifier == "endswith" || modifier == "right") - { - op.attribute ("raw", "~"); - rhs.attribute ("raw", "'" + value + "$'"); - rhs.tag ("REGEX"); - } - else if (modifier == "word") - { - op.attribute ("raw", "~"); -#if defined (DARWIN) - rhs.attribute ("raw", value); -#elif defined (SOLARIS) - rhs.attribute ("raw", "'\\<" + value + "\\>'"); -#else - rhs.attribute ("raw", "'\\b" + value + "\\b'"); -#endif - rhs.tag ("REGEX"); - } - else if (modifier == "noword") - { - op.attribute ("raw", "!~"); -#if defined (DARWIN) - rhs.attribute ("raw", value); -#elif defined (SOLARIS) - rhs.attribute ("raw", "'\\<" + value + "\\>'"); -#else - rhs.attribute ("raw", "'\\b" + value + "\\b'"); -#endif - rhs.tag ("REGEX"); - } - else - throw format (STRING_PARSER_UNKNOWN_ATTMOD, modifier); - - reconstructed.push_back (lhs); - reconstructed.push_back (op); - reconstructed.push_back (rhs); - found = true; - } - } - } - } - } - - if (found) - changes = true; - else - reconstructed.push_back (a); - } - else - reconstructed.push_back (a); - } - - if (changes) - { - _args = reconstructed; - - if (context.config.getInteger ("debug.parser") >= 3) - context.debug (dump ("CLI2::analyze desugarFilterAttributeModifiers")); - } -} -*/ - //////////////////////////////////////////////////////////////////////////////// // /pattern/ --> description ~ 'pattern' void CLI2::desugarFilterPatterns () diff --git a/src/CLI2.h b/src/CLI2.h index 7bce7c6c0..f1070ca93 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -103,9 +103,6 @@ private: void desugarFilterTags (); void findStrayModifications (); void desugarFilterAttributes (); -/* - void desugarFilterAttributeModifiers (); -*/ void desugarFilterPatterns (); void findIDs (); void findUUIDs ();