CLI, Filter

- Moved parse tree dump into Context::debug output.
This commit is contained in:
Paul Beckingham
2014-10-20 01:01:27 -04:00
parent 24219e23a1
commit b484abea4a
3 changed files with 32 additions and 26 deletions

View File

@@ -25,7 +25,8 @@
////////////////////////////////////////////////////////////////////////////////
#include <cmake.h>
#include <iostream>
#include <sstream>
#include <iostream> // TODO Remove.
#include <Context.h>
#include <Nibbler.h>
#include <Lexer.h>
@@ -325,7 +326,6 @@ const std::string CLI::getFilter ()
}
}
dump ("CLI::getFilter");
return "( " + filter + " )";
}
@@ -336,7 +336,6 @@ const std::vector <std::string> CLI::getWords ()
// TODO Processing here.
dump ("CLI::getWords");
return words;
}
@@ -347,10 +346,34 @@ const std::vector <std::string> 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 <std::string>::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 <A>::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 <std::string>::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 <A>::const_iterator a;
for (a = _args.begin (); a != _args.end (); ++a)
std::cout << " " << a->dump () << "\n";
}
////////////////////////////////////////////////////////////////////////////////