mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-29 07:57:20 +02:00
CLI2: Added ::demoteDOM to demote unrecognized DOM args to words
This commit is contained in:
parent
2402ec8d6e
commit
1b83734392
2 changed files with 25 additions and 0 deletions
24
src/CLI2.cpp
24
src/CLI2.cpp
|
@ -381,6 +381,29 @@ void CLI2::lexArguments ()
|
||||||
context.debug (dump ("CLI2::analyze lexArguments"));
|
context.debug (dump ("CLI2::analyze lexArguments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CLI2::demoteDOM ()
|
||||||
|
{
|
||||||
|
bool changes = false;
|
||||||
|
|
||||||
|
for (auto& a : _args)
|
||||||
|
{
|
||||||
|
if (a._lextype == Lexer::Type::dom)
|
||||||
|
{
|
||||||
|
std::string canonicalized;
|
||||||
|
if (! canonicalize (canonicalized, "attribute", a.attribute ("raw")))
|
||||||
|
{
|
||||||
|
a._lextype = Lexer::Type::word;
|
||||||
|
changes = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changes)
|
||||||
|
if (context.config.getInteger ("debug.parser") >= 3)
|
||||||
|
context.debug (dump ("CLI2::analyze demoteDOM"));
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CLI2::handleTerminator ()
|
void CLI2::handleTerminator ()
|
||||||
{
|
{
|
||||||
|
@ -424,6 +447,7 @@ void CLI2::analyze ()
|
||||||
_args.clear ();
|
_args.clear ();
|
||||||
handleArg0 ();
|
handleArg0 ();
|
||||||
lexArguments ();
|
lexArguments ();
|
||||||
|
demoteDOM ();
|
||||||
handleTerminator ();
|
handleTerminator ();
|
||||||
|
|
||||||
// Process _args.
|
// Process _args.
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void handleArg0 ();
|
void handleArg0 ();
|
||||||
void lexArguments ();
|
void lexArguments ();
|
||||||
|
void demoteDOM ();
|
||||||
void handleTerminator ();
|
void handleTerminator ();
|
||||||
void aliasExpansion ();
|
void aliasExpansion ();
|
||||||
void findOverrides ();
|
void findOverrides ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue