CLI
- Implemented ::decomposeModAttribute.
This commit is contained in:
89
src/CLI.cpp
89
src/CLI.cpp
@@ -292,13 +292,16 @@ void CLI::analyze ()
|
|||||||
findOverrides ();
|
findOverrides ();
|
||||||
categorize ();
|
categorize ();
|
||||||
|
|
||||||
// Remove all the syntactic sugar.
|
// Remove all the syntactic sugar for FILTERs..
|
||||||
desugarTags ();
|
desugarTags ();
|
||||||
desugarAttributes ();
|
desugarAttributes ();
|
||||||
desugarAttributeModifiers ();
|
desugarAttributeModifiers ();
|
||||||
desugarPatterns ();
|
desugarPatterns ();
|
||||||
desugarIDs ();
|
desugarIDs ();
|
||||||
desugarUUIDs ();
|
desugarUUIDs ();
|
||||||
|
|
||||||
|
// Decompose the elements for MODIFICATIONs.
|
||||||
|
decomposeModAttributes ();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1172,3 +1175,87 @@ void CLI::desugarUUIDs ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CLI::decomposeModAttributes ()
|
||||||
|
{
|
||||||
|
std::vector <A> reconstructed;
|
||||||
|
std::vector <A>::iterator a;
|
||||||
|
for (a = _args.begin (); a != _args.end (); ++a)
|
||||||
|
{
|
||||||
|
if (a->hasTag ("MODIFICATION"))
|
||||||
|
{
|
||||||
|
// Look for a valid attribute name.
|
||||||
|
bool found = false;
|
||||||
|
Nibbler n (a->attribute ("raw"));
|
||||||
|
std::string name;
|
||||||
|
if (n.getName (name) &&
|
||||||
|
name.length ())
|
||||||
|
{
|
||||||
|
if (n.skip (':'))
|
||||||
|
{
|
||||||
|
std::string value;
|
||||||
|
if (n.getQuoted ('"', value) ||
|
||||||
|
n.getQuoted ('\'', value) ||
|
||||||
|
n.getUntilEOS (value) ||
|
||||||
|
n.depleted ())
|
||||||
|
{
|
||||||
|
if (value == "")
|
||||||
|
value = "''";
|
||||||
|
|
||||||
|
std::string canonical;
|
||||||
|
if (canonicalize (canonical, "uda", name))
|
||||||
|
{
|
||||||
|
A attr ("argUDA", name);
|
||||||
|
attr.attribute ("name", canonical);
|
||||||
|
attr.attribute ("value", value);
|
||||||
|
attr.tag ("UDA");
|
||||||
|
attr.tag ("MODIFIABLE");
|
||||||
|
attr.tag ("MODIFICATION");
|
||||||
|
reconstructed.push_back (attr);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (canonicalize (canonical, "pseudo", name))
|
||||||
|
{
|
||||||
|
A attr ("argUDA", name);
|
||||||
|
attr.attribute ("name", canonical);
|
||||||
|
attr.attribute ("value", value);
|
||||||
|
attr.tag ("PSEUDO");
|
||||||
|
attr.tag ("MODIFICATION");
|
||||||
|
reconstructed.push_back (attr);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (canonicalize (canonical, "attribute", name))
|
||||||
|
{
|
||||||
|
A attr ("argAtt", name);
|
||||||
|
attr.attribute ("name", canonical);
|
||||||
|
attr.attribute ("value", value);
|
||||||
|
attr.tag ("ATTRIBUTE");
|
||||||
|
attr.tag ("MODIFICATION");
|
||||||
|
|
||||||
|
std::map <std::string, Column*>::const_iterator col;
|
||||||
|
col = context.columns.find (canonical);
|
||||||
|
if (col != context.columns.end () &&
|
||||||
|
col->second->modifiable ())
|
||||||
|
{
|
||||||
|
attr.tag ("MODIFIABLE");
|
||||||
|
}
|
||||||
|
|
||||||
|
reconstructed.push_back (attr);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
reconstructed.push_back (*a);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
reconstructed.push_back (*a);
|
||||||
|
}
|
||||||
|
|
||||||
|
_args = reconstructed;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ private:
|
|||||||
void desugarPatterns ();
|
void desugarPatterns ();
|
||||||
void desugarIDs ();
|
void desugarIDs ();
|
||||||
void desugarUUIDs ();
|
void desugarUUIDs ();
|
||||||
|
void decomposeModAttributes ();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::multimap <std::string, std::string> _entities;
|
std::multimap <std::string, std::string> _entities;
|
||||||
|
|||||||
Reference in New Issue
Block a user