Add non static evaluation for simple expressions

This commit is contained in:
Jan
2022-08-13 14:13:11 +02:00
parent 403d7f2c44
commit 886bcfeaf8
21 changed files with 161 additions and 59 deletions

View File

@ -120,7 +120,7 @@ int MenuMatcherFactory::TokenIntExpressionValue(MenuFileParserState* state, Sequ
if (!expression || !expression->IsStatic())
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Not a valid static expression");
const auto value = expression->Evaluate();
const auto value = expression->EvaluateStatic();
if (value.m_type != SimpleExpressionValue::Type::INT)
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Expression MUST be int type");
@ -150,7 +150,7 @@ double MenuMatcherFactory::TokenNumericExpressionValue(MenuFileParserState* stat
if (!expression || !expression->IsStatic())
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), "Not a valid static expression");
const auto value = expression->Evaluate();
const auto value = expression->EvaluateStatic();
if (value.m_type == SimpleExpressionValue::Type::INT)
return value.m_int_value;