summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-26 09:32:22 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-26 09:32:22 -0800
commit30b30d178a59ba42182d707061b86bb7580ebeb6 (patch)
treeaccf184b6870c814b60c13ba4e90620a1f30bb9b /eval.c
parentdf9f85b3b720a9ebf7381b2cad7a9680ad0e31bf (diff)
downloadtxr-30b30d178a59ba42182d707061b86bb7580ebeb6.tar.gz
txr-30b30d178a59ba42182d707061b86bb7580ebeb6.tar.bz2
txr-30b30d178a59ba42182d707061b86bb7580ebeb6.zip
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.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 3 insertions, 3 deletions
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. */