Mercurial > projects > dil
annotate trunk/src/Statements.d @ 190:d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
author | aziz |
---|---|
date | Sat, 14 Jul 2007 19:47:01 +0000 |
parents | 5c6ebf9f60a9 |
children | 5c898f80b436 |
rev | line source |
---|---|
102 | 1 /++ |
2 Author: Aziz Köksal | |
3 License: GPL2 | |
4 +/ | |
5 module Statements; | |
162 | 6 import Expressions; |
185 | 7 import Declarations; |
162 | 8 import Types; |
169 | 9 import Token; |
102 | 10 |
11 class Statement | |
12 { | |
13 | |
14 } | |
161 | 15 |
16 class Statements : Statement | |
17 { | |
18 Statement[] ss; | |
19 void opCatAssign(Statement s) | |
20 { | |
21 this.ss ~= s; | |
22 } | |
23 } | |
24 | |
162 | 25 class ScopeStatement : Statement |
26 { | |
27 Statement s; | |
28 this(Statement s) | |
29 { | |
30 this.s = s; | |
31 } | |
32 } | |
33 | |
161 | 34 class LabeledStatement : Statement |
35 { | |
36 string label; | |
37 Statement s; | |
38 this(string label, Statement s) | |
39 { | |
40 this.label = label; | |
41 this.s = s; | |
42 } | |
43 } | |
44 | |
45 class ExpressionStatement : Statement | |
46 { | |
187 | 47 Expression expression; |
48 this(Expression expression) | |
49 { | |
50 this.expression = expression; | |
51 } | |
161 | 52 } |
53 | |
54 class DeclarationStatement : Statement | |
55 { | |
188 | 56 Declaration declaration; |
57 this(Declaration declaration) | |
58 { | |
59 this.declaration = declaration; | |
60 } | |
161 | 61 } |
62 | |
63 class IfStatement : Statement | |
64 { | |
162 | 65 Type type; |
66 string ident; | |
67 Expression condition; | |
68 Statement ifBody; | |
69 Statement elseBody; | |
70 this(Type type, string ident, Expression condition, Statement ifBody, Statement elseBody) | |
71 { | |
72 this.type = type; | |
73 this.ident = ident; | |
74 this.condition = condition; | |
75 this.ifBody = ifBody; | |
76 this.elseBody = elseBody; | |
77 } | |
161 | 78 } |
79 | |
80 class ConditionalStatement : Statement | |
81 { | |
82 | |
83 } | |
84 | |
85 class WhileStatement : Statement | |
86 { | |
164 | 87 Expression condition; |
88 Statement whileBody; | |
89 this(Expression condition, Statement whileBody) | |
90 { | |
91 this.condition = condition; | |
92 this.whileBody = whileBody; | |
93 } | |
161 | 94 } |
95 | |
165 | 96 class DoWhileStatement : Statement |
161 | 97 { |
165 | 98 Expression condition; |
99 Statement doBody; | |
100 this(Expression condition, Statement doBody) | |
101 { | |
102 this.condition = condition; | |
103 this.doBody = doBody; | |
104 } | |
161 | 105 } |
106 | |
107 class ForStatement : Statement | |
108 { | |
166 | 109 Statement init; |
110 Expression condition, increment; | |
111 Statement forBody; | |
169 | 112 |
166 | 113 this(Statement init, Expression condition, Expression increment, Statement forBody) |
114 { | |
115 this.init = init; | |
116 this.condition = condition; | |
117 this.increment = increment; | |
118 this.forBody = forBody; | |
119 } | |
161 | 120 } |
121 | |
122 class ForeachStatement : Statement | |
123 { | |
169 | 124 TOK tok; |
125 Parameters params; | |
126 Expression aggregate; | |
127 Statement forBody; | |
161 | 128 |
169 | 129 this(TOK tok, Parameters params, Expression aggregate, Statement forBody) |
130 { | |
131 this.tok = tok; | |
132 this.params = params; | |
133 this.aggregate = aggregate; | |
134 this.forBody = forBody; | |
135 } | |
161 | 136 } |
137 | |
138 class SwitchStatement : Statement | |
139 { | |
170 | 140 Expression condition; |
141 Statement switchBody; | |
161 | 142 |
170 | 143 this(Expression condition, Statement switchBody) |
144 { | |
145 this.condition = condition; | |
146 this.switchBody = switchBody; | |
147 } | |
161 | 148 } |
149 | |
150 class CaseStatement : Statement | |
151 { | |
171 | 152 Expression[] values; |
153 Statement caseBody; | |
161 | 154 |
171 | 155 this(Expression[] values, Statement caseBody) |
156 { | |
157 this.values = values; | |
158 this.caseBody = caseBody; | |
159 } | |
161 | 160 } |
161 | |
162 class DefaultStatement : Statement | |
163 { | |
172 | 164 Statement defaultBody; |
165 this(Statement defaultBody) | |
166 { | |
167 this.defaultBody = defaultBody; | |
168 } | |
161 | 169 } |
170 | |
171 class ContinueStatement : Statement | |
172 { | |
173 | 173 string ident; |
174 this(string ident) | |
175 { | |
176 this.ident = ident; | |
177 } | |
161 | 178 } |
179 | |
180 class BreakStatement : Statement | |
181 { | |
174 | 182 string ident; |
183 this(string ident) | |
184 { | |
185 this.ident = ident; | |
186 } | |
161 | 187 } |
188 | |
189 class ReturnStatement : Statement | |
190 { | |
175 | 191 Expression expr; |
192 this(Expression expr) | |
193 { | |
194 this.expr = expr; | |
195 } | |
161 | 196 } |
197 | |
198 class GotoStatement : Statement | |
199 { | |
176 | 200 string ident; |
201 Expression caseExpr; | |
202 this(string ident, Expression caseExpr) | |
203 { | |
204 this.ident = ident; | |
205 this.caseExpr = caseExpr; | |
206 } | |
161 | 207 } |
208 | |
209 class WithStatement : Statement | |
210 { | |
177 | 211 Expression expr; |
212 Statement withBody; | |
213 this(Expression expr, Statement withBody) | |
214 { | |
215 this.expr = expr; | |
216 this.withBody = withBody; | |
217 } | |
161 | 218 } |
219 | |
220 class SynchronizedStatement : Statement | |
221 { | |
178 | 222 Expression expr; |
223 Statement syncBody; | |
224 this(Expression expr, Statement withBody) | |
225 { | |
226 this.expr = expr; | |
227 this.syncBody = syncBody; | |
228 } | |
161 | 229 } |
230 | |
231 class TryStatement : Statement | |
232 { | |
179 | 233 Statement tryBody; |
234 CatchBody[] catchBodies; | |
235 FinallyBody finallyBody; | |
236 this(Statement tryBody, CatchBody[] catchBodies, FinallyBody finallyBody) | |
237 { | |
238 this.tryBody = tryBody; | |
239 this.catchBodies = catchBodies; | |
240 this.finallyBody = finallyBody; | |
241 } | |
242 } | |
161 | 243 |
179 | 244 class CatchBody : Statement |
245 { | |
246 Parameter param; | |
247 Statement catchBody; | |
248 this(Parameter param, Statement catchBody) | |
249 { | |
250 this.param = param; | |
251 this.catchBody = catchBody; | |
252 } | |
253 } | |
254 | |
255 class FinallyBody : Statement | |
256 { | |
257 Statement finallyBody; | |
258 this(Statement finallyBody) | |
259 { | |
260 this.finallyBody = finallyBody; | |
261 } | |
161 | 262 } |
263 | |
264 class ScopeGuardStatement : Statement | |
265 { | |
181 | 266 string condition; |
267 Statement scopeBody; | |
268 this(string condition, Statement scopeBody) | |
269 { | |
270 this.condition = condition; | |
271 this.scopeBody = scopeBody; | |
272 } | |
161 | 273 } |
274 | |
275 class ThrowStatement : Statement | |
276 { | |
180 | 277 Expression expr; |
278 this(Expression expr) | |
279 { | |
280 this.expr = expr; | |
281 } | |
161 | 282 } |
283 | |
284 class VolatileStatement : Statement | |
285 { | |
182 | 286 Statement volatileBody; |
287 this(Statement volatileBody) | |
288 { | |
289 this.volatileBody = volatileBody; | |
290 } | |
161 | 291 } |
292 | |
293 class AsmStatement : Statement | |
294 { | |
295 | |
296 } | |
297 | |
298 class PragmaStatement : Statement | |
299 { | |
184 | 300 string ident; |
301 Expression[] args; | |
302 Statement pragmaBody; | |
303 this(string ident, Expression[] args, Statement pragmaBody) | |
304 { | |
305 this.ident = ident; | |
306 this.args = args; | |
307 this.pragmaBody = pragmaBody; | |
308 } | |
161 | 309 } |
310 | |
311 class MixinStatement : Statement | |
312 { | |
185 | 313 Declaration decl; |
314 this(Declaration decl) | |
315 { | |
316 this.decl = decl; | |
317 } | |
161 | 318 } |
186
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
319 |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
320 class StaticIfStatement : Statement |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
321 { |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
322 Expression condition; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
323 Statement ifBody, elseBody; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
324 this(Expression condition, Statement ifBody, Statement elseBody) |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
325 { |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
326 this.condition = condition; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
327 this.ifBody = ifBody; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
328 this.elseBody = elseBody; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
329 } |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
330 } |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
331 |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
332 class StaticAssertStatement : Statement |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
333 { |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
334 Expression condition, message; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
335 this(Expression condition, Expression message) |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
336 { |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
337 this.condition = condition; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
338 this.message = message; |
d4292a5a7b8b
- Implemented parseStaticIfStatement() and parseStaticAssertStatement().
aziz
parents:
185
diff
changeset
|
339 } |
187 | 340 } |
190
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
341 |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
342 class DebugStatement : Statement |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
343 { |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
344 int levelCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
345 string identCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
346 Statement debugBody, elseBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
347 this(int levelCond, string identCond, Statement debugBody, Statement elseBody) |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
348 { |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
349 this.levelCond = levelCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
350 this.identCond = identCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
351 this.debugBody = debugBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
352 this.elseBody = elseBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
353 } |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
354 } |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
355 |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
356 class VersionStatement : Statement |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
357 { |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
358 int levelCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
359 string identCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
360 Statement versionBody, elseBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
361 this(int levelCond, string identCond, Statement versionBody, Statement elseBody) |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
362 { |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
363 this.levelCond = levelCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
364 this.identCond = identCond; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
365 this.versionBody = versionBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
366 this.elseBody = elseBody; |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
367 } |
d0712601fa47
- Implemented parseDebugStatement() and parseVersionStatement().
aziz
parents:
188
diff
changeset
|
368 } |