summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-10 06:43:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-10 06:43:37 -0700
commitf2a2306a8bd6fb86b4819875f752e3a836f1533d (patch)
tree8fd5b8b11f6d114d13d8414511b134a7251f7991 /share
parentc9f9e9419a485b383da3229ca130fdd820db3f33 (diff)
downloadtxr-f2a2306a8bd6fb86b4819875f752e3a836f1533d.tar.gz
txr-f2a2306a8bd6fb86b4819875f752e3a836f1533d.tar.bz2
txr-f2a2306a8bd6fb86b4819875f752e3a836f1533d.zip
Diagnose bad consing dot syntax like (a . b . c).
* parser.y (r_exprs): Use unique object in the terminating cons to indicate the empty spot where the dotted cdr item will go. Check for misplaced consing dot. (misplaced_consing_dot_check): New static function. Checks for the terminator atom spot being taken already. Thus, the spot may be taken only by the very last reduction, such that the next reduction is r_exprs -> n_exprs where the terminating atom is processed. * parser.c (unique_s): New global variable. (parse_init): Initialize unique_s. * parser.h (unique_s): Declared. * share/txr/stdlib/place.tl (sys:placelet-1): We have a misplaced consing dot here! It was working correctly by "terminating atom propagation" behavior, which allowed (a . b c d) to produce (a c d . b). If a single terminating atom occurred in the middle of a list, it was promoted to the end.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/place.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl
index 398ecbe3..270baace 100644
--- a/share/txr/stdlib/place.tl
+++ b/share/txr/stdlib/place.tl
@@ -600,7 +600,7 @@
(with-update-expander (getter setter) ,place-sym env
^(,setter (,',function (,getter) ,,*cleaned-lambda-list)))))))
-(defmacro sys:placelet-1 (((sym place)) . body :env env)
+(defmacro sys:placelet-1 (((sym place)) :env env . body)
(with-gensyms (tmp-place pl-getter pl-setter steal-getter)
(unwind-protect
(progn