summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-05 22:13:08 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-05 22:13:08 -0800
commit3545fe416495c3244e0b9bda69ab0cf733db0fcd (patch)
tree620b5b02c574c6a4abf4ce4bdafc710d0c3f94fd /lib.c
parent2c104e21b13dc50c0ce2e7cb7db6d8fe477c4e1f (diff)
downloadtxr-3545fe416495c3244e0b9bda69ab0cf733db0fcd.tar.gz
txr-3545fe416495c3244e0b9bda69ab0cf733db0fcd.tar.bz2
txr-3545fe416495c3244e0b9bda69ab0cf733db0fcd.zip
bugfix: print unquote/splice in dot position.
* lib.c (obj_print_impl): Properly print objects like ^(... . ,expr) and (... . ,*expr) rather than ^(... sys:unquote expr) or ^(... sys:splice expr).
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index e5dde43f..c443d9b6 100644
--- a/lib.c
+++ b/lib.c
@@ -9651,7 +9651,25 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
for (iter = obj; consp(iter); iter = cdr(iter)) {
val d;
- obj_print_impl(car(iter), out, pretty, ctx);
+ val a = car(iter);
+ val unq = nil;
+
+ if (a == sys_unquote_s)
+ unq = lit(". ,");
+ else if (a == sys_splice_s)
+ unq = lit(". ,*");
+
+ if (unq) {
+ d = cdr(iter);
+ if (consp(d) && !cdr(d)) {
+ put_string(unq, out);
+ obj_print_impl(car(d), out, pretty, ctx);
+ put_char(closepar, out);
+ break;
+ }
+ }
+
+ obj_print_impl(a, out, pretty, ctx);
finish:
d = cdr(iter);
if (nilp(d)) {