mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-30 02:17:21 +02:00
CLI, Filter
- Moved parse tree dump into Context::debug output.
This commit is contained in:
parent
24219e23a1
commit
b484abea4a
3 changed files with 32 additions and 26 deletions
52
src/CLI.cpp
52
src/CLI.cpp
|
@ -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";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
const std::string getFilter ();
|
||||
const std::vector <std::string> getWords ();
|
||||
const std::vector <std::string> 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 <std::string, std::string> _entities;
|
||||
|
|
|
@ -74,6 +74,8 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& 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 <Task>& output)
|
|||
|
||||
if (context.config.getInteger ("debug.parser") >= 1)
|
||||
{
|
||||
context.debug (context.cli.dump ());
|
||||
|
||||
Tree* t = context.parser.tree ();
|
||||
if (t)
|
||||
context.debug (t->dump ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue