mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-09 00:30:36 +02:00
A3t::findTag
- Supports single-word tag add/remove, presence/absence, allowing any non-space character in the tag, which is an improvement.
This commit is contained in:
parent
272450ff9b
commit
5a29042d3b
2 changed files with 31 additions and 0 deletions
|
@ -64,6 +64,7 @@ Tree* A3t::parse ()
|
||||||
findConfigOverride ();
|
findConfigOverride ();
|
||||||
findSubstitution ();
|
findSubstitution ();
|
||||||
findPattern ();
|
findPattern ();
|
||||||
|
findTag ();
|
||||||
|
|
||||||
validate ();
|
validate ();
|
||||||
|
|
||||||
|
@ -298,6 +299,35 @@ void A3t::findSubstitution ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// +tag
|
||||||
|
void A3t::findTag ()
|
||||||
|
{
|
||||||
|
std::vector <Tree*>::iterator i;
|
||||||
|
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||||
|
{
|
||||||
|
// Parser override operator.
|
||||||
|
if ((*i)->attribute ("raw") == "--")
|
||||||
|
break;
|
||||||
|
|
||||||
|
std::string raw = (*i)->attribute ("raw");
|
||||||
|
Nibbler n (raw);
|
||||||
|
|
||||||
|
std::string tag;
|
||||||
|
std::string sign;
|
||||||
|
if (n.getN (1, sign) &&
|
||||||
|
(sign == "+" || sign == "-") &&
|
||||||
|
n.getUntilEOS (tag) &&
|
||||||
|
tag.find (' ') == std::string::npos)
|
||||||
|
{
|
||||||
|
(*i)->tag ("TAG");
|
||||||
|
Tree* b = (*i)->addBranch (new Tree ("metadata"));
|
||||||
|
b->attribute ("sign", sign);
|
||||||
|
b->attribute ("tag", tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Validate the parse tree.
|
// Validate the parse tree.
|
||||||
void A3t::validate ()
|
void A3t::validate ()
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
void findConfigOverride ();
|
void findConfigOverride ();
|
||||||
void findPattern ();
|
void findPattern ();
|
||||||
void findSubstitution ();
|
void findSubstitution ();
|
||||||
|
void findTag ();
|
||||||
void validate ();
|
void validate ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue