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,46 +412,32 @@ void Parser::findTerminator ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// TODO This is not recusive, and needs to be.
|
||||
void Parser::resolveAliases ()
|
||||
{
|
||||
context.debug ("Parse::resolveAliases");
|
||||
|
||||
bool something;
|
||||
int safety_valve = safetyValveDefault;
|
||||
|
||||
do
|
||||
{
|
||||
something = false;
|
||||
|
||||
std::vector <Tree*> nodes;
|
||||
collect (nodes, false);
|
||||
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.
|
||||
if ((*i)->attribute ("raw") == "--")
|
||||
break;
|
||||
|
||||
std::map <std::string, std::string>::iterator a;
|
||||
if ((*i)->_branches.size ())
|
||||
std::map <std::string, std::string>::iterator a = _aliases.find ((*i)->attribute ("raw"));
|
||||
if (a != _aliases.end ())
|
||||
{
|
||||
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 ())
|
||||
{
|
||||
(*i)->attribute ("raw", a->second);
|
||||
(*i)->tag ("ALIAS");
|
||||
something = true;
|
||||
}
|
||||
(*i)->attribute ("raw", a->second);
|
||||
(*i)->tag ("ALIAS");
|
||||
something = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -459,6 +445,9 @@ void Parser::resolveAliases ()
|
|||
|
||||
if (safety_valve <= 0)
|
||||
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