- Converted ::findTerminator to use the recursive scanner.
This commit is contained in:
Paul Beckingham 2014-08-17 00:41:11 -04:00
parent fb32b160b8
commit 3c612a8551
2 changed files with 20 additions and 22 deletions

View file

@ -170,13 +170,12 @@ Tree* Parser::tree ()
Tree* Parser::parse ()
{
findBinary ();
findTerminator ();
scan (&Parser::findTerminator);
resolveAliases ();
findOverrides ();
applyOverrides ();
findSubstitution ();
findPattern ();
findTag ();
@ -331,27 +330,26 @@ void Parser::findBinary ()
////////////////////////////////////////////////////////////////////////////////
// The parser override operator terminates all subsequent cleverness, leaving
// all args in the raw state.
void Parser::findTerminator ()
void Parser::findTerminator (Tree* t)
{
bool found = false;
std::vector <Tree*>::iterator i;
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
// Mark the terminator.
static bool found = false;
if (! found &&
t->attribute ("raw") == "--")
{
if (!found &&
(*i)->attribute ("raw") == "--")
{
(*i)->unTag ("?");
(*i)->removeAllBranches ();
(*i)->tag ("TERMINATOR");
found = true;
}
else if (found)
{
(*i)->unTag ("?");
(*i)->removeAllBranches ();
(*i)->tag ("WORD");
(*i)->tag ("TERMINATED");
}
t->unTag ("?");
t->removeAllBranches ();
t->tag ("TERMINATOR");
found = true;
}
// Mark subsequent nodes.
else if (found)
{
t->unTag ("?");
t->removeAllBranches ();
t->tag ("WORD");
t->tag ("TERMINATED");
}
}