Mercurial > projects > dil
annotate trunk/src/Expressions.d @ 83:9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
- Added code for parsing Slice- and IndexExpression.
author | aziz |
---|---|
date | Wed, 04 Jul 2007 23:00:01 +0000 |
parents | aa1ea2548dd9 |
children | ac8d961d10d1 |
rev | line source |
---|---|
70 | 1 /++ |
2 Author: Aziz Köksal | |
3 License: GPL2 | |
4 +/ | |
5 module Expressions; | |
71 | 6 import Token; |
70 | 7 |
8 class Expression | |
9 { | |
10 | |
11 } | |
12 | |
13 class BinaryExpression : Expression | |
14 { | |
71 | 15 Expression left, right; |
16 TOK tok; | |
17 this(Expression left, Expression right, TOK tok) | |
18 { | |
19 this.left = left; | |
20 this.right = right; | |
21 this.tok = tok; | |
22 } | |
70 | 23 } |
24 | |
72 | 25 class CondExpression : BinaryExpression |
70 | 26 { |
72 | 27 Expression condition; |
28 this(Expression condition, Expression left, Expression right) | |
29 { | |
30 this.condition = condition; | |
31 super(left, right, TOK.Comma); | |
32 } | |
33 } | |
70 | 34 |
72 | 35 class CommaExpression : BinaryExpression |
36 { | |
37 this(Expression left, Expression right) | |
38 { super(left, right, TOK.Comma); } | |
70 | 39 } |
40 | |
41 class OrOrExpression : BinaryExpression | |
42 { | |
71 | 43 this(Expression left, Expression right) |
44 { super(left, right, TOK.OrLogical); } | |
70 | 45 } |
46 | |
47 class AndAndExpression : BinaryExpression | |
48 { | |
71 | 49 this(Expression left, Expression right) |
50 { super(left, right, TOK.AndLogical); } | |
70 | 51 } |
52 | |
53 class OrExpression : BinaryExpression | |
54 { | |
71 | 55 this(Expression left, Expression right) |
56 { super(left, right, TOK.OrBinary); } | |
70 | 57 } |
58 | |
59 class XorExpression : BinaryExpression | |
60 { | |
71 | 61 this(Expression left, Expression right) |
62 { super(left, right, TOK.Xor); } | |
70 | 63 } |
64 | |
65 class AndExpression : BinaryExpression | |
66 { | |
71 | 67 this(Expression left, Expression right) |
68 { super(left, right, TOK.AndBinary); } | |
70 | 69 } |
70 | |
71 class CmpExpression : BinaryExpression | |
72 { | |
71 | 73 this(Expression left, Expression right, TOK tok) |
74 { super(left, right, tok); } | |
70 | 75 } |
76 | |
71 | 77 class EqualExpression : CmpExpression |
70 | 78 { |
71 | 79 this(Expression left, Expression right, TOK tok) |
80 { super(left, right, TOK.Equal); } | |
70 | 81 } |
82 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
83 class IdentityExpression : CmpExpression |
70 | 84 { |
71 | 85 this(Expression left, Expression right, TOK tok) |
86 { super(left, right, tok); } | |
70 | 87 } |
88 | |
71 | 89 class RelExpression : CmpExpression |
70 | 90 { |
71 | 91 this(Expression left, Expression right, TOK tok) |
92 { super(left, right, tok); } | |
70 | 93 } |
94 | |
95 class InExpression : BinaryExpression | |
96 { | |
71 | 97 this(Expression left, Expression right, TOK tok) |
98 { super(left, right, TOK.In); } | |
70 | 99 } |
100 | |
75 | 101 class LShiftExpression : BinaryExpression |
102 { | |
103 this(Expression left, Expression right) | |
104 { super(left, right, TOK.LShiftAssign); } | |
105 } | |
106 | |
107 class RShiftExpression : BinaryExpression | |
108 { | |
109 this(Expression left, Expression right) | |
110 { super(left, right, TOK.RShiftAssign); } | |
111 } | |
112 | |
113 class URShiftExpression : BinaryExpression | |
114 { | |
115 this(Expression left, Expression right) | |
116 { super(left, right, TOK.URShiftAssign); } | |
117 } | |
118 | |
76 | 119 class PlusExpression : BinaryExpression |
70 | 120 { |
76 | 121 this(Expression left, Expression right) |
122 { super(left, right, TOK.Plus); } | |
123 } | |
124 | |
125 class MinusExpression : BinaryExpression | |
126 { | |
127 this(Expression left, Expression right) | |
128 { super(left, right, TOK.Minus); } | |
70 | 129 } |
130 | |
131 class MulExpression : BinaryExpression | |
132 { | |
77 | 133 this(Expression left, Expression right) |
134 { super(left, right, TOK.Mul); } | |
135 } | |
136 | |
137 class DivExpression : BinaryExpression | |
138 { | |
139 this(Expression left, Expression right) | |
140 { super(left, right, TOK.Div); } | |
141 } | |
142 | |
143 class ModExpression : BinaryExpression | |
144 { | |
145 this(Expression left, Expression right) | |
146 { super(left, right, TOK.Mod); } | |
70 | 147 } |
148 | |
149 class CatExpression : BinaryExpression | |
150 { | |
76 | 151 this(Expression left, Expression right) |
71 | 152 { super(left, right, TOK.Catenate); } |
153 } | |
70 | 154 |
71 | 155 class AssignExpression : BinaryExpression |
156 { | |
157 this(Expression left, Expression right) | |
158 { super(left, right, TOK.Assign); } | |
159 } | |
160 class LShiftAssignExpression : BinaryExpression | |
161 { | |
162 this(Expression left, Expression right) | |
163 { super(left, right, TOK.LShiftAssign); } | |
164 } | |
165 class RShiftAssignExpression : BinaryExpression | |
166 { | |
167 this(Expression left, Expression right) | |
168 { super(left, right, TOK.RShiftAssign); } | |
169 } | |
170 class URShiftAssignExpression : BinaryExpression | |
171 { | |
172 this(Expression left, Expression right) | |
173 { super(left, right, TOK.URShiftAssign); } | |
174 } | |
175 class OrAssignExpression : BinaryExpression | |
176 { | |
177 this(Expression left, Expression right) | |
178 { super(left, right, TOK.OrAssign); } | |
179 } | |
180 class AndAssignExpression : BinaryExpression | |
181 { | |
182 this(Expression left, Expression right) | |
183 { super(left, right, TOK.AndAssign); } | |
184 } | |
185 class PlusAssignExpression : BinaryExpression | |
186 { | |
187 this(Expression left, Expression right) | |
188 { super(left, right, TOK.PlusAssign); } | |
189 } | |
190 class MinusAssignExpression : BinaryExpression | |
191 { | |
192 this(Expression left, Expression right) | |
193 { super(left, right, TOK.MinusAssign); } | |
194 } | |
195 class DivAssignExpression : BinaryExpression | |
196 { | |
197 this(Expression left, Expression right) | |
198 { super(left, right, TOK.DivAssign); } | |
199 } | |
200 class MulAssignExpression : BinaryExpression | |
201 { | |
202 this(Expression left, Expression right) | |
203 { super(left, right, TOK.MulAssign); } | |
204 } | |
205 class ModAssignExpression : BinaryExpression | |
206 { | |
207 this(Expression left, Expression right) | |
208 { super(left, right, TOK.ModAssign); } | |
209 } | |
210 class XorAssignExpression : BinaryExpression | |
211 { | |
212 this(Expression left, Expression right) | |
213 { super(left, right, TOK.XorAssign); } | |
214 } | |
215 class CatAssignExpression : BinaryExpression | |
216 { | |
217 this(Expression left, Expression right) | |
218 { super(left, right, TOK.CatAssign); } | |
70 | 219 } |
220 | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
221 class UnaryExpression : Expression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
222 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
223 Expression e; |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
224 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
225 { this.e = e; } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
226 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
227 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
228 class AddressExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
229 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
230 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
231 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
232 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
233 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
234 class PreIncrExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
235 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
236 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
237 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
238 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
239 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
240 class PreDecrExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
241 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
242 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
243 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
244 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
245 |
79
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
246 class PostIncrExpression : UnaryExpression |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
247 { |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
248 this(Expression e) |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
249 { super(e); } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
250 } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
251 |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
252 class PostDecrExpression : UnaryExpression |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
253 { |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
254 this(Expression e) |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
255 { super(e); } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
256 } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
257 |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
258 class DerefExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
259 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
260 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
261 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
262 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
263 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
264 class SignExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
265 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
266 TOK sign; |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
267 this(Expression e, TOK sign) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
268 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
269 super(e); |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
270 this.sign = sign; |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
271 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
272 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
273 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
274 class NotExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
275 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
276 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
277 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
278 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
279 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
280 class CompExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
281 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
282 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
283 { super(e); } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
284 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
285 |
81 | 286 class DotExpression : UnaryExpression |
70 | 287 { |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
288 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
289 { super(e); } |
70 | 290 } |
291 | |
81 | 292 class DotIdExpression : UnaryExpression |
70 | 293 { |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
294 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
295 { super(e); } |
70 | 296 } |
297 | |
81 | 298 class CallExpression : UnaryExpression |
299 { | |
300 Expression[] args; | |
301 this(Expression e, Expression[] args) | |
302 { | |
303 super(e); | |
304 this.args = args; | |
305 } | |
306 } | |
307 | |
70 | 308 class NewExpression : UnaryExpression |
309 { | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
310 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
311 { super(e); } |
70 | 312 } |
313 | |
314 class DeleteExpression : UnaryExpression | |
315 { | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
316 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
317 { super(e); } |
70 | 318 } |
319 | |
320 class CastExpression : UnaryExpression | |
321 { | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
322 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
323 { super(e); } |
70 | 324 } |
325 | |
326 class AnonClassExpression : UnaryExpression | |
327 { | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
328 this(Expression e) |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
329 { super(e); } |
70 | 330 } |
331 | |
332 class PrimaryExpression | |
333 { | |
334 | |
335 } | |
336 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
337 class IndexExpression : UnaryExpression |
70 | 338 { |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
339 Expression[] args; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
340 this(Expression e, Expression[] args) |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
341 { |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
342 super(e); |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
343 this.args = args; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
344 } |
70 | 345 } |
346 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
347 class SliceExpression : UnaryExpression |
70 | 348 { |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
349 Expression left, right; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
350 this(Expression e, Expression left, Expression right) |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
351 { |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
352 super(e); |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
353 this.left = left; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
354 this.right = right; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
355 } |
70 | 356 } |
357 | |
358 class AssertExpression | |
359 { | |
360 | |
361 } | |
362 | |
363 class MixinExpression | |
364 { | |
365 | |
366 } | |
367 | |
368 class ImportExpression | |
369 { | |
370 | |
371 } | |
372 | |
373 class TypeIdExpression | |
374 { | |
375 | |
376 } | |
377 | |
74 | 378 class IsExpression : CmpExpression |
70 | 379 { |
74 | 380 this(Expression left, Expression right, TOK tok) |
381 { super(left, right, tok); } | |
70 | 382 } |