mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI
- Implemented ::findAttributes.
This commit is contained in:
parent
286c378180
commit
482d378fdb
2 changed files with 23 additions and 0 deletions
22
src/CLI.cpp
22
src/CLI.cpp
|
@ -327,6 +327,7 @@ void CLI::analyze (bool parse /* = true */)
|
|||
findUUIDs ();
|
||||
insertIDExpr ();
|
||||
findOperators ();
|
||||
findAttributes ();
|
||||
insertJunctions ();
|
||||
desugarPlainArgs ();
|
||||
|
||||
|
@ -1346,6 +1347,27 @@ void CLI::findOperators ()
|
|||
a->tag ("OP");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void CLI::findAttributes ()
|
||||
{
|
||||
// Find the category.
|
||||
std::pair <std::multimap <std::string, std::string>::const_iterator, std::multimap <std::string, std::string>::const_iterator> c;
|
||||
c = _entities.equal_range ("attribute");
|
||||
|
||||
// Extract a list of entities for category.
|
||||
std::vector <std::string> options;
|
||||
std::multimap <std::string, std::string>::const_iterator e;
|
||||
for (e = c.first; e != c.second; ++e)
|
||||
options.push_back (e->second);
|
||||
|
||||
// Walk the arguments and tag as OP.
|
||||
std::vector <A>::iterator a;
|
||||
for (a = _args.begin (); a != _args.end (); ++a)
|
||||
if (a->hasTag ("FILTER"))
|
||||
if (std::find (options.begin (), options.end (), a->attribute ("raw")) != options.end ())
|
||||
a->tag ("ATTRIBUTE");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Two consecutive FILTER, non-OP arguments that are not "(" or ")" need an
|
||||
// "and" operator inserted between them.
|
||||
|
|
|
@ -90,6 +90,7 @@ private:
|
|||
void insertIDExpr ();
|
||||
void desugarPlainArgs ();
|
||||
void findOperators ();
|
||||
void findAttributes ();
|
||||
void insertJunctions ();
|
||||
void decomposeModAttributes ();
|
||||
void decomposeModAttributeModifiers ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue