diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-26 09:32:22 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-26 09:32:22 -0800 |
commit | 30b30d178a59ba42182d707061b86bb7580ebeb6 (patch) | |
tree | accf184b6870c814b60c13ba4e90620a1f30bb9b /parser.y | |
parent | df9f85b3b720a9ebf7381b2cad7a9680ad0e31bf (diff) | |
download | txr-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 'parser.y')
-rw-r--r-- | parser.y | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -732,8 +732,8 @@ o_elem : TEXT { $$ = string_own($1); | SPACE { $$ = string_own($1); rl($$, num(parser->lineno)); } | o_var { $$ = $1; } - | list { $$ = rlcp(cons(expr_s, - expand($1, nil)), $1); } + | list { $$ = rlcp(list(expr_s, + expand($1, nil), nao), $1); } | rep_elem { $$ = $1; } ; @@ -874,7 +874,7 @@ list : '(' n_exprs ')' { $$ = rl($2, num($1)); } | '[' n_exprs ']' { $$ = rl(cons(dwim_s, $2), num($1)); } | '[' ']' { $$ = rl(cons(dwim_s, nil), num($1)); } | '@' n_expr { if (consp($2)) - $$ = rl(cons(expr_s, $2), num($1)); + $$ = rl(cons(expr_s, cons($2, nil)), num($1)); else $$ = rl(cons(var_s, cons($2, nil)), num($1)); } @@ -1520,9 +1520,9 @@ static val expand_meta(val form, val menv) } if ((sym = car(form)) == expr_s) { - val exp_x = expand(rest(form), menv); + val exp_x = expand(second(form), menv); if (!bindable(exp_x)) - return rlcp(cons(sym, exp_x), form); + return rlcp(cons(sym, cons(exp_x, nil)), form); return rlcp(cons(var_s, cons(exp_x, nil)), form); } @@ -1620,7 +1620,7 @@ static wchar_t char_from_name(const wchar_t *name) static val make_expr(parser_t *parser, val sym, val rest, val lineno) { val expr = cons(sym, rest); - val ret = cons(expr_s, expand(expr, nil)); + val ret = cons(expr_s, cons(expand(expr, nil), nil)); if (rest) { rlcp(expr, rest); |