From 30b30d178a59ba42182d707061b86bb7580ebeb6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Sat, 26 Nov 2016 09:32:22 -0800 Subject: bugfix: quasilit read/print consistency, part 2. In this patch commit I'm addressing the issue introduced in part 1 that expressions in @(output) blocks are still using (sys:expr ...) wrapping, but are passed down to an evaluator which now expects unwrapped expressions now. As part of this change, I'm changing the representation of @expr from (sys:expr . expr) to (sys:expr expr). * eval.c (format_field): Adjust access to sys:expr expression based on new representation. (transform_op): Likewise. * lib.c (obj_print_impl): Likewise. * match.c (dest_bind): Likewise. (do_txeval): Likewise. (do_output_line): Likewise, in some compat code. Here is the fix for the issue: when calling tx_subst_vars, we pass a list of one element containing the expression, not wrapped in sys:expr. Previously, we passed a one-element list containing the sys:expr. * parser.y (o_elem): If a list occurs in the syntax, represent it as (sys:expr list) rather than (sys:expr . list). (list): Do the same for @ n_expr syntax. (expand_meta, make_expr): Harmonize with the representation change. --- eval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 6fe12132..51fcdb4b 100644 --- a/eval.c +++ b/eval.c @@ -2249,7 +2249,7 @@ val format_field(val obj, val modifier, val filter, val eval_fun) } else if ((!opt_compat || opt_compat > 128) && consp(item) && car(item) == expr_s) { - item = cdr(item); + item = cadr(item); goto eval; } else if (consp(item) && car(item) == dwim_s) { val arg_expr = second(item); @@ -3034,8 +3034,8 @@ static val transform_op(val forms, val syms, val rg) val fi = first(forms); val re = rest(forms); - if (fi == expr_s && meta_meta_p(re)) - return cons(syms, rlcp(meta_meta_strip(re), forms)); + if (fi == expr_s && meta_meta_p(car(re))) + return cons(syms, rlcp(meta_meta_strip(car(re)), forms)); /* This handles improper list forms like (a b c . @42) when the recursion hits the @42 part. */ -- cgit v1.2.3