From 2b896e09bdf71fb94e40a105b681c26938daa961 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 8 Dec 2023 21:14:51 -0800 Subject: print: print/read consistency problem with rcons. * lib.c (obj_print_impl): Do not print (rcons X Y) as X..Y if X looks like (rcons ...). This causes the problem that (rcons (rcons 1 2) 3) prints as 1..2..3, a notation which unambiguously means (rcons 1 (rcons 2 3)). * tests/012/syntax.tl: New test cases. --- tests/012/syntax.tl | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/012') 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)") -- cgit v1.2.3