mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Inhibit the identification of IDs if preceeded by an operator
This commit is contained in:
parent
dfe6927f14
commit
9dcd52fc5b
1 changed files with 16 additions and 2 deletions
18
src/CLI2.cpp
18
src/CLI2.cpp
|
@ -1144,14 +1144,20 @@ void CLI2::desugarFilterPatterns ()
|
|||
//
|
||||
void CLI2::findIDs ()
|
||||
{
|
||||
bool previousArgWasAnOperator = false;
|
||||
|
||||
for (auto& a : _args)
|
||||
{
|
||||
if (a.hasTag ("FILTER"))
|
||||
{
|
||||
if (a._lextype == Lexer::Type::number)
|
||||
{
|
||||
std::string number = a.attribute ("raw");
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
||||
// Skip any number that was preceded by an operator.
|
||||
if (! previousArgWasAnOperator)
|
||||
{
|
||||
std::string number = a.attribute ("raw");
|
||||
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
||||
}
|
||||
}
|
||||
else if (a._lextype == Lexer::Type::set)
|
||||
{
|
||||
|
@ -1172,6 +1178,8 @@ void CLI2::findIDs ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
previousArgWasAnOperator = (a._lextype == Lexer::Type::op) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1255,6 +1263,12 @@ void CLI2::findUUIDs ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI2::insertIDExpr ()
|
||||
{
|
||||
// Skip completely if no ID/UUID was found. This is because below, '(' and ')'
|
||||
// are inserted regardless of list size.
|
||||
if (! _id_ranges.size () &&
|
||||
! _uuid_list.size ())
|
||||
return;
|
||||
|
||||
// TODO Strip out Lexer::Type::list from between Lexer::Type::uuid's.
|
||||
|
||||
// Find the *first* occurence of lexer type set/number/uuid, and replace it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue