mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Eval: Added method for providing a precompiled expression
This commit is contained in:
parent
ad18d13c29
commit
9db73962da
2 changed files with 20 additions and 0 deletions
19
src/Eval.cpp
19
src/Eval.cpp
|
@ -196,6 +196,25 @@ void Eval::compileExpression (const std::string& e)
|
|||
context.debug ("[1;37;42mFILTER[0m Postfix " + dump (_compiled));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Eval::compileExpression (
|
||||
const std::vector <std::pair <std::string, Lexer::Type>>& precompiled)
|
||||
{
|
||||
_compiled = precompiled;
|
||||
|
||||
// Parse for syntax checking and operator replacement.
|
||||
if (_debug)
|
||||
context.debug ("[1;37;42mFILTER[0m Infix " + dump (_compiled));
|
||||
infixParse (_compiled);
|
||||
if (_debug)
|
||||
context.debug ("[1;37;42mFILTER[0m Infix parsed " + dump (_compiled));
|
||||
|
||||
// Convert infix --> postfix.
|
||||
infixToPostfix (_compiled);
|
||||
if (_debug)
|
||||
context.debug ("[1;37;42mFILTER[0m Postfix " + dump (_compiled));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Eval::evaluateCompiledExpression (Variant& v)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
void evaluateInfixExpression (const std::string&, Variant&) const;
|
||||
void evaluatePostfixExpression (const std::string&, Variant&) const;
|
||||
void compileExpression (const std::string&);
|
||||
void compileExpression (const std::vector <std::pair <std::string, Lexer::Type>>&);
|
||||
void evaluateCompiledExpression (Variant&);
|
||||
void ambiguity (bool);
|
||||
void debug (bool);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue