diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-11 08:08:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-11 08:08:34 -0700 |
commit | 72ea47cb951a774318ab045cf342882cad3ff55d (patch) | |
tree | 7799a46e594c0ef9a2f29754b9f11fbb7d74f439 /lib.c | |
parent | 54c276a0322a369079ba480aca98b4c0ddf70365 (diff) | |
download | txr-72ea47cb951a774318ab045cf342882cad3ff55d.tar.gz txr-72ea47cb951a774318ab045cf342882cad3ff55d.tar.bz2 txr-72ea47cb951a774318ab045cf342882cad3ff55d.zip |
Print ([...] . @var) and ([...] . @(expr)) notation.
This change fixes objects like (@a @b . @c) being printed
as (@a @b sys:var c). This is piggybacked into the logic
which renders dotted unquotes. In other words, we are already
printing (x . ,y) in that from rather than (x sys:unquote y);
we just recognize sys:var, and sys:expr in the same code.
* lib.c (obj_print_impl): Recognize dotted metavariables and
metaexpressions similarly to dotted unquotes.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -13970,10 +13970,19 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx) val a = car(iter); val unq = nil; - if (a == sys_unquote_s) + if (a == sys_unquote_s) { unq = lit(". ,"); - else if (a == sys_splice_s) + } else if (a == sys_splice_s) { unq = lit(". ,*"); + } else if (a == var_s && consp(cdr(iter))) { + val ad = cadr(iter); + if (symbolp(ad) || integerp(ad)) + unq = lit(". @"); + } else if (a == expr_s && consp(cdr(iter))) { + val ad = cadr(iter); + if (consp(ad)) + unq = lit(". @"); + } if (unq) { val d = cdr(iter); |