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:
@@ -64,6 +64,7 @@ Tree* A3t::parse ()
|
||||
findConfigOverride ();
|
||||
findSubstitution ();
|
||||
findPattern ();
|
||||
findTag ();
|
||||
|
||||
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.
|
||||
void A3t::validate ()
|
||||
|
||||
@@ -48,6 +48,7 @@ private:
|
||||
void findConfigOverride ();
|
||||
void findPattern ();
|
||||
void findSubstitution ();
|
||||
void findTag ();
|
||||
void validate ();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user