From c5475ce7805a50db14b444fe89f4e438cd35cc4a Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 25 Nov 2021 00:24:36 +0100 Subject: [PATCH] Fix unit tests failing for menu expressions --- .../Parsing/Menu/Matcher/MenuExpressionMatchers.cpp | 3 +++ .../Parsing/Simple/Expression/SimpleExpressionMatchers.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp index e6063ecb..12df8e50 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp @@ -38,6 +38,9 @@ std::unique_ptr MenuExpressionMatchers::Par std::unique_ptr MenuExpressionMatchers::ProcessOperandExtension(SequenceResult& result) const { + if (result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL) != TAG_EXPRESSION_FUNCTION_CALL) + throw ParsingException(TokenPos(), "Menu Operand Extension must be function call"); + auto functionCall = std::make_unique(result.NextCapture(CAPTURE_FUNCTION_NAME).IdentifierValue()); while (result.PeekAndRemoveIfTag(TAG_EXPRESSION_FUNCTION_CALL_END) != TAG_EXPRESSION_FUNCTION_CALL_END) diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp index 244bb4fe..5ade655a 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp @@ -63,7 +63,7 @@ std::vector SimpleExpressionMatchers: std::vector SimpleExpressionMatchers::EnabledBinaryOperations() const { return std::vector(&SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[0], - &SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[std::extent_v]); + &SimpleExpressionBinaryOperationType::ALL_OPERATION_TYPES[std::extent_v]); } std::unique_ptr SimpleExpressionMatchers::ProcessExpressionInParenthesis(SequenceResult& result) const @@ -171,7 +171,7 @@ std::unique_ptr SimpleExpressionMatchers::ProcessExpression(S if (p1.second->m_precedence != p2.second->m_precedence) return p1.second->m_precedence > p2.second->m_precedence; - return p1.first > p2.first; + return p1.first < p2.first; }); while (!operators.empty())