A3t
- Modified ::findCommand to scan for already-found commands, so as not to find a second, if the method is called again. - Fixed a bug where all likely commands were tagged, not just the first.
This commit is contained in:
12
src/A3t.cpp
12
src/A3t.cpp
@@ -233,8 +233,15 @@ void A3t::findTerminator ()
|
|||||||
// autoCompletes to a valid command/report.
|
// autoCompletes to a valid command/report.
|
||||||
void A3t::findCommand ()
|
void A3t::findCommand ()
|
||||||
{
|
{
|
||||||
|
// There can be only one.
|
||||||
|
// Scan for an existing CMD tag, to short-circuit scanning for another.
|
||||||
std::string command;
|
std::string command;
|
||||||
std::vector <Tree*>::iterator i;
|
std::vector <Tree*>::iterator i;
|
||||||
|
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||||
|
if ((*i)->hasTag ("CMD"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// No CMD tag found, now look for a command.
|
||||||
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i)
|
||||||
{
|
{
|
||||||
// Parser override operator.
|
// Parser override operator.
|
||||||
@@ -252,6 +259,7 @@ void A3t::findCommand ()
|
|||||||
(*i)->tag ("CMD");
|
(*i)->tag ("CMD");
|
||||||
(*i)->tag ("REPORT");
|
(*i)->tag ("REPORT");
|
||||||
(*i)->attribute ("canonical", command);
|
(*i)->attribute ("canonical", command);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -261,6 +269,7 @@ void A3t::findCommand ()
|
|||||||
(*i)->tag ("CMD");
|
(*i)->tag ("CMD");
|
||||||
(*i)->tag ("READCMD");
|
(*i)->tag ("READCMD");
|
||||||
(*i)->attribute ("canonical", command);
|
(*i)->attribute ("canonical", command);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (canonicalize (command, "writecmd", (*i)->attribute ("raw")))
|
else if (canonicalize (command, "writecmd", (*i)->attribute ("raw")))
|
||||||
@@ -269,6 +278,7 @@ void A3t::findCommand ()
|
|||||||
(*i)->tag ("CMD");
|
(*i)->tag ("CMD");
|
||||||
(*i)->tag ("WRITECMD");
|
(*i)->tag ("WRITECMD");
|
||||||
(*i)->attribute ("canonical", command);
|
(*i)->attribute ("canonical", command);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (canonicalize (command, "helper", (*i)->attribute ("raw")))
|
else if (canonicalize (command, "helper", (*i)->attribute ("raw")))
|
||||||
@@ -277,6 +287,7 @@ void A3t::findCommand ()
|
|||||||
(*i)->tag ("CMD");
|
(*i)->tag ("CMD");
|
||||||
(*i)->tag ("HELPER");
|
(*i)->tag ("HELPER");
|
||||||
(*i)->attribute ("canonical", command);
|
(*i)->attribute ("canonical", command);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -286,6 +297,7 @@ void A3t::findCommand ()
|
|||||||
(*i)->tag ("CMD");
|
(*i)->tag ("CMD");
|
||||||
(*i)->tag ("SPECIALCMD");
|
(*i)->tag ("SPECIALCMD");
|
||||||
(*i)->attribute ("canonical", command);
|
(*i)->attribute ("canonical", command);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user