diff --git a/src/parser/A3t.cpp b/src/parser/A3t.cpp index 33f454bbe..ad7a445ef 100644 --- a/src/parser/A3t.cpp +++ b/src/parser/A3t.cpp @@ -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 ::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 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 ::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 () diff --git a/src/parser/A3t.h b/src/parser/A3t.h index 6b85ab85b..bac5293d6 100644 --- a/src/parser/A3t.h +++ b/src/parser/A3t.h @@ -52,6 +52,7 @@ private: void findAttribute (); void findAttributeModifier (); void findIdSequence (); + void findUUIDList (); void validate (); private: diff --git a/src/parser/run b/src/parser/run index 56f594558..4b91c886e 100755 --- a/src/parser/run +++ b/src/parser/run @@ -10,5 +10,5 @@ echo; ./args rc:~/.taskrc 123-128,140 142 mod pro:'P 1' +home /from/to/g /from/to/ rc.name=value echo; ./args rc:~/..taskrc rc.name=value add -- modify +tag /from/to/g name:value /long/path/to/file.txt -echo; ./args /pattern/ limit:10 due.before:eom nex +echo; ./args /pattern/ or 8ad2e3db-914d-4832-b0e6-72fa04f6e331 limit:10 due.before:eom nex