mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47: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"));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
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 ()
|
||||
{
|
||||
|
@ -424,6 +447,7 @@ void CLI2::analyze ()
|
|||
_args.clear ();
|
||||
handleArg0 ();
|
||||
lexArguments ();
|
||||
demoteDOM ();
|
||||
handleTerminator ();
|
||||
|
||||
// Process _args.
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
private:
|
||||
void handleArg0 ();
|
||||
void lexArguments ();
|
||||
void demoteDOM ();
|
||||
void handleTerminator ();
|
||||
void aliasExpansion ();
|
||||
void findOverrides ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue