- ::findPattern was performing the wrong scan, and needed branch pruning outside
  the iterator loop.
This commit is contained in:
Paul Beckingham 2014-08-24 16:09:30 -04:00
parent ce7f6b6492
commit 8b904a57f4

View file

@ -805,11 +805,14 @@ std::string Parser::getCommand () const
// /pattern/ --> description ~ pattern
void Parser::findPattern ()
{
// context.debug ("Parser::findPattern");
bool action = true;
do
{
action = false;
std::vector <Tree*> prune;
std::vector <Tree*> nodes;
collect (nodes, collectAll);
collect (nodes);
std::vector <Tree*>::iterator i;
for (i = nodes.begin (); i != nodes.end (); ++i)
{
@ -821,7 +824,7 @@ void Parser::findPattern ()
{
(*i)->unTag ("?");
(*i)->tag ("PATTERN");
prune.push_back (*i);
(*i)->removeAllBranches ();
Tree* branch = (*i)->addBranch (new Tree ("argPat"));
branch->attribute ("raw", "description");
@ -833,15 +836,12 @@ void Parser::findPattern ()
branch = (*i)->addBranch (new Tree ("argPat"));
branch->attribute ("raw", pattern);
branch->tag ("STRING");
action = true;
break;
}
}
// Prune branches outside the loop.
for (i = prune.begin (); i != prune.end (); ++i)
(*i)->removeAllBranches ();
// if (prune.size ())
// context.debug (_tree->dump ());
}
while (action);
}
////////////////////////////////////////////////////////////////////////////////