summaryrefslogtreecommitdiffstats
path: root/parser.h
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 /parser.h
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 'parser.h')
-rw-r--r--parser.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/parser.h b/parser.h
index fdd45e44..9b336d70 100644
--- a/parser.h
+++ b/parser.h
@@ -46,6 +46,7 @@ typedef struct {
extern const wchar_t *spec_file;
extern val form_to_ln_hash;
extern val parser_s;
+extern val unique_s;
void yyerror(scanner_t *scanner, parser_t *, const char *s);
void yyerr(scanner_t *scanner, const char *s);
void yyerrorf(scanner_t *scanner, val s, ...);