From 7420ef8e284a1cad838b47ae39f4b43e631656a8 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 31 Oct 2014 20:11:34 -0400 Subject: [PATCH] CLI - ::addArg now lexes args, and looks for embedded operators before deciding to use the lexemes. --- src/CLI.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 6d1409fbb..f27d005c9 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -504,7 +504,7 @@ void CLI::addArg (const std::string& arg) _original_args.push_back (arg); } - // Do not lex, unless lexing reveals OPs. + // Lex, but only use lexemes if an operator is found in there. else { // Lex each argument. If there are multiple lexemes, create sub branches, @@ -518,22 +518,18 @@ void CLI::addArg (const std::string& arg) while (lex.token (lexeme, type)) lexemes.push_back (std::pair (lexeme, type)); - // This one looks interesting. - if (lexemes.size () > 1) - { - bool foundOP = false; - std::vector >::iterator l; - for (l = lexemes.begin (); l != lexemes.end (); ++l) - if (l->second == Lexer::typeOperator) - foundOP = true; + bool foundOP = false; + std::vector >::iterator l; + for (l = lexemes.begin (); l != lexemes.end (); ++l) + if (l->second == Lexer::typeOperator) + foundOP = true; - if (foundOP) - { + // This one looks interesting. + if (lexemes.size () > 1 && + foundOP) + { for (l = lexemes.begin (); l != lexemes.end (); ++l) _original_args.push_back (l->first); - } - else - _original_args.push_back (arg); } else _original_args.push_back (arg);