From 1824a542f6ada6180440622f994e9c52f0ce8d9b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 27 Jun 2015 17:35:15 -0400 Subject: [PATCH] CLI2: Obey the terminator and skip Lexing --- src/CLI2.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 0487280c2..8676bd2ff 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -340,15 +340,28 @@ void CLI2::lexArguments () { // Note: Starts interating at index 1, because ::handleArg0 has already // processed it. + bool terminated = false; for (unsigned int i = 1; i < _original_args.size (); ++i) { - std::string lexeme; - Lexer::Type type; - Lexer lex (_original_args[i]); - lex.ambiguity (false); + if (_original_args[i] == "--") + { + terminated = true; + _args.push_back (A2 (_original_args[i], Lexer::Type::separator)); + } + else if (terminated) + { + _args.push_back (A2 (_original_args[i], Lexer::Type::word)); + } + else + { + std::string lexeme; + Lexer::Type type; + Lexer lex (_original_args[i]); + lex.ambiguity (false); - while (lex.token (lexeme, type)) - _args.push_back (A2 (lexeme, type)); + while (lex.token (lexeme, type)) + _args.push_back (A2 (lexeme, type)); + } } if (context.config.getInteger ("debug.parser") >= 3)