From 3f3d698a28d6a077e588591602e3b62e50e7de7a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 11 Jul 2015 17:10:10 -0400 Subject: [PATCH] CLI2: Integrated Lexer::decomposePattern --- src/CLI2.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 756f86300..a9c5aafdb 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -195,6 +195,20 @@ void A2::decompose () } } } + + else if (_lextype == Lexer::Type::pattern) + { + //if (Directory (raw).exists ()) + // return; + + std::string pattern; + std::string flags; + if (Lexer::decomposePattern (_attributes["raw"], pattern, flags)) + { + attribute ("pattern", pattern); + attribute ("flags", flags); + } + } } //////////////////////////////////////////////////////////////////////////////// @@ -1212,8 +1226,6 @@ void CLI2::desugarFilterPatterns () a.hasTag ("FILTER")) { changes = true; - std::string raw = a.attribute ("raw"); - std::string pattern = raw.substr (1, raw.length () - 2); A2 lhs ("description", Lexer::Type::dom); lhs.tag ("FILTER"); @@ -1223,7 +1235,8 @@ void CLI2::desugarFilterPatterns () op.tag ("FILTER"); reconstructed.push_back (op); - A2 rhs (pattern, Lexer::Type::string); + A2 rhs (a.attribute ("pattern"), Lexer::Type::string); + rhs.attribute ("flags", a.attribute ("flags")); rhs.tag ("FILTER"); reconstructed.push_back (rhs); }