CLI2: Simplified all parsing by removing terminator considerations

This commit is contained in:
Paul Beckingham 2015-06-14 16:39:03 -04:00
parent 2cab600674
commit 0aff903024

View file

@ -872,16 +872,10 @@ void CLI2::aliasExpansion ()
action = false; action = false;
std::vector <A2> reconstructed; std::vector <A2> reconstructed;
bool terminated = false;
std::string raw; std::string raw;
for (auto& i : _args) for (auto& i : _args)
{ {
raw = i.attribute ("raw"); raw = i.attribute ("raw");
if (i._lextype == Lexer::Type::separator)
terminated = true;
if (! terminated)
{
if (_aliases.find (raw) != _aliases.end ()) if (_aliases.find (raw) != _aliases.end ())
{ {
auto lexed = Lexer::split (_aliases[raw]); auto lexed = Lexer::split (_aliases[raw]);
@ -899,9 +893,6 @@ void CLI2::aliasExpansion ()
else else
reconstructed.push_back (i); reconstructed.push_back (i);
} }
else
reconstructed.push_back (i);
}
_args = reconstructed; _args = reconstructed;
} }
@ -923,9 +914,6 @@ void CLI2::findOverrides ()
for (auto& a : _args) for (auto& a : _args)
{ {
if (a._lextype == Lexer::Type::separator)
break;
raw = a.attribute ("raw"); raw = a.attribute ("raw");
if (raw.length () > 3 && if (raw.length () > 3 &&
raw.find ("rc:") == 0) raw.find ("rc:") == 0)
@ -960,9 +948,6 @@ void CLI2::findCommand ()
{ {
for (auto& a : _args) for (auto& a : _args)
{ {
if (a._lextype == Lexer::Type::separator)
break;
std::string canonical; std::string canonical;
if (canonicalize (canonical, "cmd", a.attribute ("raw"))) if (canonicalize (canonical, "cmd", a.attribute ("raw")))
{ {