From f2a2306a8bd6fb86b4819875f752e3a836f1533d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 10 Aug 2015 06:43:37 -0700 Subject: 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. --- share/txr/stdlib/place.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share') 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 -- cgit v1.2.3