mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-09-04 01:27:20 +02:00
Eval
- Converted from std::cout to Context::debug. This is in preparation for supporting multiple debug levels.
This commit is contained in:
parent
ad4d063252
commit
a77e50b441
1 changed files with 15 additions and 16 deletions
31
src/Eval.cpp
31
src/Eval.cpp
|
@ -25,7 +25,6 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <iostream>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -180,7 +179,7 @@ void Eval::compileExpression (const std::string& e)
|
||||||
while (l.token (token, type))
|
while (l.token (token, type))
|
||||||
{
|
{
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "evaluateInfixExpression token '" << token << "' " << Lexer::type_name (type) << "\n";
|
context.debug ("evaluateInfixExpression token '" + token + "' " + Lexer::type_name (type));
|
||||||
_compiled.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
_compiled.push_back (std::pair <std::string, Lexer::Type> (token, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,9 +246,9 @@ void Eval::evaluatePostfixStack (
|
||||||
values.pop_back ();
|
values.pop_back ();
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
std::cout << "[" << values.size () + 1 << "] eval pop '" << (std::string) right << "'\n";
|
context.debug (format ("[{1}] eval pop '{2}'", values.size () + 1, (std::string) right));
|
||||||
std::cout << "[" << values.size () << "] eval operator '" << token->first << "'\n";
|
context.debug (format ("[{1}] eval operator '{2}'", values.size (), token->first));
|
||||||
std::cout << "[" << values.size () << "] eval result push '" << (bool) !right << "'\n";
|
context.debug (format ("[{1}] eval result push '{2}'", values.size (), (bool) !right));
|
||||||
}
|
}
|
||||||
values.push_back (! right);
|
values.push_back (! right);
|
||||||
}
|
}
|
||||||
|
@ -260,9 +259,9 @@ void Eval::evaluatePostfixStack (
|
||||||
values.pop_back ();
|
values.pop_back ();
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
std::cout << "[" << values.size () + 1 << "] eval pop '" << (std::string) right << "'\n";
|
context.debug (format ("[{1}] eval pop '{2}'", values.size () + 1, (std::string) right));
|
||||||
std::cout << "[" << values.size () << "] eval operator '" << token->first << "'\n";
|
context.debug (format ("[{1}] eval operator '{2}'", values.size (), token->first));
|
||||||
std::cout << "[" << values.size () << "] eval result push '" << (bool) !right << "'\n";
|
context.debug (format ("[{1}] eval result push '{2}'", values.size (), (bool) !right));
|
||||||
}
|
}
|
||||||
values.push_back (Variant (0) - right);
|
values.push_back (Variant (0) - right);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +271,7 @@ void Eval::evaluatePostfixStack (
|
||||||
// NOP?
|
// NOP?
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
std::cout << "[" << values.size () << "] eval operator '" << token->first << "'\n";
|
context.debug (format ("[{1}] eval operator '{2}'", values.size (), token->first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,9 +286,9 @@ void Eval::evaluatePostfixStack (
|
||||||
|
|
||||||
if (_debug)
|
if (_debug)
|
||||||
{
|
{
|
||||||
std::cout << "[" << values.size () + 2 << "] eval pop '" << (std::string) right << "'\n";
|
context.debug (format ("[{1}] eval pop '{2}'", values.size () + 2, (std::string) right));
|
||||||
std::cout << "[" << values.size () + 1 << "] eval pop '" << (std::string) left << "'\n";
|
context.debug (format ("[{1}] eval pop '{2}'", values.size () + 1, (std::string) left));
|
||||||
std::cout << "[" << values.size () << "] eval operator '" << token->first << "'\n";
|
context.debug (format ("[{1}] eval operator '{2}'", values.size (), token->first));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ordering these by anticipation frequency of use is a good idea.
|
// Ordering these by anticipation frequency of use is a good idea.
|
||||||
|
@ -320,7 +319,7 @@ void Eval::evaluatePostfixStack (
|
||||||
throw format (STRING_EVAL_UNSUPPORTED, token->first);
|
throw format (STRING_EVAL_UNSUPPORTED, token->first);
|
||||||
|
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "[" << values.size () << "] eval result push '" << (std::string) left << "'\n";
|
context.debug (format ("[{1}] eval result push '{2}'", values.size (), (std::string) left));
|
||||||
values.push_back (left);
|
values.push_back (left);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +351,7 @@ void Eval::evaluatePostfixStack (
|
||||||
if ((*source) (token->first, v))
|
if ((*source) (token->first, v))
|
||||||
{
|
{
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "[" << values.size () << "] eval source '" << token->first << "' --> '" << (std::string) v << "'\n";
|
context.debug (format ("[{1}] eval source '{2}' --> '{3}'", values.size (), token->first, (std::string) v));
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +362,7 @@ void Eval::evaluatePostfixStack (
|
||||||
{
|
{
|
||||||
v.cast (Variant::type_string);
|
v.cast (Variant::type_string);
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "[" << values.size () << "] eval source failed '" << token->first << "'\n";
|
context.debug (format ("[{1}] eval source failed '{2}'", values.size (), token->first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -383,7 +382,7 @@ void Eval::evaluatePostfixStack (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_debug)
|
if (_debug)
|
||||||
std::cout << "[" << values.size () << "] eval push '" << (std::string) v << "'\n";
|
context.debug (format ("[{1}] eval push '{2}'", values.size (), (std::string) v));
|
||||||
values.push_back (v);
|
values.push_back (v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue