summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.c3
-rw-r--r--tests/012/syntax.tl9
2 files changed, 11 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 0dc756ba..0e374c70 100644
--- a/lib.c
+++ b/lib.c
@@ -14859,7 +14859,8 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
goto list;
}
} else if (sym == rcons_s && have_args
- && consp(cdr(args)) && !(cddr(args)))
+ && consp(cdr(args)) && !(cddr(args)) &&
+ (!consp(arg) || car(arg) != rcons_s))
{
obj_print_impl(arg, out, pretty, ctx);
put_string(lit(".."), out);
diff --git a/tests/012/syntax.tl b/tests/012/syntax.tl
index d2fab599..bc7d9668 100644
--- a/tests/012/syntax.tl
+++ b/tests/012/syntax.tl
@@ -63,3 +63,12 @@
'(1.234,e+12) (1.234 (sys:unquote e+12))
'(1.,234) (1.0 (sys:unquote 234)))
+(mtest
+ (read "0..1") (rcons 0 1)
+ (read "0..1..2") (rcons 0 (rcons 1 2)))
+
+(mtest
+ (tostring '(rcons 0 1)) "0..1"
+ (tostring '(rcons 0 (rcons 1 2))) "0..1..2"
+ (tostring '(rcons (rcons 0 1) 2)) "(rcons 0..1 2)"
+ (tostring '(rcons (rcons 0 1) (rcons 2 3))) "(rcons 0..1 2..3)")