From d105f217ae61c9d58858226cfb59329bb5514d7d Mon Sep 17 00:00:00 2001 From: Mikhail Yakshin Date: Mon, 25 Mar 2024 10:10:30 +0000 Subject: [PATCH] CommonOps: multiply all precedences by 10x to allow some interval in between values in case we'll ever need that --- .../kaitai/struct/translators/CommonOps.scala | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shared/src/main/scala/io/kaitai/struct/translators/CommonOps.scala b/shared/src/main/scala/io/kaitai/struct/translators/CommonOps.scala index a0cdab512..3d1482d0c 100644 --- a/shared/src/main/scala/io/kaitai/struct/translators/CommonOps.scala +++ b/shared/src/main/scala/io/kaitai/struct/translators/CommonOps.scala @@ -14,16 +14,16 @@ trait CommonOps extends AbstractTranslator { * @see https://docs.python.org/3/reference/expressions.html#operator-precedence */ val OPERATOR_PRECEDENCE = Map[Ast.operator, Int]( - Ast.operator.Mult -> 13, - Ast.operator.Div -> 13, - Ast.operator.Mod -> 13, - Ast.operator.Add -> 12, - Ast.operator.Sub -> 12, - Ast.operator.LShift -> 11, - Ast.operator.RShift -> 11, - Ast.operator.BitAnd -> 10, - Ast.operator.BitXor -> 9, - Ast.operator.BitOr -> 8, + Ast.operator.Mult -> 130, + Ast.operator.Div -> 130, + Ast.operator.Mod -> 130, + Ast.operator.Add -> 120, + Ast.operator.Sub -> 120, + Ast.operator.LShift -> 110, + Ast.operator.RShift -> 110, + Ast.operator.BitAnd -> 100, + Ast.operator.BitXor -> 90, + Ast.operator.BitOr -> 80, ) def genericBinOp(left: Ast.expr, op: Ast.operator, right: Ast.expr, extPrec: Int): String =