Eval: Added method for providing a precompiled expression
This commit is contained in:
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));
|
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)
|
void Eval::evaluateCompiledExpression (Variant& v)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public:
|
|||||||
void evaluateInfixExpression (const std::string&, Variant&) const;
|
void evaluateInfixExpression (const std::string&, Variant&) const;
|
||||||
void evaluatePostfixExpression (const std::string&, Variant&) const;
|
void evaluatePostfixExpression (const std::string&, Variant&) const;
|
||||||
void compileExpression (const std::string&);
|
void compileExpression (const std::string&);
|
||||||
|
void compileExpression (const std::vector <std::pair <std::string, Lexer::Type>>&);
|
||||||
void evaluateCompiledExpression (Variant&);
|
void evaluateCompiledExpression (Variant&);
|
||||||
void ambiguity (bool);
|
void ambiguity (bool);
|
||||||
void debug (bool);
|
void debug (bool);
|
||||||
|
|||||||
Reference in New Issue
Block a user