CLI2: Added ::lexArguments to perform *all* lexing

This commit is contained in:
Paul Beckingham
2015-06-14 15:27:05 -04:00
parent ab367145c6
commit 9d5a10bd89
2 changed files with 24 additions and 15 deletions

View File

@@ -375,21 +375,10 @@ void CLI2::handleArg0 ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Intended to be called after ::add() to perform the final analysis. void CLI2::lexArguments ()
void CLI2::analyze ()
{ {
if (context.config.getInteger ("debug.parser") >= 3) // Note: Starts interating at index 1, because ::handleArg0 has already
{ // processed it.
context.debug ("---------------------------------------------------------------------------------");
context.debug (dump ("CLI2::analyze start"));
}
// Start from scratch.
_args.clear ();
handleArg0 ();
// Look at each arg, and decide if it warrants lexing.
// Note: Starts interating at index 1.
for (unsigned int i = 1; i < _original_args.size (); ++i) for (unsigned int i = 1; i < _original_args.size (); ++i)
{ {
std::string lexeme; std::string lexeme;
@@ -401,7 +390,26 @@ void CLI2::analyze ()
_args.push_back (A2 ("arg", lexeme, type)); _args.push_back (A2 ("arg", lexeme, type));
} }
// Now process _args. if (context.config.getInteger ("debug.parser") >= 3)
context.debug (dump ("CLI2::analyze lexArguments"));
}
////////////////////////////////////////////////////////////////////////////////
// Intended to be called after ::add() to perform the final analysis.
void CLI2::analyze ()
{
if (context.config.getInteger ("debug.parser") >= 3)
{
context.debug ("---------------------------------------------------------------------------------");
context.debug (dump ("CLI2::analyze start"));
}
// Process _original_args.
_args.clear ();
handleArg0 ();
lexArguments ();
// Process _args.
aliasExpansion (); aliasExpansion ();
findOverrides (); findOverrides ();

View File

@@ -111,6 +111,7 @@ private:
void addArg (const std::string&); void addArg (const std::string&);
*/ */
void handleArg0 (); void handleArg0 ();
void lexArguments ();
void aliasExpansion (); void aliasExpansion ();
void findOverrides (); void findOverrides ();
/* /*