From 293f4d625890b1d91641e337a2cc98ac43f138e5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 17 Aug 2014 17:10:13 -0400 Subject: [PATCH] Parser - ::initialize now recognizes more things it should not lex. --- src/Parser.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index 87035a453..0d680c259 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -84,9 +84,25 @@ void Parser::initialize (int argc, const char** argv) if (i == 0) continue; - // Do no lex RC overrides. - if (raw.substr (0, 3) == "rc." || - raw.substr (0, 3) == "rc:") + // TODO This seems silly - it's essentially performing a low-quality parse. + + // Do not lex RC overrides. + if (raw.length () > 3 && + (raw.substr (0, 3) == "rc." || + raw.substr (0, 3) == "rc:")) + continue; + + // Do not lex patterns or single substitutions. + if (raw.length () > 2 && + raw[0] == '/' && + raw[raw.length () - 1] == '/') + continue; + + // Do not lex substitutions. + if (raw.length () > 2 && + raw[0] == '/' && + raw[raw.length () - 2] == '/' && + raw[raw.length () - 1] == 'g') continue; // If the argument contains a space, it was quoted. Record that fact.