A3t::findUUIDList

- Added support for UUID lists.
- Extended test script.
This commit is contained in:
Paul Beckingham
2013-09-01 12:13:05 -04:00
parent ed085bd09e
commit 8fddf97c73
3 changed files with 51 additions and 1 deletions

View File

@@ -69,6 +69,7 @@ Tree* A3t::parse ()
findTag ();
findAttribute ();
findAttributeModifier ();
findUUIDList (); // Before findIdSequence
findIdSequence ();
validate ();
@@ -562,6 +563,54 @@ void A3t::findIdSequence ()
}
}
////////////////////////////////////////////////////////////////////////////////
void A3t::findUUIDList ()
{
std::vector <Tree*>::iterator i;
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
{
// Parser override operator.
if ((*i)->attribute ("raw") == "--")
break;
// Skip known args.
if (! (*i)->hasTag ("?"))
continue;
std::string raw = (*i)->attribute ("raw");
Nibbler n (raw);
std::vector <std::string> sequence;
std::string uuid;
if (n.getUUID (uuid) ||
n.getPartialUUID (uuid))
{
sequence.push_back (uuid);
while (n.skip (','))
{
if (!n.getUUID (uuid) &&
!n.getPartialUUID (uuid))
throw std::string (STRING_A3_UUID_AFTER_COMMA);
sequence.push_back (uuid);
}
if (!n.depleted ())
throw std::string (STRING_A3_PATTERN_GARBAGE);
(*i)->unTag ("?");
(*i)->tag ("UUID");
std::vector <std::string>::iterator u;
for (u = sequence.begin (); u != sequence.end (); ++u)
{
Tree* branch = (*i)->addBranch (new Tree ("list"));
branch->attribute ("value", *u);
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
// Validate the parse tree.
void A3t::validate ()