summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-26 08:40:22 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-26 08:40:22 -0800
commitdf9f85b3b720a9ebf7381b2cad7a9680ad0e31bf (patch)
treec7075648f15fda21e1eb313421206c4b8828f381 /lib.c
parent1f959abcf7cc1d18401d440b42761ac0b1babb78 (diff)
downloadtxr-df9f85b3b720a9ebf7381b2cad7a9680ad0e31bf.tar.gz
txr-df9f85b3b720a9ebf7381b2cad7a9680ad0e31bf.tar.bz2
txr-df9f85b3b720a9ebf7381b2cad7a9680ad0e31bf.zip
bugfix: quasilit read/print consistency, part 1.
The bug is that `@@@a` prints as `@@a` which reads as a different object. In this patch we simplify how quasiliterals are represented. Embedded expressions are no longer (sys:expr E), just E. Meta-numbers N and variables V are still (sys:var N). However `@@a` and `@a` remain equivalent. * eval.c (subst_vars): No need to look for expr_s; just evaluate a compound form. The recursive nested case is unnecessary and is removed. (expand_quasi): Do nothandle expr_s; it is not part of the quasi syntax any more. * lib.c (out_quasi_str): Do not look for expr_s in the quasi syntax; just print any expression with a @ the fallback case. * match.c (tx_subst_vars): Analogous changes to those done in subst_vars in eval.c. * parser.y (quasi_meta_helper): Static function removed. This was responsible for the issue due to stripping a level of meta from expressions already having a meta on them. (quasi_item): In the `@` n_expr syntax case, no longer call quasi_meta_helper. The remaining logic is simple enough to put in line. Symbols and integers get wrapped with (sys:var ...); other expressions are integrated into the syntax as-is.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index 641b7337..c510ba73 100644
--- a/lib.c
+++ b/lib.c
@@ -9481,9 +9481,9 @@ static void out_quasi_str(val args, val out, struct strm_ctx *ctx)
}
if (need_brace)
put_char(chr('}'), out);
- } else if (sym == expr_s) {
+ } else {
put_char(chr('@'), out);
- obj_print_impl(rest(elem), out, nil, ctx);
+ obj_print_impl(elem, out, nil, ctx);
}
} else {
obj_print_impl(elem, out, nil, ctx);