mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
A3t
- Implemented ::findFilter to identify nodes that comprise a filter.
This commit is contained in:
parent
3d2dd05332
commit
2390838894
2 changed files with 38 additions and 0 deletions
37
src/A3t.cpp
37
src/A3t.cpp
|
@ -134,6 +134,7 @@ Tree* A3t::parse ()
|
||||||
findAttribute ();
|
findAttribute ();
|
||||||
findAttributeModifier ();
|
findAttributeModifier ();
|
||||||
findOperator ();
|
findOperator ();
|
||||||
|
findFilter ();
|
||||||
|
|
||||||
validate ();
|
validate ();
|
||||||
|
|
||||||
|
@ -912,6 +913,42 @@ void A3t::findOperator ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Anything before CMD, but not BINARY, RC or CONFIG --> FILTER
|
||||||
|
// Anything after READCMD, but not BINARY, RC or CONFIG --> FILTER
|
||||||
|
void A3t::findFilter ()
|
||||||
|
{
|
||||||
|
bool before_cmd = true;
|
||||||
|
bool after_readcmd = false;
|
||||||
|
std::vector <Tree*>::iterator i;
|
||||||
|
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||||
|
{
|
||||||
|
// Parser override operator.
|
||||||
|
if ((*i)->attribute ("raw") == "--")
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ((*i)->hasTag ("CMD"))
|
||||||
|
before_cmd = false;
|
||||||
|
|
||||||
|
if ((*i)->hasTag ("READCMD"))
|
||||||
|
after_readcmd = true;
|
||||||
|
|
||||||
|
if (before_cmd &&
|
||||||
|
! (*i)->hasTag ("CMD") &&
|
||||||
|
! (*i)->hasTag ("BINARY") &&
|
||||||
|
! (*i)->hasTag ("RC") &&
|
||||||
|
! (*i)->hasTag ("CONFIG"))
|
||||||
|
(*i)->tag ("FILTER");
|
||||||
|
|
||||||
|
if (after_readcmd &&
|
||||||
|
! (*i)->hasTag ("CMD") &&
|
||||||
|
! (*i)->hasTag ("BINARY") &&
|
||||||
|
! (*i)->hasTag ("RC") &&
|
||||||
|
! (*i)->hasTag ("CONFIG"))
|
||||||
|
(*i)->tag ("FILTER");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Validate the parse tree.
|
// Validate the parse tree.
|
||||||
void A3t::validate ()
|
void A3t::validate ()
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
void findAttribute ();
|
void findAttribute ();
|
||||||
void findAttributeModifier ();
|
void findAttributeModifier ();
|
||||||
void findOperator ();
|
void findOperator ();
|
||||||
|
void findFilter ();
|
||||||
void validate ();
|
void validate ();
|
||||||
|
|
||||||
// TODO Resolve aliases
|
// TODO Resolve aliases
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue