bb387977b442 — Leonard Ritter 6 months ago
* simplify recognizing infix expressions: a second expression value matching an infix symbol triggers infix parsing. Otherwise the list is not treated as an infix expression. This also allows us to define greedy infix operators.
1 files changed, 10 insertions(+), 11 deletions(-)

M lib/scopes/core.sc
M lib/scopes/core.sc +10 -11
@@ 3072,18 3072,17 @@ fn get-ifx-op (env op)
     '@ env `[(get-ifx-symbol (as op Symbol))]
 
 fn has-infix-ops? (infix-table expr)
-    # any expression of which one odd argument matches an infix operator
+    # any expression of which the second argument matches an infix operator
         has infix operations.
-    loop (expr = expr)
-        if (< (countof expr) 3)
-            return false
-        let __ expr = ('decons expr)
-        let at next = ('decons expr)
-        try
-            get-ifx-op infix-table at
-            return true
-        except (err)
-            repeat expr
+    if (< (countof expr) 3)
+        return false
+    let __ expr = ('decons expr)
+    let at next = ('decons expr)
+    try
+        get-ifx-op infix-table at
+        return true
+    except (err)
+        return false
 
 fn unpack-infix-op (op)
     let op = (as op list)