mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Eval: C++11
This commit is contained in:
parent
96f04ffc25
commit
197b440cc2
2 changed files with 4 additions and 14 deletions
|
@ -104,7 +104,6 @@ static bool namedConstants (const std::string& name, Variant& value)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Eval::Eval ()
|
Eval::Eval ()
|
||||||
: _debug (false)
|
|
||||||
{
|
{
|
||||||
addSource (namedConstants);
|
addSource (namedConstants);
|
||||||
}
|
}
|
||||||
|
@ -225,8 +224,7 @@ void Eval::evaluatePostfixStack (
|
||||||
|
|
||||||
// This is stack used by the postfix evaluator.
|
// This is stack used by the postfix evaluator.
|
||||||
std::vector <Variant> values;
|
std::vector <Variant> values;
|
||||||
|
for (const auto& token : tokens)
|
||||||
for (auto& token : tokens)
|
|
||||||
{
|
{
|
||||||
// Unary operators.
|
// Unary operators.
|
||||||
if (token.second == Lexer::Type::op &&
|
if (token.second == Lexer::Type::op &&
|
||||||
|
@ -861,4 +859,3 @@ std::string Eval::dump (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
13
src/Eval.h
13
src/Eval.h
|
@ -36,9 +36,6 @@ class Eval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Eval ();
|
Eval ();
|
||||||
Eval (const Eval&); // Not implemented.
|
|
||||||
Eval& operator= (const Eval&); // Not implemented.
|
|
||||||
bool operator== (const Eval&); // Not implemented.
|
|
||||||
|
|
||||||
void addSource (bool (*fn)(const std::string&, Variant&));
|
void addSource (bool (*fn)(const std::string&, Variant&));
|
||||||
void evaluateInfixExpression (const std::string&, Variant&) const;
|
void evaluateInfixExpression (const std::string&, Variant&) const;
|
||||||
|
@ -69,13 +66,9 @@ private:
|
||||||
std::string dump (std::vector <std::pair <std::string, Lexer::Type>>&) const;
|
std::string dump (std::vector <std::pair <std::string, Lexer::Type>>&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector <bool (*)(const std::string&, Variant&)> _sources;
|
std::vector <bool (*)(const std::string&, Variant&)> _sources {};
|
||||||
bool _debug;
|
bool _debug {false};
|
||||||
std::vector <std::pair <std::string, Lexer::Type>> _compiled;
|
std::vector <std::pair <std::string, Lexer::Type>> _compiled {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue