mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
CLI2: Removed obsolete ::isUUIDList
- Removed unsupported UUID lists, which shoudl have been removed earlier when Lexer::Type::list was dropped. - Reversed logic in 'if' statements to perform the lowest cost comparison first.
This commit is contained in:
parent
5f186bbbe1
commit
0c568580b3
2 changed files with 13 additions and 43 deletions
52
src/CLI2.cpp
52
src/CLI2.cpp
|
@ -913,8 +913,8 @@ void CLI2::desugarFilterTags ()
|
||||||
std::vector <A2> reconstructed;
|
std::vector <A2> reconstructed;
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER") &&
|
if (a._lextype == Lexer::Type::tag &&
|
||||||
a._lextype == Lexer::Type::tag)
|
a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
|
|
||||||
|
@ -978,8 +978,8 @@ void CLI2::desugarFilterAttributes ()
|
||||||
std::vector <A2> reconstructed;
|
std::vector <A2> reconstructed;
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER") &&
|
if (a._lextype == Lexer::Type::pair &&
|
||||||
a._lextype == Lexer::Type::pair)
|
a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
|
|
||||||
|
@ -1159,8 +1159,8 @@ void CLI2::desugarFilterPatterns ()
|
||||||
std::vector <A2> reconstructed;
|
std::vector <A2> reconstructed;
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER") &&
|
if (a._lextype == Lexer::Type::pattern &&
|
||||||
a._lextype == Lexer::Type::pattern)
|
a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
changes = true;
|
changes = true;
|
||||||
std::string raw = a.attribute ("raw");
|
std::string raw = a.attribute ("raw");
|
||||||
|
@ -1292,8 +1292,8 @@ void CLI2::findUUIDs ()
|
||||||
{
|
{
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER") &&
|
if (a._lextype == Lexer::Type::uuid &&
|
||||||
a._lextype == Lexer::Type::uuid)
|
a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
_uuid_list.push_back (a.attribute ("raw"));
|
_uuid_list.push_back (a.attribute ("raw"));
|
||||||
}
|
}
|
||||||
|
@ -1303,8 +1303,8 @@ void CLI2::findUUIDs ()
|
||||||
{
|
{
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("MODIFICATION") &&
|
if (a._lextype == Lexer::Type::uuid &&
|
||||||
a._lextype == Lexer::Type::uuid)
|
a.hasTag ("MODIFICATION"))
|
||||||
{
|
{
|
||||||
a.unTag ("MODIFICATION");
|
a.unTag ("MODIFICATION");
|
||||||
a.tag ("FILTER");
|
a.tag ("FILTER");
|
||||||
|
@ -1334,10 +1334,10 @@ void CLI2::insertIDExpr ()
|
||||||
std::vector <A2> reconstructed;
|
std::vector <A2> reconstructed;
|
||||||
for (auto& a : _args)
|
for (auto& a : _args)
|
||||||
{
|
{
|
||||||
if (a.hasTag ("FILTER") &&
|
if ((a._lextype == Lexer::Type::set ||
|
||||||
(a._lextype == Lexer::Type::set ||
|
|
||||||
a._lextype == Lexer::Type::number ||
|
a._lextype == Lexer::Type::number ||
|
||||||
a._lextype == Lexer::Type::uuid))
|
a._lextype == Lexer::Type::uuid) &&
|
||||||
|
a.hasTag ("FILTER"))
|
||||||
{
|
{
|
||||||
if (! foundID)
|
if (! foundID)
|
||||||
{
|
{
|
||||||
|
@ -1745,30 +1745,4 @@ void CLI2::decomposeModSubstitutions ()
|
||||||
context.debug (dump ("CLI2::prepareFilter decomposeModSubstitutions"));
|
context.debug (dump ("CLI2::prepareFilter decomposeModSubstitutions"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
bool CLI2::isUUIDList (const std::string& raw) const
|
|
||||||
{
|
|
||||||
// UUIDs have a limited character set.
|
|
||||||
if (raw.find_first_not_of ("0123456789abcdefABCDEF-,") == std::string::npos)
|
|
||||||
{
|
|
||||||
Nibbler n (raw);
|
|
||||||
std::string token;
|
|
||||||
if (n.getUUID (token) ||
|
|
||||||
n.getPartialUUID (token))
|
|
||||||
{
|
|
||||||
while (n.skip (','))
|
|
||||||
if (! n.getUUID (token) &&
|
|
||||||
! n.getPartialUUID (token))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (n.depleted ())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -105,10 +105,6 @@ private:
|
||||||
void decomposeModTags ();
|
void decomposeModTags ();
|
||||||
void decomposeModSubstitutions ();
|
void decomposeModSubstitutions ();
|
||||||
|
|
||||||
/*
|
|
||||||
bool isUUIDList (const std::string&) const;
|
|
||||||
*/
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::multimap <std::string, std::string> _entities;
|
std::multimap <std::string, std::string> _entities;
|
||||||
std::map <std::string, std::string> _aliases;
|
std::map <std::string, std::string> _aliases;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue