CLI2: Implemented ::findOverrides relying on Lexer::Type

This commit is contained in:
Paul Beckingham 2015-06-13 16:51:14 -04:00
parent a433ca308a
commit 1d4a532ea2
2 changed files with 12 additions and 3 deletions

View file

@ -407,6 +407,9 @@ void CLI2::analyze ()
_args.push_back (A2 ("arg", lexeme, type)); _args.push_back (A2 ("arg", lexeme, type));
} }
// Now process _args.
findOverrides ();
if (context.config.getInteger ("debug.parser") >= 3) if (context.config.getInteger ("debug.parser") >= 3)
{ {
context.debug (dump ()); context.debug (dump ());
@ -873,6 +876,7 @@ void CLI2::aliasExpansion ()
context.config.getInteger ("debug.parser") >= 3) context.config.getInteger ("debug.parser") >= 3)
context.debug (dump ("CLI2::analyze aliasExpansion")); context.debug (dump ("CLI2::analyze aliasExpansion"));
} }
*/
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CLI2::findOverrides () void CLI2::findOverrides ()
@ -886,13 +890,15 @@ void CLI2::findOverrides ()
if (raw == "--") if (raw == "--")
break; break;
if (isRCOverride (raw)) if (raw.length () > 3 &&
raw.find ("rc:") == 0)
{ {
a.tag ("RC"); a.tag ("RC");
a.attribute ("file", raw.substr (3)); a.attribute ("file", raw.substr (3));
changes = true; changes = true;
} }
else if (isConfigOverride (raw)) else if (raw.length () > 3 &&
raw.find ("rc.") == 0)
{ {
auto sep = raw.find ('=', 3); auto sep = raw.find ('=', 3);
if (sep == std::string::npos) if (sep == std::string::npos)
@ -912,6 +918,7 @@ void CLI2::findOverrides ()
context.debug (dump ("CLI2::analyze findOverrides")); context.debug (dump ("CLI2::analyze findOverrides"));
} }
/*
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// TODO This method should further categorize args into whether or not they are // TODO This method should further categorize args into whether or not they are
// extracted by ::getWords. // extracted by ::getWords.

View file

@ -107,11 +107,13 @@ public:
*/ */
const std::string dump (const std::string& title = "CLI2 Parser") const; const std::string dump (const std::string& title = "CLI2 Parser") const;
/*
private: private:
/*
void addArg (const std::string&); void addArg (const std::string&);
void aliasExpansion (); void aliasExpansion ();
*/
void findOverrides (); void findOverrides ();
/*
void categorize (); void categorize ();
bool exactMatch (const std::string&, const std::string&) const; bool exactMatch (const std::string&, const std::string&) const;
void desugarFilterTags (); void desugarFilterTags ();