blob: d330b8689ad1f5f93186c57dbc70b82365dd4277 [file] [log] [blame]
Marcel van Lohuizenb001da52018-12-10 15:34:30 +01001package expressions
2
3{
4 a: 1
5 aaa: 2
6
7 b: 3
8
9 c b a: 4
10 c bb aaa: 5
11 c b <Name> a: int
12 alias = 3.14
13
14 alias2 = foo
15 aaalias = foo
16 b: bar
17
Marcel van Lohuizen6f0faec2018-12-16 10:42:42 +010018 bottom: _|_
Marcel van Lohuizenb001da52018-12-10 15:34:30 +010019
20 empty: {}
21 emptyNewLine: {
22
23 }
24 someObject: {
25 a: 8
26 aa: 9
27 aaa: 10
28 }
29
30 e: 1+2*3
31 e: 1*2*3 // error
32 e: 2..3
33 e: 2..(3 + 4)
34 ex: 2..3+4*5
35 e: 2..3..4
36 e: 1 + 2 + 3 // error
37
38 e: s[1+2]
39 e: s[1:2]
40 e: s[1+2:2+4]
41 e: s[2]
42 e: s[2*3]
43 e: s[1+2*3]
44
45 e: f(3+4+5)
46 e: f(3*4*5)
47 e: f(3+4*5)
48
49 e: f(3 + 4 div 5)
50
51 e: 3<4&&5>4
52 e: a || b && c || d
53
54 e: a + +b * 3
55 e: -a - -b
56
57 e: b + c
58 e: b*c + d
59 e: a*b + c
60 e: a - b - c
61 e: a - (b - c)
62 e: a - b*c
63 e: a - (b * c)
64 e: a * b / c
65 e: a div b + 5
66 e: a / b
67 e: x[a|b]
68 e: x[a /b]
69 e: a & b
70 e: a + +b
71 e: a - -b
72 e: a div - b
73 e: x[a*-b]
74 e: x[a + +b]
75 e: len(longVariableName) * 2
76
77 e: "\(a)"
78 e: 'aa \(aaa) aa'
79 e: "aa \(aaa)"
80
81 e: [1, 2]
82 e: [1, 2, 3, 4,
83 5, 6, 7, 8]
84 e: [1, 2, 3, 4,
85 5, 6, 7, 8 // maybe force additional comma
86 ]
87 e: [...]
88 e: [
89 ...]
90 e: [...
91 ]
92 e: [1, 2, ...]
93 e: [1, 2,
94 ...]
95 e: [...int]
96 e: [...int,]
97 e: [...int | float]
98 e: [ x for x in someObject if x > 9 ]
99 e: [ x
100 for x in someObject
101 if x > 9 ]
102 e: [ x
103 for x in someObject
104 if x > 9
105 ]
Marcel van Lohuizen76b92b52018-12-16 10:47:03 +0100106 "\(k)": v for k, v in someObject
Marcel van Lohuizenb001da52018-12-10 15:34:30 +0100107
Marcel van Lohuizen76b92b52018-12-16 10:47:03 +0100108 "\(k)": v <-
Marcel van Lohuizenb001da52018-12-10 15:34:30 +0100109 for k, v in someObject
110
Marcel van Lohuizen76b92b52018-12-16 10:47:03 +0100111 e: { "\(k)":v <-
Marcel van Lohuizenb001da52018-12-10 15:34:30 +0100112 for k, v in someObject
113 if k > "a"
114 }
115
Marcel van Lohuizen76b92b52018-12-16 10:47:03 +0100116 e: { "\(k)":v for k, v in someObject if k > "a"}
117 e: { "\(k)":v <-
Marcel van Lohuizenb001da52018-12-10 15:34:30 +0100118 for k, v in someObject if k > "a"}
119
Marcel van Lohuizen76b92b52018-12-16 10:47:03 +0100120 e: { "\(k)":v <-
Marcel van Lohuizenb001da52018-12-10 15:34:30 +0100121 for k, v in someObject
122 if k > "a"}
123
124 e: [{
125 a: 1, b: 2,
126 }]
127
128 e: [{
129 a: 1, b: 2,
130 },
131 ]
132
133 e: [{
134 a: 1, b: 2,
135 }, {
136 c: 1, d: 2,
137 }]
138
139 e: [{
140 a: 1, b: 2,
141 },
142 3,
143 4,
144 ]
145
146 e: (a, b) -> a + b
147 e: (a,
148 b) -> a + b
149 e: (a, b) -> {
150 a: b
151 }
152 e: (a,
153 b
154 ) ->
155 {
156 a: b
157 }
158
159 e: e.f(1, 2)
160
161 e: ((3 + 4))
162}