mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Parser
- Modified ::resolveAliases to use collect.
This commit is contained in:
parent
4645bbc85d
commit
bbff0123b0
1 changed files with 14 additions and 25 deletions
|
@ -412,40 +412,27 @@ void Parser::findTerminator ()
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// TODO This is not recusive, and needs to be.
|
|
||||||
void Parser::resolveAliases ()
|
void Parser::resolveAliases ()
|
||||||
{
|
{
|
||||||
|
context.debug ("Parse::resolveAliases");
|
||||||
|
|
||||||
bool something;
|
bool something;
|
||||||
int safety_valve = safetyValveDefault;
|
int safety_valve = safetyValveDefault;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
something = false;
|
something = false;
|
||||||
|
|
||||||
|
std::vector <Tree*> nodes;
|
||||||
|
collect (nodes, false);
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
for (i = nodes.begin (); i != nodes.end (); ++i)
|
||||||
{
|
{
|
||||||
// Parser override operator.
|
// Parser override operator.
|
||||||
if ((*i)->attribute ("raw") == "--")
|
if ((*i)->attribute ("raw") == "--")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
std::map <std::string, std::string>::iterator a;
|
std::map <std::string, std::string>::iterator a = _aliases.find ((*i)->attribute ("raw"));
|
||||||
if ((*i)->_branches.size ())
|
|
||||||
{
|
|
||||||
std::vector <Tree*>::iterator b;
|
|
||||||
for (b = (*i)->_branches.begin (); b != (*i)->_branches.end (); ++b)
|
|
||||||
{
|
|
||||||
a = _aliases.find ((*b)->attribute ("raw"));
|
|
||||||
if (a != _aliases.end ())
|
|
||||||
{
|
|
||||||
(*b)->attribute ("raw", a->second);
|
|
||||||
(*b)->tag ("ALIAS");
|
|
||||||
something = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
a = _aliases.find ((*i)->attribute ("raw"));
|
|
||||||
if (a != _aliases.end ())
|
if (a != _aliases.end ())
|
||||||
{
|
{
|
||||||
(*i)->attribute ("raw", a->second);
|
(*i)->attribute ("raw", a->second);
|
||||||
|
@ -454,11 +441,13 @@ void Parser::resolveAliases ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
while (something && --safety_valve > 0);
|
while (something && --safety_valve > 0);
|
||||||
|
|
||||||
if (safety_valve <= 0)
|
if (safety_valve <= 0)
|
||||||
context.debug (format (STRING_PARSER_ALIAS_NEST, safetyValveDefault));
|
context.debug (format (STRING_PARSER_ALIAS_NEST, safetyValveDefault));
|
||||||
|
|
||||||
|
if (something)
|
||||||
|
context.debug (_tree->dump ());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue