From 10e0a487ab67c34d7c41b4f1eadf72a7de519cae Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Wed, 14 Oct 2026 21:45:17 +0300 Subject: [PATCH] failed attempt to hotfix wrong post-processing bracket adding algorithm --- src/syntaxer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/syntaxer.cpp b/src/syntaxer.cpp index 61c93e3..66df65b 100644 --- a/src/syntaxer.cpp +++ b/src/syntaxer.cpp @@ -1120,6 +1120,8 @@ static int correct_operation_priorities(std::vector& tv, int { int corrections = 0; + Expression::Token::Operator last_op = Expression::Token::ADD; + for (int i = 0, same_lvl_op_cnt = -1, relative_level = -op; i < tv.size(); i++) { Expression::Token& tok = tv[i]; @@ -1164,8 +1166,9 @@ static int correct_operation_priorities(std::vector& tv, int break; } - if (same_op_ip) + if (same_op_ip && tok.v.o == last_op) { + last_op = tok.v.o; same_lvl_op_cnt++; if (same_lvl_op_cnt >= 1 && target_op) @@ -1198,6 +1201,16 @@ static int correct_operation_priorities(std::vector& tv, int relative_level++; } } + else + { + if (rank_op(tok.v.o) < ip) + { + same_lvl_op_cnt = 0; + } + + last_op = tok.v.o; + } + } } }