summaryrefslogtreecommitdiffstats
path: root/tests/012/syntax.tl
blob: bc7d9668ed3132112ca2bbf8483987d51beb6463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
(load "../common")

"top level literal"

".."

"."

#;(commented out list)
#;3.14
#;abc
#;.foo
#; .foo
#;a.b

'(#;.foo)
'(#; .foo)

(test
  #;(commented out list)
  #;3.14
  #;abc
  #;.foo
  #; .foo
  #;a.b
  42 42)

(mtest
   '(#;abc) nil
   '(#; abc 1) (1)
   '(0 #; abc 1) (0 1)
   '(0 #; abc) (0))

(mtest
   '(#; .abc) nil
   '(#; .abc 1) (1)
   '(0 #; .abc 1) (0 1)
   '(0 #; .abc) (0))

(mtest
  '(-,1) (- (sys:unquote 1))
  1,2 12
  1,,2 12
  1,,,2 12
  1,2,3 1,2,3
  -0,1 -1
  '(1,a) (1 (sys:unquote a)))

(mtest
  (read "#x,ff") :error
  (read "#o,1") :error
  (read "#b,1") :error
  '(#xff,ff,z) (65535 (sys:unquote z))
  '(#xff,ff,a) (1048570))

(mtest
  #xff,ff 65535
  #o7,7,7 511
  #b1101,1110 #xDE)

(mtest
  1,234,567.890,123E13 1234567.890123E13
  '(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)")