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
24
src/CLI.cpp
24
src/CLI.cpp
|
@ -504,7 +504,7 @@ void CLI::addArg (const std::string& arg)
|
||||||
_original_args.push_back (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
|
else
|
||||||
{
|
{
|
||||||
// Lex each argument. If there are multiple lexemes, create sub branches,
|
// 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))
|
while (lex.token (lexeme, type))
|
||||||
lexemes.push_back (std::pair <std::string, Lexer::Type> (lexeme, type));
|
lexemes.push_back (std::pair <std::string, Lexer::Type> (lexeme, type));
|
||||||
|
|
||||||
// This one looks interesting.
|
bool foundOP = false;
|
||||||
if (lexemes.size () > 1)
|
std::vector <std::pair <std::string, Lexer::Type> >::iterator l;
|
||||||
{
|
for (l = lexemes.begin (); l != lexemes.end (); ++l)
|
||||||
bool foundOP = false;
|
if (l->second == Lexer::typeOperator)
|
||||||
std::vector <std::pair <std::string, Lexer::Type> >::iterator l;
|
foundOP = true;
|
||||||
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)
|
for (l = lexemes.begin (); l != lexemes.end (); ++l)
|
||||||
_original_args.push_back (l->first);
|
_original_args.push_back (l->first);
|
||||||
}
|
|
||||||
else
|
|
||||||
_original_args.push_back (arg);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_original_args.push_back (arg);
|
_original_args.push_back (arg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue