diff --git a/src/CLI.cpp b/src/CLI.cpp index c05170acc..994a4afbe 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -25,7 +25,8 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include +#include // TODO Remove. #include #include #include @@ -325,7 +326,6 @@ const std::string CLI::getFilter () } } - dump ("CLI::getFilter"); return "( " + filter + " )"; } @@ -336,7 +336,6 @@ const std::vector CLI::getWords () // TODO Processing here. - dump ("CLI::getWords"); return words; } @@ -347,10 +346,34 @@ const std::vector CLI::getModifications () // TODO Processing here. - dump ("CLI::getModifications"); return modifications; } +//////////////////////////////////////////////////////////////////////////////// +const std::string CLI::dump () const +{ + std::stringstream out; + + out << "\033[1mCLI Parser\033[0m\n" + << " _original_args\n "; + Color colorOrigArgs ("gray10 on gray4"); + std::vector ::const_iterator i; + for (i = _original_args.begin (); i != _original_args.end (); ++i) + { + if (i != _original_args.begin ()) + out << ' '; + out << colorOrigArgs.colorize (*i); + } + out << "\n"; + + out << " _args\n"; + std::vector ::const_iterator a; + for (a = _args.begin (); a != _args.end (); ++a) + out << " " << a->dump () << "\n"; + + return out.str (); +} + //////////////////////////////////////////////////////////////////////////////// void CLI::aliasExpansion () { @@ -1149,24 +1172,3 @@ void CLI::desugarUUIDs () } //////////////////////////////////////////////////////////////////////////////// -void CLI::dump (const std::string& label) const -{ - std::cout << label << "\n" - << " _original_args "; - Color colorOrigArgs ("gray10 on gray4"); - std::vector ::const_iterator i; - for (i = _original_args.begin (); i != _original_args.end (); ++i) - { - if (i != _original_args.begin ()) - std::cout << ' '; - std::cout << colorOrigArgs.colorize (*i); - } - std::cout << "\n"; - - std::cout << " _args\n"; - std::vector ::const_iterator a; - for (a = _args.begin (); a != _args.end (); ++a) - std::cout << " " << a->dump () << "\n"; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/CLI.h b/src/CLI.h index 4fd5c4af2..6f8f4d2d2 100644 --- a/src/CLI.h +++ b/src/CLI.h @@ -72,6 +72,7 @@ public: const std::string getFilter (); const std::vector getWords (); const std::vector getModifications (); + const std::string dump () const; private: void aliasExpansion (); @@ -85,7 +86,6 @@ private: void desugarPatterns (); void desugarIDs (); void desugarUUIDs (); - void dump (const std::string&) const; public: std::multimap _entities; diff --git a/src/Filter.cpp b/src/Filter.cpp index 7636ee68f..046cada37 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -74,6 +74,8 @@ void Filter::subset (const std::vector & input, std::vector & output if (context.config.getInteger ("debug.parser") >= 1) { + context.debug (context.cli.dump ()); + Tree* t = context.parser.tree (); if (t) context.debug (t->dump ()); @@ -121,6 +123,8 @@ void Filter::subset (std::vector & output) if (context.config.getInteger ("debug.parser") >= 1) { + context.debug (context.cli.dump ()); + Tree* t = context.parser.tree (); if (t) context.debug (t->dump ());