X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbooleanevaluator.cpp;h=b7c399f9cbc97c58384f0a732c8a6bf1accdc797;hb=eeb32cca939697d04254f84b81b68d9b1b14951d;hp=6891abceff9a8088db506c6ea1388664830fb4f1;hpb=44c71b05ff282b3ce5a2d71c0f14eed97bfefea6;p=builder.git diff --git a/source/booleanevaluator.cpp b/source/booleanevaluator.cpp index 6891abc..b7c399f 100644 --- a/source/booleanevaluator.cpp +++ b/source/booleanevaluator.cpp @@ -1,10 +1,12 @@ #include +#include #include "booleanevaluator.h" using namespace std; +using namespace Msp; BooleanEvaluator::BooleanEvaluator(const ValueFunction &f): - func([&f](const string &value, const string *){ return f(value); }), + func([f](const string &value, const string *){ return f(value); }), ops("&|!") { } @@ -51,7 +53,7 @@ bool BooleanEvaluator::evaluate(const string &str) else if(ops.find(*i)!=string::npos) push_op(*i); else - throw runtime_error("syntax error at "+string(1, *i)); + throw runtime_error(format("syntax error at %c", *i)); } } @@ -67,7 +69,7 @@ bool BooleanEvaluator::evaluate(const string &str) void BooleanEvaluator::push_op(char op) { if(last_was_op!=is_unary(op)) - throw runtime_error("syntax error at "+string(1, op)); + throw runtime_error(format("syntax error at %c", op)); // TODO Disallow mixing of ! and =/^ if(is_logic(op) && !var_stack.empty()) value_stack.push_back(pop_value());