CLI2: Added ::findUUIDs

This commit is contained in:
Paul Beckingham 2015-06-20 06:49:30 -07:00
parent d97aab799a
commit d92a6c3ee8
2 changed files with 11 additions and 36 deletions

View file

@ -639,8 +639,8 @@ void CLI2::prepareFilter (bool applyContext)
// Remove all the syntactic sugar for FILTERs. // Remove all the syntactic sugar for FILTERs.
changes = false; changes = false;
findIDs (); findIDs ();
/*
findUUIDs (); findUUIDs ();
/*
insertIDExpr (); insertIDExpr ();
desugarFilterTags (); desugarFilterTags ();
findStrayModifications (); findStrayModifications ();
@ -1480,49 +1480,24 @@ void CLI2::findIDs ()
} }
} }
/*
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CLI2::findUUIDs () void CLI2::findUUIDs ()
{ {
bool changes = false;
for (auto& a : _args) for (auto& a : _args)
{ {
if (a.hasTag ("FILTER")) if (a.hasTag ("FILTER") &&
a._lextype == Lexer::Type::uuid)
{ {
// UUIDs have a limited character set. a.tag ("UUID");
std::string raw = a.attribute ("raw"); _uuid_list.push_back (a.attribute ("raw"));
if (raw.find_first_not_of ("0123456789abcdefABCDEF-,") == std::string::npos) changes = true;
{
Nibbler n (raw);
std::vector <std::string> uuidList;
std::string uuid;
if (n.getUUID (uuid) ||
n.getPartialUUID (uuid))
{
uuidList.push_back (uuid);
while (n.skip (','))
{
if (! n.getUUID (uuid) &&
! n.getPartialUUID (uuid))
throw std::string (STRING_PARSER_UUID_AFTER_COMMA);
uuidList.push_back (uuid);
}
if (n.depleted ())
{
a.tag ("UUID");
// Save the list.
for (auto& uuid : uuidList)
_uuid_list.push_back (uuid);
}
}
}
} }
} }
} }
/*
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CLI2::insertIDExpr () void CLI2::insertIDExpr ()
{ {

View file

@ -122,8 +122,8 @@ private:
void desugarFilterPatterns (); void desugarFilterPatterns ();
*/ */
void findIDs (); void findIDs ();
/*
void findUUIDs (); void findUUIDs ();
/*
void insertIDExpr (); void insertIDExpr ();
void desugarFilterPlainArgs (); void desugarFilterPlainArgs ();
void findOperators (); void findOperators ();
@ -163,8 +163,8 @@ public:
std::vector <A2> _args; std::vector <A2> _args;
std::vector <std::pair <int, int>> _id_ranges; std::vector <std::pair <int, int>> _id_ranges;
/*
std::vector <std::string> _uuid_list; std::vector <std::string> _uuid_list;
/*
bool _strict; bool _strict;
bool _terminated; bool _terminated;
*/ */