From 9166b184a187eb1834feffef85dcaa0816c1078e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 11 Dec 2023 20:20:53 -0800 Subject: 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. --- parser.c | 8 +++++--- 1 file 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, -- cgit v1.2.3