diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-12-11 20:20:53 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-12-11 20:20:53 -0800 |
commit | 13644263eaad63806454dc6670c901a553fdc204 (patch) | |
tree | d7e9a48db93067c0784f7daed861482ce4aad4c5 | |
parent | 8dbc34dc612fe1501ddb79da19094b6051798d07 (diff) | |
download | txr-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.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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, |