CLI2: Obey the terminator and skip Lexing

This commit is contained in:
Paul Beckingham 2015-06-27 17:35:15 -04:00
parent 299ecad49f
commit 1824a542f6

View file

@ -340,7 +340,19 @@ void CLI2::lexArguments ()
{ {
// Note: Starts interating at index 1, because ::handleArg0 has already // Note: Starts interating at index 1, because ::handleArg0 has already
// processed it. // processed it.
bool terminated = false;
for (unsigned int i = 1; i < _original_args.size (); ++i) for (unsigned int i = 1; i < _original_args.size (); ++i)
{
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; std::string lexeme;
Lexer::Type type; Lexer::Type type;
@ -350,6 +362,7 @@ void CLI2::lexArguments ()
while (lex.token (lexeme, type)) while (lex.token (lexeme, type))
_args.push_back (A2 (lexeme, type)); _args.push_back (A2 (lexeme, type));
} }
}
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 3)
context.debug (dump ("CLI2::analyze lexArguments")); context.debug (dump ("CLI2::analyze lexArguments"));