mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
CLI2: Simplified all parsing by removing terminator considerations
This commit is contained in:
parent
2cab600674
commit
0aff903024
1 changed files with 10 additions and 25 deletions
35
src/CLI2.cpp
35
src/CLI2.cpp
|
@ -872,32 +872,23 @@ 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)
|
if (_aliases.find (raw) != _aliases.end ())
|
||||||
terminated = true;
|
|
||||||
|
|
||||||
if (! terminated)
|
|
||||||
{
|
{
|
||||||
if (_aliases.find (raw) != _aliases.end ())
|
auto lexed = Lexer::split (_aliases[raw]);
|
||||||
|
for (auto& l : lexed)
|
||||||
{
|
{
|
||||||
auto lexed = Lexer::split (_aliases[raw]);
|
A2 a ("argLex", l, Lexer::Type::word);
|
||||||
for (auto& l : lexed)
|
a.tag ("ALIAS");
|
||||||
{
|
a.tag ("LEX");
|
||||||
A2 a ("argLex", l, Lexer::Type::word);
|
reconstructed.push_back (a);
|
||||||
a.tag ("ALIAS");
|
|
||||||
a.tag ("LEX");
|
|
||||||
reconstructed.push_back (a);
|
|
||||||
}
|
|
||||||
|
|
||||||
action = true;
|
|
||||||
changes = true;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
reconstructed.push_back (i);
|
action = true;
|
||||||
|
changes = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
reconstructed.push_back (i);
|
reconstructed.push_back (i);
|
||||||
|
@ -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")))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue