From 183a3b78908a864d6828a57d059dc4f176ef8a04 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 29 Apr 2025 19:39:54 -0700 Subject: infix: bug: (a = b) not parsing. * stdlib.tl (detect-infix): Do not detect a prefix operator followed by argument, followed by anything whatsoever as being infix. The pair must be followed by nothing, or by a non-argument. * txr.1: Documented. --- stdlib/infix.tl | 3 ++- txr.1 | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/stdlib/infix.tl b/stdlib/infix.tl index 5d92f9ce..cd6b265f 100644 --- a/stdlib/infix.tl +++ b/stdlib/infix.tl @@ -243,13 +243,14 @@ (xa (and (not xu) (not (funp env x))))) (or (and xa (or yo yb)) - (and xu ya (neq xu.sym xu.lispsym)) + (and xu ya (neq xu.sym xu.lispsym) (null rest)) (and xu (eq y '**) (eq xu.sym xu.lispsym)) (if-match (@z . @nil) rest (let* ((zu [ifx-uops z]) (zo [ifx-ops z]) (za (and (not zu) (not zo) (not (funp env z))))) (or + (and xu ya (neq xu.sym xu.lispsym) (not za)) (and xu yu (or zu za (eq z '**))) (and xu ya zo)))))))) diff --git a/txr.1 b/txr.1 index 1060f558..5f024a89 100644 --- a/txr.1 +++ b/txr.1 @@ -54217,13 +54217,19 @@ denotes a prefix (unary) operator; the letter denotes an infix operator and the letter .code A denotes an argument which is not the name of a global function, lexical -function in the current macro environment, or operator. -Additionally, the symbols +function in the current macro environment, or an operator; +and the letter .code f -and -.codn !f , -indicate a prefix operator which, respectively, is and is not, -the name of a global or lexical function. +indicates a prefix operator which is also the name of a +a global or lexical function. +In addition, the two-character sequence +.code !A +denotes any element which is not an argument as defined for +.codn A ; +and the sequence +.code !f +denotes a prefix operator which is not also the name of a global +or lexical function. The patterns which indicate a form for processing via .code parse-infix are: @@ -54245,8 +54251,10 @@ then the parent expression is indicates as infix, otherwise not. Three consecutive leading prefix operators. .coIP "(u u A ...)" Two consecutive leading prefix operators followed by an argument. -.coIP "(u A o ...)" -A prefix operator followed by an argument, followed by an infix +.coIP "(u A)" +A prefix operator followed by an argument, and nothing else. +.coIP "(u A !A ...)" +A prefix operator followed by an argument, followed by a non-argument. operator. .coIP "(!f A ...)" A prefix operator which is not also the name of a global or lexical function, -- cgit v1.2.3