summaryrefslogtreecommitdiff
path: root/src/parser.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/parser.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/parser.ts b/src/parser.ts
index c2aa30f..81f7a9e 100644
--- a/src/parser.ts
+++ b/src/parser.ts
@@ -119,14 +119,10 @@ const precedence = (op: BinOp) =>
const binOpWithFixitySwitchity = (op: BinOp, left: Expr, right: Expr) =>
match(right, {
BinOp: binOp => {
- if (precedence(op) > precedence(binOp.op)) {
+ if (precedence(op) >= precedence(binOp.op)) {
return Expr.BinOp({
op: binOp.op,
- left: Expr.BinOp({
- op,
- left: left,
- right: binOp.left,
- }),
+ left: binOpWithFixitySwitchity(op, left, binOp.left),
right: binOp.right,
})
}