mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI
- ::addArg now lexes args, and looks for embedded operators before deciding to use the lexemes.
This commit is contained in:
parent
975b20a517
commit
7420ef8e28
1 changed files with 10 additions and 14 deletions
12
src/CLI.cpp
12
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,16 +518,15 @@ void CLI::addArg (const std::string& arg)
|
|||
while (lex.token (lexeme, type))
|
||||
lexemes.push_back (std::pair <std::string, Lexer::Type> (lexeme, type));
|
||||
|
||||
// This one looks interesting.
|
||||
if (lexemes.size () > 1)
|
||||
{
|
||||
bool foundOP = false;
|
||||
std::vector <std::pair <std::string, Lexer::Type> >::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);
|
||||
|
@ -535,9 +534,6 @@ void CLI::addArg (const std::string& arg)
|
|||
else
|
||||
_original_args.push_back (arg);
|
||||
}
|
||||
else
|
||||
_original_args.push_back (arg);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue