- Code cleanup for ::findCommand.
This commit is contained in:
Paul Beckingham 2014-08-24 13:25:12 -04:00
parent ce914a31f9
commit a2763a275c

View file

@ -435,14 +435,15 @@ void Parser::findCommand ()
std::vector <Tree*> nodes;
collect (nodes, collectAll);
// There can be only one.
// Scan for an existing CMD tag, to short-circuit scanning for another.
// There can be only one.
std::vector <Tree*>::iterator i;
for (i = nodes.begin (); i != nodes.end (); ++i)
if ((*i)->hasTag ("CMD"))
return;
// No CMD tag found, now look for a command.
// If no CMD tag was found, rescan all nodes and canonicalize args, looking
// for the first match.
std::string command;
for (i = nodes.begin (); i != nodes.end (); ++i)
{