mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 17:07:19 +02:00
CLI
- Modify ::disqualifyOnlyParenOps to count sugared operators. - Labelled '(' and ')' as circumflex operators, thanks awwaiid.
This commit is contained in:
parent
61e943f456
commit
3279566244
2 changed files with 18 additions and 6 deletions
16
src/CLI.cpp
16
src/CLI.cpp
|
@ -666,7 +666,7 @@ void CLI::addArg (const std::string& arg)
|
|||
|
||||
if (disqualifyInsufficientTerms (lexemes) ||
|
||||
disqualifyNoOps (lexemes) ||
|
||||
// disqualifyOnlyParenOps (lexemes) ||
|
||||
disqualifyOnlyParenOps (lexemes) ||
|
||||
disqualifyFirstLastBinary (lexemes) ||
|
||||
disqualifySugarFree (lexemes))
|
||||
{
|
||||
|
@ -2357,10 +2357,12 @@ bool CLI::disqualifyOnlyParenOps (
|
|||
const std::vector <std::pair <std::string, Lexer::Type> >& lexemes) const
|
||||
{
|
||||
int opCount = 0;
|
||||
int opSugarCount = 0;
|
||||
int opParenCount = 0;
|
||||
|
||||
std::vector <std::pair <std::string, Lexer::Type> >::const_iterator l;
|
||||
for (l = lexemes.begin (); l != lexemes.end (); ++l)
|
||||
{
|
||||
if (l->second == Lexer::typeOperator)
|
||||
{
|
||||
++opCount;
|
||||
|
@ -2370,7 +2372,17 @@ bool CLI::disqualifyOnlyParenOps (
|
|||
++opParenCount;
|
||||
}
|
||||
|
||||
return opCount == opParenCount;
|
||||
else if (isTag (l->first) ||
|
||||
isUUIDList (l->first) ||
|
||||
isUUID (l->first) ||
|
||||
isIDSequence (l->first) ||
|
||||
isID (l->first) ||
|
||||
isPattern (l->first) ||
|
||||
isAttribute (l->first))
|
||||
++opSugarCount;
|
||||
}
|
||||
|
||||
return opCount == opParenCount && ! opSugarCount;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue