Skip to content

Commit

Permalink
CommonOps: multiply all precedences by 10x to allow some interval in …
Browse files Browse the repository at this point in the history
…between values in case we'll ever need that
  • Loading branch information
GreyCat committed Mar 25, 2024
1 parent f93fa66 commit d105f21
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions shared/src/main/scala/io/kaitai/struct/translators/CommonOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit d105f21

Please sign in to comment.