- ::findIdSequence now safely removes nodes out of the iterator loop.
This commit is contained in:
Paul Beckingham
2014-08-24 13:14:52 -04:00
parent 4f1b63ff02
commit f898953a2e

View File

@@ -1273,18 +1273,29 @@ void Parser::findAttributeModifier ()
void Parser::findIdSequence () void Parser::findIdSequence ()
{ {
context.debug ("Parser::findIdSequence"); context.debug ("Parser::findIdSequence");
bool action = false; bool action = true;
do
{
action = false;
std::vector <Tree*> nodes; std::vector <Tree*> nodes;
collect (nodes); collect (nodes, collectAll);
std::vector <Tree*>::iterator i; std::vector <Tree*>::iterator i;
for (i = nodes.begin (); i != nodes.end (); ++i) for (i = nodes.begin (); i != nodes.end (); ++i)
{ {
std::string raw = (*i)->attribute ("raw");
if (raw == "--")
break;
if (! (*i)->hasTag ("?"))
continue;
// Container for min/max ID ranges. // Container for min/max ID ranges.
std::vector <std::pair <int, int> > ranges; std::vector <std::pair <int, int> > ranges;
// Split the ID list into elements. // Split the ID list into elements.
std::string raw = (*i)->attribute ("raw");
std::vector <std::string> elements; std::vector <std::string> elements;
split (elements, raw, ','); split (elements, raw, ',');
@@ -1422,9 +1433,11 @@ void Parser::findIdSequence ()
branch->attribute ("raw", ")"); branch->attribute ("raw", ")");
branch->tag ("OP"); branch->tag ("OP");
action = true; action = true;
break;
} }
}
while (action);
if (action)
context.debug (_tree->dump ()); context.debug (_tree->dump ());
} }