diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 358f9a870..4b56c4014 100644 --- a/src/CLI2.cpp +++ b/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. diff --git a/src/CLI2.h b/src/CLI2.h index 4e768fb4c..85a982e9a 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -86,6 +86,7 @@ public: private: void handleArg0 (); void lexArguments (); + void demoteDOM (); void handleTerminator (); void aliasExpansion (); void findOverrides ();