From 657d5b8310f6b7b80d9c0da9f1f2daf16168a448 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 13 Jun 2015 15:01:20 -0400 Subject: [PATCH] CLI2: Added CLI2::dump and A2::dump methods. --- src/CLI2.cpp | 14 +++++++++++--- src/CLI2.h | 5 ++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 82920ea0b..b5fc0317e 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -31,7 +31,7 @@ //#include //#include #include -//#include +#include #include //#include #include @@ -175,7 +175,7 @@ void A2::removeAttribute (const std::string& name) { _attributes.erase (name); } - +*/ //////////////////////////////////////////////////////////////////////////////// const std::string A2::dump () const { @@ -194,6 +194,7 @@ const std::string A2::dump () const if (atts.length ()) output += " " + atts; +/* // Dump tags. std::string tags; for (auto& tag : _tags) @@ -214,10 +215,10 @@ const std::string A2::dump () const if (tags.length ()) output += ' ' + tags; +*/ return output; } -*/ //////////////////////////////////////////////////////////////////////////////// // Static method. @@ -345,8 +346,10 @@ void CLI2::add (const std::string& argument) // Intended to be called after ::add() to perform the final analysis. void CLI2::analyze () { + // Start from scratch. _args.clear (); + // Look at each arg, and decide if it warrants lexing. for (unsigned int i = 0; i < _original_args.size (); ++i) { std::string raw = _original_args[i]; @@ -382,7 +385,10 @@ void CLI2::analyze () } if (context.config.getInteger ("debug.parser") >= 3) + { + context.debug (dump ()); context.debug ("CLI2::analyze end"); + } } /* @@ -693,6 +699,7 @@ std::string CLI2::getLimit () const return "0"; } +*/ //////////////////////////////////////////////////////////////////////////////// const std::string CLI2::dump (const std::string& title) const @@ -717,6 +724,7 @@ const std::string CLI2::dump (const std::string& title) const return out.str (); } +/* //////////////////////////////////////////////////////////////////////////////// // Note: This seems silly - it's essentially performing a low-quality parse. But // that is really all that is needed - to separate the args that need to diff --git a/src/CLI2.h b/src/CLI2.h index 693b7b842..8adf8614b 100644 --- a/src/CLI2.h +++ b/src/CLI2.h @@ -57,8 +57,9 @@ public: void attribute (const std::string&, const double); const std::string attribute (const std::string&) const; void removeAttribute (const std::string&); - const std::string dump () const; */ + const std::string dump () const; + public: std::string _name; Lexer::Type _lextype; @@ -99,8 +100,10 @@ public: std::string getBinary () const; std::string getCommand () const; std::string getLimit () const; +*/ const std::string dump (const std::string& title = "CLI2 Parser") const; +/* private: void addArg (const std::string&); void aliasExpansion ();