///////////////////////////////////////////////////////////////////////////
| 121 | |
| 122 | //////////////////////////////////////////////////////////////////////////////// |
| 123 | void Eval::evaluateInfixExpression(const std::string& e, Variant& v) const { |
| 124 | // Reduce e to a vector of tokens. |
| 125 | Lexer l(e); |
| 126 | std::vector<std::pair<std::string, Lexer::Type>> tokens; |
| 127 | std::string token; |
| 128 | Lexer::Type type; |
| 129 | while (l.token(token, type)) tokens.emplace_back(token, type); |
| 130 | |
| 131 | // Parse for syntax checking and operator replacement. |
| 132 | if (_debug) Context::getContext().debug("[1;37;42mFILTER[0m Infix " + dump(tokens)); |
| 133 | infixParse(tokens); |
| 134 | if (_debug) Context::getContext().debug("[1;37;42mFILTER[0m Infix parsed " + dump(tokens)); |
| 135 | |
| 136 | // Convert infix --> postfix. |
| 137 | infixToPostfix(tokens); |
| 138 | if (_debug) Context::getContext().debug("[1;37;42mFILTER[0m Postfix " + dump(tokens)); |
| 139 | |
| 140 | // Call the postfix evaluator. |
| 141 | evaluatePostfixStack(tokens, v); |
| 142 | } |
| 143 | |
| 144 | //////////////////////////////////////////////////////////////////////////////// |
| 145 | void Eval::evaluatePostfixExpression(const std::string& e, Variant& v) const { |