summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-12-11 20:20:53 -0800
committerKaz Kylheku <kaz@kylheku.com>2023-12-11 20:20:53 -0800
commit13644263eaad63806454dc6670c901a553fdc204 (patch)
treed7e9a48db93067c0784f7daed861482ce4aad4c5
parent8dbc34dc612fe1501ddb79da19094b6051798d07 (diff)
downloadtxr-13644263eaad63806454dc6670c901a553fdc204.tar.gz
txr-13644263eaad63806454dc6670c901a553fdc204.tar.bz2
txr-13644263eaad63806454dc6670c901a553fdc204.zip
listener: fix several bugs in auto compound expr mode.
* parser.c (repl): The first bug is that we are not correctly checking the special variable: auto_parens holds the binding. Thus TXR was behaving as if they feature is always enabled. The second bug is that forms might not be a list; it could be the colon symbol, so we cannot evaluate cdr(forms). The third bug is that we don't want to create (progn . :) when forms is the : symbol. These two bugs are reproduced by turning on the mode and evaluating (1 2 3 . 4 5 6), a bad form.
-rw-r--r--parser.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index 53b05aa2..b1397576 100644
--- a/parser.c
+++ b/parser.c
@@ -1751,9 +1751,11 @@ val repl(val bindings, val in_stream, val out_stream, val env)
counter = prev_counter;
} else {
val expr = if2(form != read_k,
- if3(auto_parens && cdr(forms),
- forms,
- cons(progn_s, forms)));
+ if3(consp(forms),
+ if3(cdr(auto_parens) && cdr(forms),
+ forms,
+ cons(progn_s, forms)),
+ forms));
val value = if3(form != read_k,
eval_intrinsic(expr, nil, env),
read_eval_ret_last(nil, prev_counter,