diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-12-05 22:13:08 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-12-05 22:13:08 -0800 |
commit | 33a1d4080da6d0b877a8cd8d57de7f076b662320 (patch) | |
tree | 620b5b02c574c6a4abf4ce4bdafc710d0c3f94fd | |
parent | c4f8c01944f19ec0f28610af4589be242afe7a17 (diff) | |
download | txr-33a1d4080da6d0b877a8cd8d57de7f076b662320.tar.gz txr-33a1d4080da6d0b877a8cd8d57de7f076b662320.tar.bz2 txr-33a1d4080da6d0b877a8cd8d57de7f076b662320.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).
-rw-r--r-- | lib.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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)) { |