CLI2: Obey the terminator and skip Lexing
This commit is contained in:
25
src/CLI2.cpp
25
src/CLI2.cpp
@@ -340,15 +340,28 @@ 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)
|
||||||
{
|
{
|
||||||
std::string lexeme;
|
if (_original_args[i] == "--")
|
||||||
Lexer::Type type;
|
{
|
||||||
Lexer lex (_original_args[i]);
|
terminated = true;
|
||||||
lex.ambiguity (false);
|
_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))
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user