summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stdlib/infix.tl11
1 files changed, 8 insertions, 3 deletions
diff --git a/stdlib/infix.tl b/stdlib/infix.tl
index e45560aa..b08f6c90 100644
--- a/stdlib/infix.tl
+++ b/stdlib/infix.tl
@@ -109,14 +109,19 @@
(set exp ^((,op ,arg ,*args) ,*rest)))
((@[[chain ifx-uops .?funp] @op] () . @rest)
(set exp ^((,op) ,*rest)))
- ((@(@o1 [(if ucheck ifx-uops ifx-ops)]) . @rest)
+ ((@(with @(@o1 [(if ucheck ifx-uops ifx-ops)]) @prec o1.prec) . @rest)
(unless (or rest (eq o1.arity :postfix))
(infix-error oexp "operator ~s needs right operand" o1.sym))
+ (if (eq o1.arity :infix)
+ (iflet ((uo [take-while ifx-uops rest]))
+ (set prec (min prec
+ (pred (find-min-key uo :
+ (opip ifx-uops .prec)))))))
(if (meq o1.arity :infix :postfix)
(whilet ((o2 (first opstack))
(yes (when o2 (caseq o2.assoc
- (:left (>= o2.prec o1.prec))
- (:right (> o2.prec o1.prec))))))
+ (:left (>= o2.prec prec))
+ (:right (> o2.prec prec))))))
(pop opstack)
(add-node o2)))
(cond