mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-01 18:27:20 +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
14
src/CLI2.cpp
14
src/CLI2.cpp
|
@ -1144,15 +1144,21 @@ void CLI2::desugarFilterPatterns ()
|
||||||
//
|
//
|
||||||
void CLI2::findIDs ()
|
void CLI2::findIDs ()
|
||||||
{
|
{
|
||||||
|
bool previousArgWasAnOperator = false;
|
||||||
|
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER"))
|
if (a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
if (a._lextype == Lexer::Type::number)
|
if (a._lextype == Lexer::Type::number)
|
||||||
|
{
|
||||||
|
// Skip any number that was preceded by an operator.
|
||||||
|
if (! previousArgWasAnOperator)
|
||||||
{
|
{
|
||||||
std::string number = a.attribute ("raw");
|
std::string number = a.attribute ("raw");
|
||||||
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
_id_ranges.push_back (std::pair <std::string, std::string> (number, number));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (a._lextype == Lexer::Type::set)
|
else if (a._lextype == Lexer::Type::set)
|
||||||
{
|
{
|
||||||
// Split the ID list into elements.
|
// Split the ID list into elements.
|
||||||
|
@ -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 ()
|
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.
|
// 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
|
// Find the *first* occurence of lexer type set/number/uuid, and replace it
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue