102
|
1 /++
|
|
2 Author: Aziz Köksal
|
|
3 License: GPL2
|
|
4 +/
|
|
5 module Statements;
|
162
|
6 import Expressions;
|
|
7 import Types;
|
169
|
8 import Token;
|
102
|
9
|
|
10 class Statement
|
|
11 {
|
|
12
|
|
13 }
|
161
|
14
|
|
15 class Statements : Statement
|
|
16 {
|
|
17 Statement[] ss;
|
|
18 void opCatAssign(Statement s)
|
|
19 {
|
|
20 this.ss ~= s;
|
|
21 }
|
|
22 }
|
|
23
|
162
|
24 class ScopeStatement : Statement
|
|
25 {
|
|
26 Statement s;
|
|
27 this(Statement s)
|
|
28 {
|
|
29 this.s = s;
|
|
30 }
|
|
31 }
|
|
32
|
161
|
33 class LabeledStatement : Statement
|
|
34 {
|
|
35 string label;
|
|
36 Statement s;
|
|
37 this(string label, Statement s)
|
|
38 {
|
|
39 this.label = label;
|
|
40 this.s = s;
|
|
41 }
|
|
42 }
|
|
43
|
|
44 class ExpressionStatement : Statement
|
|
45 {
|
|
46
|
|
47 }
|
|
48
|
|
49 class DeclarationStatement : Statement
|
|
50 {
|
|
51
|
|
52 }
|
|
53
|
|
54 class IfStatement : Statement
|
|
55 {
|
162
|
56 Type type;
|
|
57 string ident;
|
|
58 Expression condition;
|
|
59 Statement ifBody;
|
|
60 Statement elseBody;
|
|
61 this(Type type, string ident, Expression condition, Statement ifBody, Statement elseBody)
|
|
62 {
|
|
63 this.type = type;
|
|
64 this.ident = ident;
|
|
65 this.condition = condition;
|
|
66 this.ifBody = ifBody;
|
|
67 this.elseBody = elseBody;
|
|
68 }
|
161
|
69 }
|
|
70
|
|
71 class ConditionalStatement : Statement
|
|
72 {
|
|
73
|
|
74 }
|
|
75
|
|
76 class WhileStatement : Statement
|
|
77 {
|
164
|
78 Expression condition;
|
|
79 Statement whileBody;
|
|
80 this(Expression condition, Statement whileBody)
|
|
81 {
|
|
82 this.condition = condition;
|
|
83 this.whileBody = whileBody;
|
|
84 }
|
161
|
85 }
|
|
86
|
165
|
87 class DoWhileStatement : Statement
|
161
|
88 {
|
165
|
89 Expression condition;
|
|
90 Statement doBody;
|
|
91 this(Expression condition, Statement doBody)
|
|
92 {
|
|
93 this.condition = condition;
|
|
94 this.doBody = doBody;
|
|
95 }
|
161
|
96 }
|
|
97
|
|
98 class ForStatement : Statement
|
|
99 {
|
166
|
100 Statement init;
|
|
101 Expression condition, increment;
|
|
102 Statement forBody;
|
169
|
103
|
166
|
104 this(Statement init, Expression condition, Expression increment, Statement forBody)
|
|
105 {
|
|
106 this.init = init;
|
|
107 this.condition = condition;
|
|
108 this.increment = increment;
|
|
109 this.forBody = forBody;
|
|
110 }
|
161
|
111 }
|
|
112
|
|
113 class ForeachStatement : Statement
|
|
114 {
|
169
|
115 TOK tok;
|
|
116 Parameters params;
|
|
117 Expression aggregate;
|
|
118 Statement forBody;
|
161
|
119
|
169
|
120 this(TOK tok, Parameters params, Expression aggregate, Statement forBody)
|
|
121 {
|
|
122 this.tok = tok;
|
|
123 this.params = params;
|
|
124 this.aggregate = aggregate;
|
|
125 this.forBody = forBody;
|
|
126 }
|
161
|
127 }
|
|
128
|
|
129 class SwitchStatement : Statement
|
|
130 {
|
170
|
131 Expression condition;
|
|
132 Statement switchBody;
|
161
|
133
|
170
|
134 this(Expression condition, Statement switchBody)
|
|
135 {
|
|
136 this.condition = condition;
|
|
137 this.switchBody = switchBody;
|
|
138 }
|
161
|
139 }
|
|
140
|
|
141 class CaseStatement : Statement
|
|
142 {
|
171
|
143 Expression[] values;
|
|
144 Statement caseBody;
|
161
|
145
|
171
|
146 this(Expression[] values, Statement caseBody)
|
|
147 {
|
|
148 this.values = values;
|
|
149 this.caseBody = caseBody;
|
|
150 }
|
161
|
151 }
|
|
152
|
|
153 class DefaultStatement : Statement
|
|
154 {
|
172
|
155 Statement defaultBody;
|
|
156 this(Statement defaultBody)
|
|
157 {
|
|
158 this.defaultBody = defaultBody;
|
|
159 }
|
161
|
160 }
|
|
161
|
|
162 class ContinueStatement : Statement
|
|
163 {
|
173
|
164 string ident;
|
|
165 this(string ident)
|
|
166 {
|
|
167 this.ident = ident;
|
|
168 }
|
161
|
169 }
|
|
170
|
|
171 class BreakStatement : Statement
|
|
172 {
|
174
|
173 string ident;
|
|
174 this(string ident)
|
|
175 {
|
|
176 this.ident = ident;
|
|
177 }
|
161
|
178 }
|
|
179
|
|
180 class ReturnStatement : Statement
|
|
181 {
|
175
|
182 Expression expr;
|
|
183 this(Expression expr)
|
|
184 {
|
|
185 this.expr = expr;
|
|
186 }
|
161
|
187 }
|
|
188
|
|
189 class GotoStatement : Statement
|
|
190 {
|
176
|
191 string ident;
|
|
192 Expression caseExpr;
|
|
193 this(string ident, Expression caseExpr)
|
|
194 {
|
|
195 this.ident = ident;
|
|
196 this.caseExpr = caseExpr;
|
|
197 }
|
161
|
198 }
|
|
199
|
|
200 class WithStatement : Statement
|
|
201 {
|
177
|
202 Expression expr;
|
|
203 Statement withBody;
|
|
204 this(Expression expr, Statement withBody)
|
|
205 {
|
|
206 this.expr = expr;
|
|
207 this.withBody = withBody;
|
|
208 }
|
161
|
209 }
|
|
210
|
|
211 class SynchronizedStatement : Statement
|
|
212 {
|
178
|
213 Expression expr;
|
|
214 Statement syncBody;
|
|
215 this(Expression expr, Statement withBody)
|
|
216 {
|
|
217 this.expr = expr;
|
|
218 this.syncBody = syncBody;
|
|
219 }
|
161
|
220 }
|
|
221
|
|
222 class TryStatement : Statement
|
|
223 {
|
179
|
224 Statement tryBody;
|
|
225 CatchBody[] catchBodies;
|
|
226 FinallyBody finallyBody;
|
|
227 this(Statement tryBody, CatchBody[] catchBodies, FinallyBody finallyBody)
|
|
228 {
|
|
229 this.tryBody = tryBody;
|
|
230 this.catchBodies = catchBodies;
|
|
231 this.finallyBody = finallyBody;
|
|
232 }
|
|
233 }
|
161
|
234
|
179
|
235 class CatchBody : Statement
|
|
236 {
|
|
237 Parameter param;
|
|
238 Statement catchBody;
|
|
239 this(Parameter param, Statement catchBody)
|
|
240 {
|
|
241 this.param = param;
|
|
242 this.catchBody = catchBody;
|
|
243 }
|
|
244 }
|
|
245
|
|
246 class FinallyBody : Statement
|
|
247 {
|
|
248 Statement finallyBody;
|
|
249 this(Statement finallyBody)
|
|
250 {
|
|
251 this.finallyBody = finallyBody;
|
|
252 }
|
161
|
253 }
|
|
254
|
|
255 class ScopeGuardStatement : Statement
|
|
256 {
|
181
|
257 string condition;
|
|
258 Statement scopeBody;
|
|
259 this(string condition, Statement scopeBody)
|
|
260 {
|
|
261 this.condition = condition;
|
|
262 this.scopeBody = scopeBody;
|
|
263 }
|
161
|
264 }
|
|
265
|
|
266 class ThrowStatement : Statement
|
|
267 {
|
180
|
268 Expression expr;
|
|
269 this(Expression expr)
|
|
270 {
|
|
271 this.expr = expr;
|
|
272 }
|
161
|
273 }
|
|
274
|
|
275 class VolatileStatement : Statement
|
|
276 {
|
182
|
277 Statement volatileBody;
|
|
278 this(Statement volatileBody)
|
|
279 {
|
|
280 this.volatileBody = volatileBody;
|
|
281 }
|
161
|
282 }
|
|
283
|
|
284 class AsmStatement : Statement
|
|
285 {
|
|
286
|
|
287 }
|
|
288
|
|
289 class PragmaStatement : Statement
|
|
290 {
|
184
|
291 string ident;
|
|
292 Expression[] args;
|
|
293 Statement pragmaBody;
|
|
294 this(string ident, Expression[] args, Statement pragmaBody)
|
|
295 {
|
|
296 this.ident = ident;
|
|
297 this.args = args;
|
|
298 this.pragmaBody = pragmaBody;
|
|
299 }
|
161
|
300 }
|
|
301
|
|
302 class MixinStatement : Statement
|
|
303 {
|
|
304
|
|
305 }
|