author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
** All rights reserved. |
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtScript module of the Qt Toolkit. |
|
8 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:LGPL-ONLY$ |
0 | 10 |
** GNU Lesser General Public License Usage |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
11 |
** This file may be used under the terms of the GNU Lesser |
0 | 12 |
** General Public License version 2.1 as published by the Free Software |
13 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
14 |
** packaging of this file. Please review the following information to |
|
15 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
16 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
17 |
** |
|
18 |
** If you have questions regarding the use of this file, please contact |
|
19 |
** Nokia at qt-info@nokia.com. |
|
20 |
** $QT_END_LICENSE$ |
|
21 |
** |
|
22 |
****************************************************************************/ |
|
23 |
||
24 |
#ifndef QSCRIPTAST_P_H |
|
25 |
#define QSCRIPTAST_P_H |
|
26 |
||
27 |
// |
|
28 |
// W A R N I N G |
|
29 |
// ------------- |
|
30 |
// |
|
31 |
// This file is not part of the Qt API. It exists purely as an |
|
32 |
// implementation detail. This header file may change from version to |
|
33 |
// version without notice, or even be removed. |
|
34 |
// |
|
35 |
// We mean it. |
|
36 |
// |
|
37 |
||
38 |
#include <QtCore/QString> |
|
39 |
||
40 |
#include "qscriptastvisitor_p.h" |
|
41 |
||
42 |
QT_BEGIN_NAMESPACE |
|
43 |
||
44 |
class QScriptNameIdImpl; |
|
45 |
||
46 |
namespace QSOperator // ### rename |
|
47 |
{ |
|
48 |
||
49 |
enum Op { |
|
50 |
Add, |
|
51 |
And, |
|
52 |
InplaceAnd, |
|
53 |
Assign, |
|
54 |
BitAnd, |
|
55 |
BitOr, |
|
56 |
BitXor, |
|
57 |
InplaceSub, |
|
58 |
Div, |
|
59 |
InplaceDiv, |
|
60 |
Equal, |
|
61 |
Ge, |
|
62 |
Gt, |
|
63 |
In, |
|
64 |
InplaceAdd, |
|
65 |
InstanceOf, |
|
66 |
Le, |
|
67 |
LShift, |
|
68 |
InplaceLeftShift, |
|
69 |
Lt, |
|
70 |
Mod, |
|
71 |
InplaceMod, |
|
72 |
Mul, |
|
73 |
InplaceMul, |
|
74 |
NotEqual, |
|
75 |
Or, |
|
76 |
InplaceOr, |
|
77 |
RShift, |
|
78 |
InplaceRightShift, |
|
79 |
StrictEqual, |
|
80 |
StrictNotEqual, |
|
81 |
Sub, |
|
82 |
URShift, |
|
83 |
InplaceURightShift, |
|
84 |
InplaceXor |
|
85 |
}; |
|
86 |
||
87 |
} // namespace QSOperator |
|
88 |
||
89 |
namespace QScript { namespace AST { |
|
90 |
||
91 |
class Node |
|
92 |
{ |
|
93 |
public: |
|
94 |
enum Kind { |
|
95 |
Kind_Node, |
|
96 |
Kind_ExpressionNode, |
|
97 |
Kind_Statement, |
|
98 |
Kind_ThisExpression, |
|
99 |
Kind_IdentifierExpression, |
|
100 |
Kind_NullExpression, |
|
101 |
Kind_TrueLiteral, |
|
102 |
Kind_FalseLiteral, |
|
103 |
Kind_NumericLiteral, |
|
104 |
Kind_StringLiteral, |
|
105 |
Kind_RegExpLiteral, |
|
106 |
Kind_ArrayLiteral, |
|
107 |
Kind_ObjectLiteral, |
|
108 |
Kind_ElementList, |
|
109 |
Kind_Elision, |
|
110 |
Kind_PropertyNameAndValueList, |
|
111 |
Kind_PropertyName, |
|
112 |
Kind_IdentifierPropertyName, |
|
113 |
Kind_StringLiteralPropertyName, |
|
114 |
Kind_NumericLiteralPropertyName, |
|
115 |
Kind_ArrayMemberExpression, |
|
116 |
Kind_FieldMemberExpression, |
|
117 |
Kind_NewMemberExpression, |
|
118 |
Kind_NewExpression, |
|
119 |
Kind_CallExpression, |
|
120 |
Kind_ArgumentList, |
|
121 |
Kind_PostIncrementExpression, |
|
122 |
Kind_PostDecrementExpression, |
|
123 |
Kind_DeleteExpression, |
|
124 |
Kind_VoidExpression, |
|
125 |
Kind_TypeOfExpression, |
|
126 |
Kind_PreIncrementExpression, |
|
127 |
Kind_PreDecrementExpression, |
|
128 |
Kind_UnaryPlusExpression, |
|
129 |
Kind_UnaryMinusExpression, |
|
130 |
Kind_TildeExpression, |
|
131 |
Kind_NotExpression, |
|
132 |
Kind_BinaryExpression, |
|
133 |
Kind_ConditionalExpression, |
|
134 |
Kind_Expression, |
|
135 |
Kind_Block, |
|
136 |
Kind_StatementList, |
|
137 |
Kind_VariableStatement, |
|
138 |
Kind_VariableDeclarationList, |
|
139 |
Kind_VariableDeclaration, |
|
140 |
Kind_EmptyStatement, |
|
141 |
Kind_ExpressionStatement, |
|
142 |
Kind_IfStatement, |
|
143 |
Kind_DoWhileStatement, |
|
144 |
Kind_WhileStatement, |
|
145 |
Kind_ForStatement, |
|
146 |
Kind_LocalForStatement, |
|
147 |
Kind_ForEachStatement, |
|
148 |
Kind_LocalForEachStatement, |
|
149 |
Kind_ContinueStatement, |
|
150 |
Kind_BreakStatement, |
|
151 |
Kind_ReturnStatement, |
|
152 |
Kind_WithStatement, |
|
153 |
Kind_SwitchStatement, |
|
154 |
Kind_CaseBlock, |
|
155 |
Kind_CaseClauses, |
|
156 |
Kind_CaseClause, |
|
157 |
Kind_DefaultClause, |
|
158 |
Kind_LabelledStatement, |
|
159 |
Kind_ThrowStatement, |
|
160 |
Kind_TryStatement, |
|
161 |
Kind_Catch, |
|
162 |
Kind_Finally, |
|
163 |
Kind_FunctionDeclaration, |
|
164 |
Kind_FunctionExpression, |
|
165 |
Kind_FormalParameterList, |
|
166 |
Kind_FunctionBody, |
|
167 |
Kind_Program, |
|
168 |
Kind_SourceElements, |
|
169 |
Kind_SourceElement, |
|
170 |
Kind_FunctionSourceElement, |
|
171 |
Kind_StatementSourceElement, |
|
172 |
Kind_DebuggerStatement |
|
173 |
}; |
|
174 |
||
175 |
inline Node(): |
|
176 |
startLine(0), startColumn(0), |
|
177 |
endLine(0), endColumn(0), kind(Kind_Node) {} |
|
178 |
||
179 |
virtual ~Node() {} |
|
180 |
||
181 |
virtual ExpressionNode *expressionCast(); |
|
182 |
virtual BinaryExpression *binaryExpressionCast(); |
|
183 |
virtual Statement *statementCast(); |
|
184 |
||
185 |
inline void accept(Visitor *visitor) |
|
186 |
{ |
|
187 |
if (visitor->preVisit(this)) { |
|
188 |
accept0(visitor); |
|
189 |
visitor->postVisit(this); |
|
190 |
} |
|
191 |
} |
|
192 |
||
193 |
static void acceptChild(Node *node, Visitor *visitor) |
|
194 |
{ |
|
195 |
if (node) |
|
196 |
node->accept(visitor); |
|
197 |
} |
|
198 |
||
199 |
virtual void accept0(Visitor *visitor) = 0; |
|
200 |
||
201 |
int startLine; |
|
202 |
int startColumn; |
|
203 |
int endLine; |
|
204 |
int endColumn; |
|
205 |
Kind kind; |
|
206 |
}; |
|
207 |
||
208 |
class ExpressionNode: public Node |
|
209 |
{ |
|
210 |
public: |
|
211 |
ExpressionNode() { kind = Kind_ExpressionNode; } |
|
212 |
virtual ~ExpressionNode() {} |
|
213 |
||
214 |
virtual ExpressionNode *expressionCast(); |
|
215 |
}; |
|
216 |
||
217 |
class Statement: public Node |
|
218 |
{ |
|
219 |
public: |
|
220 |
Statement() { kind = Kind_Statement; } |
|
221 |
virtual ~Statement() {} |
|
222 |
||
223 |
virtual Statement *statementCast(); |
|
224 |
}; |
|
225 |
||
226 |
class ThisExpression: public ExpressionNode |
|
227 |
{ |
|
228 |
public: |
|
229 |
ThisExpression() { kind = Kind_ThisExpression; } |
|
230 |
virtual ~ThisExpression() {} |
|
231 |
||
232 |
virtual void accept0(Visitor *visitor); |
|
233 |
}; |
|
234 |
||
235 |
class IdentifierExpression: public ExpressionNode |
|
236 |
{ |
|
237 |
public: |
|
238 |
IdentifierExpression(QScriptNameIdImpl *n): |
|
239 |
name (n) { kind = Kind_IdentifierExpression; } |
|
240 |
||
241 |
virtual ~IdentifierExpression() {} |
|
242 |
||
243 |
virtual void accept0(Visitor *visitor); |
|
244 |
||
245 |
// attributes |
|
246 |
QScriptNameIdImpl *name; |
|
247 |
}; |
|
248 |
||
249 |
class NullExpression: public ExpressionNode |
|
250 |
{ |
|
251 |
public: |
|
252 |
NullExpression() { kind = Kind_NullExpression; } |
|
253 |
virtual ~NullExpression() {} |
|
254 |
||
255 |
virtual void accept0(Visitor *visitor); |
|
256 |
}; |
|
257 |
||
258 |
class TrueLiteral: public ExpressionNode |
|
259 |
{ |
|
260 |
public: |
|
261 |
TrueLiteral() { kind = Kind_TrueLiteral; } |
|
262 |
virtual ~TrueLiteral() {} |
|
263 |
||
264 |
virtual void accept0(Visitor *visitor); |
|
265 |
}; |
|
266 |
||
267 |
class FalseLiteral: public ExpressionNode |
|
268 |
{ |
|
269 |
public: |
|
270 |
FalseLiteral() { kind = Kind_FalseLiteral; } |
|
271 |
virtual ~FalseLiteral() {} |
|
272 |
||
273 |
virtual void accept0(Visitor *visitor); |
|
274 |
}; |
|
275 |
||
276 |
class NumericLiteral: public ExpressionNode |
|
277 |
{ |
|
278 |
public: |
|
279 |
NumericLiteral(double v): |
|
280 |
value (v) { kind = Kind_NumericLiteral; } |
|
281 |
virtual ~NumericLiteral() {} |
|
282 |
||
283 |
virtual void accept0(Visitor *visitor); |
|
284 |
||
285 |
// attributes: |
|
286 |
double value; |
|
287 |
}; |
|
288 |
||
289 |
class StringLiteral: public ExpressionNode |
|
290 |
{ |
|
291 |
public: |
|
292 |
StringLiteral(QScriptNameIdImpl *v): |
|
293 |
value (v) { kind = Kind_StringLiteral; } |
|
294 |
||
295 |
virtual ~StringLiteral() {} |
|
296 |
||
297 |
virtual void accept0(Visitor *visitor); |
|
298 |
||
299 |
// attributes: |
|
300 |
QScriptNameIdImpl *value; |
|
301 |
}; |
|
302 |
||
303 |
class RegExpLiteral: public ExpressionNode |
|
304 |
{ |
|
305 |
public: |
|
306 |
RegExpLiteral(QScriptNameIdImpl *p, int f): |
|
307 |
pattern (p), flags (f) { kind = Kind_RegExpLiteral; } |
|
308 |
||
309 |
virtual ~RegExpLiteral() {} |
|
310 |
||
311 |
virtual void accept0(Visitor *visitor); |
|
312 |
||
313 |
// attributes: |
|
314 |
QScriptNameIdImpl *pattern; |
|
315 |
int flags; |
|
316 |
}; |
|
317 |
||
318 |
class ArrayLiteral: public ExpressionNode |
|
319 |
{ |
|
320 |
public: |
|
321 |
ArrayLiteral(Elision *e): |
|
322 |
elements (0), elision (e) |
|
323 |
{ kind = Kind_ArrayLiteral; } |
|
324 |
||
325 |
ArrayLiteral(ElementList *elts): |
|
326 |
elements (elts), elision (0) |
|
327 |
{ kind = Kind_ArrayLiteral; } |
|
328 |
||
329 |
ArrayLiteral(ElementList *elts, Elision *e): |
|
330 |
elements (elts), elision (e) |
|
331 |
{ kind = Kind_ArrayLiteral; } |
|
332 |
||
333 |
virtual ~ArrayLiteral() {} |
|
334 |
||
335 |
virtual void accept0(Visitor *visitor); |
|
336 |
||
337 |
// attributes |
|
338 |
ElementList *elements; |
|
339 |
Elision *elision; |
|
340 |
}; |
|
341 |
||
342 |
class ObjectLiteral: public ExpressionNode |
|
343 |
{ |
|
344 |
public: |
|
345 |
ObjectLiteral(): |
|
346 |
properties (0) { kind = Kind_ObjectLiteral; } |
|
347 |
||
348 |
ObjectLiteral(PropertyNameAndValueList *plist): |
|
349 |
properties (plist) { kind = Kind_ObjectLiteral; } |
|
350 |
||
351 |
virtual ~ObjectLiteral() {} |
|
352 |
||
353 |
virtual void accept0(Visitor *visitor); |
|
354 |
||
355 |
// attributes |
|
356 |
PropertyNameAndValueList *properties; |
|
357 |
}; |
|
358 |
||
359 |
class ElementList: public Node |
|
360 |
{ |
|
361 |
public: |
|
362 |
ElementList(Elision *e, ExpressionNode *expr): |
|
363 |
elision (e), expression (expr), next (this) |
|
364 |
{ kind = Kind_ElementList; } |
|
365 |
||
366 |
ElementList(ElementList *previous, Elision *e, ExpressionNode *expr): |
|
367 |
elision (e), expression (expr) |
|
368 |
{ |
|
369 |
kind = Kind_ElementList; |
|
370 |
next = previous->next; |
|
371 |
previous->next = this; |
|
372 |
} |
|
373 |
||
374 |
virtual ~ElementList() {} |
|
375 |
||
376 |
inline ElementList *finish () |
|
377 |
{ |
|
378 |
ElementList *front = next; |
|
379 |
next = 0; |
|
380 |
return front; |
|
381 |
} |
|
382 |
||
383 |
virtual void accept0(Visitor *visitor); |
|
384 |
||
385 |
// attributes |
|
386 |
Elision *elision; |
|
387 |
ExpressionNode *expression; |
|
388 |
ElementList *next; |
|
389 |
}; |
|
390 |
||
391 |
class Elision: public Node |
|
392 |
{ |
|
393 |
public: |
|
394 |
Elision(): |
|
395 |
next (this) { kind = Kind_Elision; } |
|
396 |
||
397 |
Elision(Elision *previous) |
|
398 |
{ |
|
399 |
kind = Kind_Elision; |
|
400 |
next = previous->next; |
|
401 |
previous->next = this; |
|
402 |
} |
|
403 |
||
404 |
virtual ~Elision() {} |
|
405 |
||
406 |
virtual void accept0(Visitor *visitor); |
|
407 |
||
408 |
inline Elision *finish () |
|
409 |
{ |
|
410 |
Elision *front = next; |
|
411 |
next = 0; |
|
412 |
return front; |
|
413 |
} |
|
414 |
||
415 |
// attributes |
|
416 |
Elision *next; |
|
417 |
}; |
|
418 |
||
419 |
class PropertyNameAndValueList: public Node |
|
420 |
{ |
|
421 |
public: |
|
422 |
PropertyNameAndValueList(PropertyName *n, ExpressionNode *v): |
|
423 |
name (n), value (v), next (this) |
|
424 |
{ kind = Kind_PropertyNameAndValueList; } |
|
425 |
||
426 |
PropertyNameAndValueList(PropertyNameAndValueList *previous, PropertyName *n, ExpressionNode *v): |
|
427 |
name (n), value (v) |
|
428 |
{ |
|
429 |
kind = Kind_PropertyNameAndValueList; |
|
430 |
next = previous->next; |
|
431 |
previous->next = this; |
|
432 |
} |
|
433 |
||
434 |
virtual ~PropertyNameAndValueList() {} |
|
435 |
||
436 |
virtual void accept0(Visitor *visitor); |
|
437 |
||
438 |
inline PropertyNameAndValueList *finish () |
|
439 |
{ |
|
440 |
PropertyNameAndValueList *front = next; |
|
441 |
next = 0; |
|
442 |
return front; |
|
443 |
} |
|
444 |
||
445 |
// attributes |
|
446 |
PropertyName *name; |
|
447 |
ExpressionNode *value; |
|
448 |
PropertyNameAndValueList *next; |
|
449 |
}; |
|
450 |
||
451 |
class PropertyName: public Node |
|
452 |
{ |
|
453 |
public: |
|
454 |
PropertyName() { kind = Kind_PropertyName; } |
|
455 |
virtual ~PropertyName() {} |
|
456 |
}; |
|
457 |
||
458 |
class IdentifierPropertyName: public PropertyName |
|
459 |
{ |
|
460 |
public: |
|
461 |
IdentifierPropertyName(QScriptNameIdImpl *n): |
|
462 |
id (n) { kind = Kind_IdentifierPropertyName; } |
|
463 |
||
464 |
virtual ~IdentifierPropertyName() {} |
|
465 |
||
466 |
virtual void accept0(Visitor *visitor); |
|
467 |
||
468 |
// attributes |
|
469 |
QScriptNameIdImpl *id; |
|
470 |
}; |
|
471 |
||
472 |
class StringLiteralPropertyName: public PropertyName |
|
473 |
{ |
|
474 |
public: |
|
475 |
StringLiteralPropertyName(QScriptNameIdImpl *n): |
|
476 |
id (n) { kind = Kind_StringLiteralPropertyName; } |
|
477 |
virtual ~StringLiteralPropertyName() {} |
|
478 |
||
479 |
virtual void accept0(Visitor *visitor); |
|
480 |
||
481 |
// attributes |
|
482 |
QScriptNameIdImpl *id; |
|
483 |
}; |
|
484 |
||
485 |
class NumericLiteralPropertyName: public PropertyName |
|
486 |
{ |
|
487 |
public: |
|
488 |
NumericLiteralPropertyName(double n): |
|
489 |
id (n) { kind = Kind_NumericLiteralPropertyName; } |
|
490 |
virtual ~NumericLiteralPropertyName() {} |
|
491 |
||
492 |
virtual void accept0(Visitor *visitor); |
|
493 |
||
494 |
// attributes |
|
495 |
double id; |
|
496 |
}; |
|
497 |
||
498 |
class ArrayMemberExpression: public ExpressionNode |
|
499 |
{ |
|
500 |
public: |
|
501 |
ArrayMemberExpression(ExpressionNode *b, ExpressionNode *e): |
|
502 |
base (b), expression (e) |
|
503 |
{ kind = Kind_ArrayMemberExpression; } |
|
504 |
||
505 |
virtual ~ArrayMemberExpression() {} |
|
506 |
||
507 |
virtual void accept0(Visitor *visitor); |
|
508 |
||
509 |
// attributes |
|
510 |
ExpressionNode *base; |
|
511 |
ExpressionNode *expression; |
|
512 |
}; |
|
513 |
||
514 |
class FieldMemberExpression: public ExpressionNode |
|
515 |
{ |
|
516 |
public: |
|
517 |
FieldMemberExpression(ExpressionNode *b, QScriptNameIdImpl *n): |
|
518 |
base (b), name (n) |
|
519 |
{ kind = Kind_FieldMemberExpression; } |
|
520 |
||
521 |
virtual ~FieldMemberExpression() {} |
|
522 |
||
523 |
virtual void accept0(Visitor *visitor); |
|
524 |
||
525 |
// attributes |
|
526 |
ExpressionNode *base; |
|
527 |
QScriptNameIdImpl *name; |
|
528 |
}; |
|
529 |
||
530 |
class NewMemberExpression: public ExpressionNode |
|
531 |
{ |
|
532 |
public: |
|
533 |
NewMemberExpression(ExpressionNode *b, ArgumentList *a): |
|
534 |
base (b), arguments (a) |
|
535 |
{ kind = Kind_NewMemberExpression; } |
|
536 |
||
537 |
virtual ~NewMemberExpression() {} |
|
538 |
||
539 |
virtual void accept0(Visitor *visitor); |
|
540 |
||
541 |
// attributes |
|
542 |
ExpressionNode *base; |
|
543 |
ArgumentList *arguments; |
|
544 |
}; |
|
545 |
||
546 |
class NewExpression: public ExpressionNode |
|
547 |
{ |
|
548 |
public: |
|
549 |
NewExpression(ExpressionNode *e): |
|
550 |
expression (e) { kind = Kind_NewExpression; } |
|
551 |
||
552 |
virtual ~NewExpression() {} |
|
553 |
||
554 |
virtual void accept0(Visitor *visitor); |
|
555 |
||
556 |
// attributes |
|
557 |
ExpressionNode *expression; |
|
558 |
}; |
|
559 |
||
560 |
class CallExpression: public ExpressionNode |
|
561 |
{ |
|
562 |
public: |
|
563 |
CallExpression(ExpressionNode *b, ArgumentList *a): |
|
564 |
base (b), arguments (a) |
|
565 |
{ kind = Kind_CallExpression; } |
|
566 |
||
567 |
virtual ~CallExpression() {} |
|
568 |
||
569 |
virtual void accept0(Visitor *visitor); |
|
570 |
||
571 |
// attributes |
|
572 |
ExpressionNode *base; |
|
573 |
ArgumentList *arguments; |
|
574 |
}; |
|
575 |
||
576 |
class ArgumentList: public Node |
|
577 |
{ |
|
578 |
public: |
|
579 |
ArgumentList(ExpressionNode *e): |
|
580 |
expression (e), next (this) |
|
581 |
{ kind = Kind_ArgumentList; } |
|
582 |
||
583 |
ArgumentList(ArgumentList *previous, ExpressionNode *e): |
|
584 |
expression (e) |
|
585 |
{ |
|
586 |
kind = Kind_ArgumentList; |
|
587 |
next = previous->next; |
|
588 |
previous->next = this; |
|
589 |
} |
|
590 |
||
591 |
virtual ~ArgumentList() {} |
|
592 |
||
593 |
virtual void accept0(Visitor *visitor); |
|
594 |
||
595 |
inline ArgumentList *finish () |
|
596 |
{ |
|
597 |
ArgumentList *front = next; |
|
598 |
next = 0; |
|
599 |
return front; |
|
600 |
} |
|
601 |
||
602 |
// attributes |
|
603 |
ExpressionNode *expression; |
|
604 |
ArgumentList *next; |
|
605 |
}; |
|
606 |
||
607 |
class PostIncrementExpression: public ExpressionNode |
|
608 |
{ |
|
609 |
public: |
|
610 |
PostIncrementExpression(ExpressionNode *b): |
|
611 |
base (b) { kind = Kind_PostIncrementExpression; } |
|
612 |
||
613 |
virtual ~PostIncrementExpression() {} |
|
614 |
||
615 |
virtual void accept0(Visitor *visitor); |
|
616 |
||
617 |
// attributes |
|
618 |
ExpressionNode *base; |
|
619 |
}; |
|
620 |
||
621 |
class PostDecrementExpression: public ExpressionNode |
|
622 |
{ |
|
623 |
public: |
|
624 |
PostDecrementExpression(ExpressionNode *b): |
|
625 |
base (b) { kind = Kind_PostDecrementExpression; } |
|
626 |
||
627 |
virtual ~PostDecrementExpression() {} |
|
628 |
||
629 |
virtual void accept0(Visitor *visitor); |
|
630 |
||
631 |
// attributes |
|
632 |
ExpressionNode *base; |
|
633 |
}; |
|
634 |
||
635 |
class DeleteExpression: public ExpressionNode |
|
636 |
{ |
|
637 |
public: |
|
638 |
DeleteExpression(ExpressionNode *e): |
|
639 |
expression (e) { kind = Kind_DeleteExpression; } |
|
640 |
virtual ~DeleteExpression() {} |
|
641 |
||
642 |
virtual void accept0(Visitor *visitor); |
|
643 |
||
644 |
// attributes |
|
645 |
ExpressionNode *expression; |
|
646 |
}; |
|
647 |
||
648 |
class VoidExpression: public ExpressionNode |
|
649 |
{ |
|
650 |
public: |
|
651 |
VoidExpression(ExpressionNode *e): |
|
652 |
expression (e) { kind = Kind_VoidExpression; } |
|
653 |
||
654 |
virtual ~VoidExpression() {} |
|
655 |
||
656 |
virtual void accept0(Visitor *visitor); |
|
657 |
||
658 |
// attributes |
|
659 |
ExpressionNode *expression; |
|
660 |
}; |
|
661 |
||
662 |
class TypeOfExpression: public ExpressionNode |
|
663 |
{ |
|
664 |
public: |
|
665 |
TypeOfExpression(ExpressionNode *e): |
|
666 |
expression (e) { kind = Kind_TypeOfExpression; } |
|
667 |
||
668 |
virtual ~TypeOfExpression() {} |
|
669 |
||
670 |
virtual void accept0(Visitor *visitor); |
|
671 |
||
672 |
// attributes |
|
673 |
ExpressionNode *expression; |
|
674 |
}; |
|
675 |
||
676 |
class PreIncrementExpression: public ExpressionNode |
|
677 |
{ |
|
678 |
public: |
|
679 |
PreIncrementExpression(ExpressionNode *e): |
|
680 |
expression (e) { kind = Kind_PreIncrementExpression; } |
|
681 |
||
682 |
virtual ~PreIncrementExpression() {} |
|
683 |
||
684 |
virtual void accept0(Visitor *visitor); |
|
685 |
||
686 |
// attributes |
|
687 |
ExpressionNode *expression; |
|
688 |
}; |
|
689 |
||
690 |
class PreDecrementExpression: public ExpressionNode |
|
691 |
{ |
|
692 |
public: |
|
693 |
PreDecrementExpression(ExpressionNode *e): |
|
694 |
expression (e) { kind = Kind_PreDecrementExpression; } |
|
695 |
||
696 |
virtual ~PreDecrementExpression() {} |
|
697 |
||
698 |
virtual void accept0(Visitor *visitor); |
|
699 |
||
700 |
// attributes |
|
701 |
ExpressionNode *expression; |
|
702 |
}; |
|
703 |
||
704 |
class UnaryPlusExpression: public ExpressionNode |
|
705 |
{ |
|
706 |
public: |
|
707 |
UnaryPlusExpression(ExpressionNode *e): |
|
708 |
expression (e) { kind = Kind_UnaryPlusExpression; } |
|
709 |
||
710 |
virtual ~UnaryPlusExpression() {} |
|
711 |
||
712 |
virtual void accept0(Visitor *visitor); |
|
713 |
||
714 |
// attributes |
|
715 |
ExpressionNode *expression; |
|
716 |
}; |
|
717 |
||
718 |
class UnaryMinusExpression: public ExpressionNode |
|
719 |
{ |
|
720 |
public: |
|
721 |
UnaryMinusExpression(ExpressionNode *e): |
|
722 |
expression (e) { kind = Kind_UnaryMinusExpression; } |
|
723 |
||
724 |
virtual ~UnaryMinusExpression() {} |
|
725 |
||
726 |
virtual void accept0(Visitor *visitor); |
|
727 |
||
728 |
// attributes |
|
729 |
ExpressionNode *expression; |
|
730 |
}; |
|
731 |
||
732 |
class TildeExpression: public ExpressionNode |
|
733 |
{ |
|
734 |
public: |
|
735 |
TildeExpression(ExpressionNode *e): |
|
736 |
expression (e) { kind = Kind_TildeExpression; } |
|
737 |
||
738 |
virtual ~TildeExpression() {} |
|
739 |
||
740 |
virtual void accept0(Visitor *visitor); |
|
741 |
||
742 |
// attributes |
|
743 |
ExpressionNode *expression; |
|
744 |
}; |
|
745 |
||
746 |
class NotExpression: public ExpressionNode |
|
747 |
{ |
|
748 |
public: |
|
749 |
NotExpression(ExpressionNode *e): |
|
750 |
expression (e) { kind = Kind_NotExpression; } |
|
751 |
||
752 |
virtual ~NotExpression() {} |
|
753 |
||
754 |
virtual void accept0(Visitor *visitor); |
|
755 |
||
756 |
// attributes |
|
757 |
ExpressionNode *expression; |
|
758 |
}; |
|
759 |
||
760 |
class BinaryExpression: public ExpressionNode |
|
761 |
{ |
|
762 |
public: |
|
763 |
BinaryExpression(ExpressionNode *l, int o, ExpressionNode *r): |
|
764 |
left (l), op (o), right (r) |
|
765 |
{ kind = Kind_BinaryExpression; } |
|
766 |
||
767 |
virtual ~BinaryExpression() {} |
|
768 |
||
769 |
virtual BinaryExpression *binaryExpressionCast(); |
|
770 |
||
771 |
virtual void accept0(Visitor *visitor); |
|
772 |
||
773 |
// attributes |
|
774 |
ExpressionNode *left; |
|
775 |
int op; |
|
776 |
ExpressionNode *right; |
|
777 |
}; |
|
778 |
||
779 |
class ConditionalExpression: public ExpressionNode |
|
780 |
{ |
|
781 |
public: |
|
782 |
ConditionalExpression(ExpressionNode *e, ExpressionNode *t, ExpressionNode *f): |
|
783 |
expression (e), ok (t), ko (f) |
|
784 |
{ kind = Kind_ConditionalExpression; } |
|
785 |
||
786 |
virtual ~ConditionalExpression() {} |
|
787 |
||
788 |
virtual void accept0(Visitor *visitor); |
|
789 |
||
790 |
// attributes |
|
791 |
ExpressionNode *expression; |
|
792 |
ExpressionNode *ok; |
|
793 |
ExpressionNode *ko; |
|
794 |
}; |
|
795 |
||
796 |
class Expression: public ExpressionNode // ### rename |
|
797 |
{ |
|
798 |
public: |
|
799 |
Expression(ExpressionNode *l, ExpressionNode *r): |
|
800 |
left (l), right (r) { kind = Kind_Expression; } |
|
801 |
||
802 |
virtual ~Expression() {} |
|
803 |
||
804 |
virtual void accept0(Visitor *visitor); |
|
805 |
||
806 |
// attributes |
|
807 |
ExpressionNode *left; |
|
808 |
ExpressionNode *right; |
|
809 |
}; |
|
810 |
||
811 |
class Block: public Statement |
|
812 |
{ |
|
813 |
public: |
|
814 |
Block(StatementList *slist): |
|
815 |
statements (slist) { kind = Kind_Block; } |
|
816 |
||
817 |
virtual ~Block() {} |
|
818 |
||
819 |
virtual void accept0(Visitor *visitor); |
|
820 |
||
821 |
// attributes |
|
822 |
StatementList *statements; |
|
823 |
}; |
|
824 |
||
825 |
class StatementList: public Node |
|
826 |
{ |
|
827 |
public: |
|
828 |
StatementList(Statement *stmt): |
|
829 |
statement (stmt), next (this) |
|
830 |
{ kind = Kind_StatementList; } |
|
831 |
||
832 |
StatementList(StatementList *previous, Statement *stmt): |
|
833 |
statement (stmt) |
|
834 |
{ |
|
835 |
kind = Kind_StatementList; |
|
836 |
next = previous->next; |
|
837 |
previous->next = this; |
|
838 |
} |
|
839 |
||
840 |
virtual ~StatementList() {} |
|
841 |
||
842 |
virtual void accept0(Visitor *visitor); |
|
843 |
||
844 |
inline StatementList *finish () |
|
845 |
{ |
|
846 |
StatementList *front = next; |
|
847 |
next = 0; |
|
848 |
return front; |
|
849 |
} |
|
850 |
||
851 |
// attributes |
|
852 |
Statement *statement; |
|
853 |
StatementList *next; |
|
854 |
}; |
|
855 |
||
856 |
class VariableStatement: public Statement |
|
857 |
{ |
|
858 |
public: |
|
859 |
VariableStatement(VariableDeclarationList *vlist): |
|
860 |
declarations (vlist) |
|
861 |
{ kind = Kind_VariableStatement; } |
|
862 |
||
863 |
virtual ~VariableStatement() {} |
|
864 |
||
865 |
virtual void accept0(Visitor *visitor); |
|
866 |
||
867 |
// attributes |
|
868 |
VariableDeclarationList *declarations; |
|
869 |
}; |
|
870 |
||
871 |
class VariableDeclaration: public Node |
|
872 |
{ |
|
873 |
public: |
|
874 |
VariableDeclaration(QScriptNameIdImpl *n, ExpressionNode *e): |
|
875 |
name (n), expression (e), readOnly(false) |
|
876 |
{ kind = Kind_VariableDeclaration; } |
|
877 |
||
878 |
virtual ~VariableDeclaration() {} |
|
879 |
||
880 |
virtual void accept0(Visitor *visitor); |
|
881 |
||
882 |
// attributes |
|
883 |
QScriptNameIdImpl *name; |
|
884 |
ExpressionNode *expression; |
|
885 |
bool readOnly; |
|
886 |
}; |
|
887 |
||
888 |
class VariableDeclarationList: public Node |
|
889 |
{ |
|
890 |
public: |
|
891 |
VariableDeclarationList(VariableDeclaration *decl): |
|
892 |
declaration (decl), next (this) |
|
893 |
{ kind = Kind_VariableDeclarationList; } |
|
894 |
||
895 |
VariableDeclarationList(VariableDeclarationList *previous, VariableDeclaration *decl): |
|
896 |
declaration (decl) |
|
897 |
{ |
|
898 |
kind = Kind_VariableDeclarationList; |
|
899 |
next = previous->next; |
|
900 |
previous->next = this; |
|
901 |
} |
|
902 |
||
903 |
virtual ~VariableDeclarationList() {} |
|
904 |
||
905 |
virtual void accept0(Visitor *visitor); |
|
906 |
||
907 |
inline VariableDeclarationList *finish (bool readOnly) |
|
908 |
{ |
|
909 |
VariableDeclarationList *front = next; |
|
910 |
next = 0; |
|
911 |
if (readOnly) { |
|
912 |
VariableDeclarationList *vdl; |
|
913 |
for (vdl = front; vdl != 0; vdl = vdl->next) |
|
914 |
vdl->declaration->readOnly = true; |
|
915 |
} |
|
916 |
return front; |
|
917 |
} |
|
918 |
||
919 |
// attributes |
|
920 |
VariableDeclaration *declaration; |
|
921 |
VariableDeclarationList *next; |
|
922 |
}; |
|
923 |
||
924 |
class EmptyStatement: public Statement |
|
925 |
{ |
|
926 |
public: |
|
927 |
EmptyStatement() { kind = Kind_EmptyStatement; } |
|
928 |
virtual ~EmptyStatement() {} |
|
929 |
||
930 |
virtual void accept0(Visitor *visitor); |
|
931 |
}; |
|
932 |
||
933 |
class ExpressionStatement: public Statement |
|
934 |
{ |
|
935 |
public: |
|
936 |
ExpressionStatement(ExpressionNode *e): |
|
937 |
expression (e) { kind = Kind_ExpressionStatement; } |
|
938 |
||
939 |
virtual ~ExpressionStatement() {} |
|
940 |
||
941 |
virtual void accept0(Visitor *visitor); |
|
942 |
||
943 |
// attributes |
|
944 |
ExpressionNode *expression; |
|
945 |
}; |
|
946 |
||
947 |
class IfStatement: public Statement |
|
948 |
{ |
|
949 |
public: |
|
950 |
IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0): |
|
951 |
expression (e), ok (t), ko (f) |
|
952 |
{ kind = Kind_IfStatement; } |
|
953 |
||
954 |
virtual ~IfStatement() {} |
|
955 |
||
956 |
virtual void accept0(Visitor *visitor); |
|
957 |
||
958 |
// attributes |
|
959 |
ExpressionNode *expression; |
|
960 |
Statement *ok; |
|
961 |
Statement *ko; |
|
962 |
}; |
|
963 |
||
964 |
class DoWhileStatement: public Statement |
|
965 |
{ |
|
966 |
public: |
|
967 |
DoWhileStatement(Statement *stmt, ExpressionNode *e): |
|
968 |
statement (stmt), expression (e) |
|
969 |
{ kind = Kind_DoWhileStatement; } |
|
970 |
||
971 |
virtual ~DoWhileStatement() {} |
|
972 |
||
973 |
virtual void accept0(Visitor *visitor); |
|
974 |
||
975 |
// attributes |
|
976 |
Statement *statement; |
|
977 |
ExpressionNode *expression; |
|
978 |
}; |
|
979 |
||
980 |
class WhileStatement: public Statement |
|
981 |
{ |
|
982 |
public: |
|
983 |
WhileStatement(ExpressionNode *e, Statement *stmt): |
|
984 |
expression (e), statement (stmt) |
|
985 |
{ kind = Kind_WhileStatement; } |
|
986 |
||
987 |
virtual ~WhileStatement() {} |
|
988 |
||
989 |
virtual void accept0(Visitor *visitor); |
|
990 |
||
991 |
// attributes |
|
992 |
ExpressionNode *expression; |
|
993 |
Statement *statement; |
|
994 |
}; |
|
995 |
||
996 |
class ForStatement: public Statement |
|
997 |
{ |
|
998 |
public: |
|
999 |
ForStatement(ExpressionNode *i, ExpressionNode *c, ExpressionNode *e, Statement *stmt): |
|
1000 |
initialiser (i), condition (c), expression (e), statement (stmt) |
|
1001 |
{ kind = Kind_ForStatement; } |
|
1002 |
||
1003 |
virtual ~ForStatement() {} |
|
1004 |
||
1005 |
virtual void accept0(Visitor *visitor); |
|
1006 |
||
1007 |
// attributes |
|
1008 |
ExpressionNode *initialiser; |
|
1009 |
ExpressionNode *condition; |
|
1010 |
ExpressionNode *expression; |
|
1011 |
Statement *statement; |
|
1012 |
}; |
|
1013 |
||
1014 |
class LocalForStatement: public Statement |
|
1015 |
{ |
|
1016 |
public: |
|
1017 |
LocalForStatement(VariableDeclarationList *vlist, ExpressionNode *c, ExpressionNode *e, Statement *stmt): |
|
1018 |
declarations (vlist), condition (c), expression (e), statement (stmt) |
|
1019 |
{ kind = Kind_LocalForStatement; } |
|
1020 |
||
1021 |
virtual ~LocalForStatement() {} |
|
1022 |
||
1023 |
virtual void accept0(Visitor *visitor); |
|
1024 |
||
1025 |
// attributes |
|
1026 |
VariableDeclarationList *declarations; |
|
1027 |
ExpressionNode *condition; |
|
1028 |
ExpressionNode *expression; |
|
1029 |
Statement *statement; |
|
1030 |
}; |
|
1031 |
||
1032 |
class ForEachStatement: public Statement |
|
1033 |
{ |
|
1034 |
public: |
|
1035 |
ForEachStatement(ExpressionNode *i, ExpressionNode *e, Statement *stmt): |
|
1036 |
initialiser (i), expression (e), statement (stmt) |
|
1037 |
{ kind = Kind_ForEachStatement; } |
|
1038 |
||
1039 |
virtual ~ForEachStatement() {} |
|
1040 |
||
1041 |
virtual void accept0(Visitor *visitor); |
|
1042 |
||
1043 |
// attributes |
|
1044 |
ExpressionNode *initialiser; |
|
1045 |
ExpressionNode *expression; |
|
1046 |
Statement *statement; |
|
1047 |
}; |
|
1048 |
||
1049 |
class LocalForEachStatement: public Statement |
|
1050 |
{ |
|
1051 |
public: |
|
1052 |
LocalForEachStatement(VariableDeclaration *v, ExpressionNode *e, Statement *stmt): |
|
1053 |
declaration (v), expression (e), statement (stmt) |
|
1054 |
{ kind = Kind_LocalForEachStatement; } |
|
1055 |
||
1056 |
virtual ~LocalForEachStatement() {} |
|
1057 |
||
1058 |
virtual void accept0(Visitor *visitor); |
|
1059 |
||
1060 |
// attributes |
|
1061 |
VariableDeclaration *declaration; |
|
1062 |
ExpressionNode *expression; |
|
1063 |
Statement *statement; |
|
1064 |
}; |
|
1065 |
||
1066 |
class ContinueStatement: public Statement |
|
1067 |
{ |
|
1068 |
public: |
|
1069 |
ContinueStatement(QScriptNameIdImpl *l = 0): |
|
1070 |
label (l) { kind = Kind_ContinueStatement; } |
|
1071 |
||
1072 |
virtual ~ContinueStatement() {} |
|
1073 |
||
1074 |
virtual void accept0(Visitor *visitor); |
|
1075 |
||
1076 |
// attributes |
|
1077 |
QScriptNameIdImpl *label; |
|
1078 |
}; |
|
1079 |
||
1080 |
class BreakStatement: public Statement |
|
1081 |
{ |
|
1082 |
public: |
|
1083 |
BreakStatement(QScriptNameIdImpl *l = 0): |
|
1084 |
label (l) { kind = Kind_BreakStatement; } |
|
1085 |
||
1086 |
virtual ~BreakStatement() {} |
|
1087 |
||
1088 |
virtual void accept0(Visitor *visitor); |
|
1089 |
||
1090 |
// attributes |
|
1091 |
QScriptNameIdImpl *label; |
|
1092 |
}; |
|
1093 |
||
1094 |
class ReturnStatement: public Statement |
|
1095 |
{ |
|
1096 |
public: |
|
1097 |
ReturnStatement(ExpressionNode *e): |
|
1098 |
expression (e) { kind = Kind_ReturnStatement; } |
|
1099 |
||
1100 |
virtual ~ReturnStatement() {} |
|
1101 |
||
1102 |
virtual void accept0(Visitor *visitor); |
|
1103 |
||
1104 |
// attributes |
|
1105 |
ExpressionNode *expression; |
|
1106 |
}; |
|
1107 |
||
1108 |
class WithStatement: public Statement |
|
1109 |
{ |
|
1110 |
public: |
|
1111 |
WithStatement(ExpressionNode *e, Statement *stmt): |
|
1112 |
expression (e), statement (stmt) |
|
1113 |
{ kind = Kind_WithStatement; } |
|
1114 |
||
1115 |
virtual ~WithStatement() {} |
|
1116 |
||
1117 |
virtual void accept0(Visitor *visitor); |
|
1118 |
||
1119 |
// attributes |
|
1120 |
ExpressionNode *expression; |
|
1121 |
Statement *statement; |
|
1122 |
}; |
|
1123 |
||
1124 |
class SwitchStatement: public Statement |
|
1125 |
{ |
|
1126 |
public: |
|
1127 |
SwitchStatement(ExpressionNode *e, CaseBlock *b): |
|
1128 |
expression (e), block (b) |
|
1129 |
{ kind = Kind_SwitchStatement; } |
|
1130 |
||
1131 |
virtual ~SwitchStatement() {} |
|
1132 |
||
1133 |
virtual void accept0(Visitor *visitor); |
|
1134 |
||
1135 |
// attributes |
|
1136 |
ExpressionNode *expression; |
|
1137 |
CaseBlock *block; |
|
1138 |
}; |
|
1139 |
||
1140 |
class CaseBlock: public Node |
|
1141 |
{ |
|
1142 |
public: |
|
1143 |
CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0): |
|
1144 |
clauses (c), defaultClause (d), moreClauses (r) |
|
1145 |
{ kind = Kind_CaseBlock; } |
|
1146 |
||
1147 |
virtual ~CaseBlock() {} |
|
1148 |
||
1149 |
virtual void accept0(Visitor *visitor); |
|
1150 |
||
1151 |
// attributes |
|
1152 |
CaseClauses *clauses; |
|
1153 |
DefaultClause *defaultClause; |
|
1154 |
CaseClauses *moreClauses; |
|
1155 |
}; |
|
1156 |
||
1157 |
class CaseClauses: public Node |
|
1158 |
{ |
|
1159 |
public: |
|
1160 |
CaseClauses(CaseClause *c): |
|
1161 |
clause (c), next (this) |
|
1162 |
{ kind = Kind_CaseClauses; } |
|
1163 |
||
1164 |
CaseClauses(CaseClauses *previous, CaseClause *c): |
|
1165 |
clause (c) |
|
1166 |
{ |
|
1167 |
kind = Kind_CaseClauses; |
|
1168 |
next = previous->next; |
|
1169 |
previous->next = this; |
|
1170 |
} |
|
1171 |
||
1172 |
virtual ~CaseClauses() {} |
|
1173 |
||
1174 |
virtual void accept0(Visitor *visitor); |
|
1175 |
||
1176 |
inline CaseClauses *finish () |
|
1177 |
{ |
|
1178 |
CaseClauses *front = next; |
|
1179 |
next = 0; |
|
1180 |
return front; |
|
1181 |
} |
|
1182 |
||
1183 |
//attributes |
|
1184 |
CaseClause *clause; |
|
1185 |
CaseClauses *next; |
|
1186 |
}; |
|
1187 |
||
1188 |
class CaseClause: public Node |
|
1189 |
{ |
|
1190 |
public: |
|
1191 |
CaseClause(ExpressionNode *e, StatementList *slist): |
|
1192 |
expression (e), statements (slist) |
|
1193 |
{ kind = Kind_CaseClause; } |
|
1194 |
||
1195 |
virtual ~CaseClause() {} |
|
1196 |
||
1197 |
virtual void accept0(Visitor *visitor); |
|
1198 |
||
1199 |
// attributes |
|
1200 |
ExpressionNode *expression; |
|
1201 |
StatementList *statements; |
|
1202 |
}; |
|
1203 |
||
1204 |
class DefaultClause: public Node |
|
1205 |
{ |
|
1206 |
public: |
|
1207 |
DefaultClause(StatementList *slist): |
|
1208 |
statements (slist) |
|
1209 |
{ kind = Kind_DefaultClause; } |
|
1210 |
||
1211 |
virtual ~DefaultClause() {} |
|
1212 |
||
1213 |
virtual void accept0(Visitor *visitor); |
|
1214 |
||
1215 |
// attributes |
|
1216 |
StatementList *statements; |
|
1217 |
}; |
|
1218 |
||
1219 |
class LabelledStatement: public Statement |
|
1220 |
{ |
|
1221 |
public: |
|
1222 |
LabelledStatement(QScriptNameIdImpl *l, Statement *stmt): |
|
1223 |
label (l), statement (stmt) |
|
1224 |
{ kind = Kind_LabelledStatement; } |
|
1225 |
||
1226 |
virtual ~LabelledStatement() {} |
|
1227 |
||
1228 |
virtual void accept0(Visitor *visitor); |
|
1229 |
||
1230 |
// attributes |
|
1231 |
QScriptNameIdImpl *label; |
|
1232 |
Statement *statement; |
|
1233 |
}; |
|
1234 |
||
1235 |
class ThrowStatement: public Statement |
|
1236 |
{ |
|
1237 |
public: |
|
1238 |
ThrowStatement(ExpressionNode *e): |
|
1239 |
expression (e) { kind = Kind_ThrowStatement; } |
|
1240 |
||
1241 |
virtual ~ThrowStatement() {} |
|
1242 |
||
1243 |
virtual void accept0(Visitor *visitor); |
|
1244 |
||
1245 |
// attributes |
|
1246 |
ExpressionNode *expression; |
|
1247 |
}; |
|
1248 |
||
1249 |
class TryStatement: public Statement |
|
1250 |
{ |
|
1251 |
public: |
|
1252 |
TryStatement(Statement *stmt, Catch *c, Finally *f): |
|
1253 |
statement (stmt), catchExpression (c), finallyExpression (f) |
|
1254 |
{ kind = Kind_TryStatement; } |
|
1255 |
||
1256 |
TryStatement(Statement *stmt, Finally *f): |
|
1257 |
statement (stmt), catchExpression (0), finallyExpression (f) |
|
1258 |
{ kind = Kind_TryStatement; } |
|
1259 |
||
1260 |
TryStatement(Statement *stmt, Catch *c): |
|
1261 |
statement (stmt), catchExpression (c), finallyExpression (0) |
|
1262 |
{ kind = Kind_TryStatement; } |
|
1263 |
||
1264 |
virtual ~TryStatement() {} |
|
1265 |
||
1266 |
virtual void accept0(Visitor *visitor); |
|
1267 |
||
1268 |
// attributes |
|
1269 |
Statement *statement; |
|
1270 |
Catch *catchExpression; |
|
1271 |
Finally *finallyExpression; |
|
1272 |
}; |
|
1273 |
||
1274 |
class Catch: public Node |
|
1275 |
{ |
|
1276 |
public: |
|
1277 |
Catch(QScriptNameIdImpl *n, Statement *stmt): |
|
1278 |
name (n), statement (stmt) |
|
1279 |
{ kind = Kind_Catch; } |
|
1280 |
||
1281 |
virtual ~Catch() {} |
|
1282 |
||
1283 |
virtual void accept0(Visitor *visitor); |
|
1284 |
||
1285 |
// attributes |
|
1286 |
QScriptNameIdImpl *name; |
|
1287 |
Statement *statement; |
|
1288 |
}; |
|
1289 |
||
1290 |
class Finally: public Node |
|
1291 |
{ |
|
1292 |
public: |
|
1293 |
Finally(Statement *stmt): |
|
1294 |
statement (stmt) |
|
1295 |
{ kind = Kind_Finally; } |
|
1296 |
||
1297 |
virtual ~Finally() {} |
|
1298 |
||
1299 |
virtual void accept0(Visitor *visitor); |
|
1300 |
||
1301 |
// attributes |
|
1302 |
Statement *statement; |
|
1303 |
}; |
|
1304 |
||
1305 |
class FunctionExpression: public ExpressionNode |
|
1306 |
{ |
|
1307 |
public: |
|
1308 |
FunctionExpression(QScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): |
|
1309 |
name (n), formals (f), body (b) |
|
1310 |
{ kind = Kind_FunctionExpression; } |
|
1311 |
||
1312 |
virtual ~FunctionExpression() {} |
|
1313 |
||
1314 |
virtual void accept0(Visitor *visitor); |
|
1315 |
||
1316 |
// attributes |
|
1317 |
QScriptNameIdImpl *name; |
|
1318 |
FormalParameterList *formals; |
|
1319 |
FunctionBody *body; |
|
1320 |
}; |
|
1321 |
||
1322 |
class FunctionDeclaration: public FunctionExpression |
|
1323 |
{ |
|
1324 |
public: |
|
1325 |
FunctionDeclaration(QScriptNameIdImpl *n, FormalParameterList *f, FunctionBody *b): |
|
1326 |
FunctionExpression(n, f, b) |
|
1327 |
{ kind = Kind_FunctionDeclaration; } |
|
1328 |
||
1329 |
virtual ~FunctionDeclaration() {} |
|
1330 |
||
1331 |
virtual void accept0(Visitor *visitor); |
|
1332 |
}; |
|
1333 |
||
1334 |
class FormalParameterList: public Node |
|
1335 |
{ |
|
1336 |
public: |
|
1337 |
FormalParameterList(QScriptNameIdImpl *n): |
|
1338 |
name (n), next (this) |
|
1339 |
{ kind = Kind_FormalParameterList; } |
|
1340 |
||
1341 |
FormalParameterList(FormalParameterList *previous, QScriptNameIdImpl *n): |
|
1342 |
name (n) |
|
1343 |
{ |
|
1344 |
kind = Kind_FormalParameterList; |
|
1345 |
next = previous->next; |
|
1346 |
previous->next = this; |
|
1347 |
} |
|
1348 |
||
1349 |
virtual ~FormalParameterList() {} |
|
1350 |
||
1351 |
virtual void accept0(Visitor *visitor); |
|
1352 |
||
1353 |
inline FormalParameterList *finish () |
|
1354 |
{ |
|
1355 |
FormalParameterList *front = next; |
|
1356 |
next = 0; |
|
1357 |
return front; |
|
1358 |
} |
|
1359 |
||
1360 |
// attributes |
|
1361 |
QScriptNameIdImpl *name; |
|
1362 |
FormalParameterList *next; |
|
1363 |
}; |
|
1364 |
||
1365 |
class FunctionBody: public Node |
|
1366 |
{ |
|
1367 |
public: |
|
1368 |
FunctionBody(SourceElements *elts): |
|
1369 |
elements (elts) |
|
1370 |
{ kind = Kind_FunctionBody; } |
|
1371 |
||
1372 |
virtual ~FunctionBody() {} |
|
1373 |
||
1374 |
virtual void accept0(Visitor *visitor); |
|
1375 |
||
1376 |
// attributes |
|
1377 |
SourceElements *elements; |
|
1378 |
}; |
|
1379 |
||
1380 |
class Program: public Node |
|
1381 |
{ |
|
1382 |
public: |
|
1383 |
Program(SourceElements *elts): |
|
1384 |
elements (elts) |
|
1385 |
{ kind = Kind_Program; } |
|
1386 |
||
1387 |
virtual ~Program() {} |
|
1388 |
||
1389 |
virtual void accept0(Visitor *visitor); |
|
1390 |
||
1391 |
// attributes |
|
1392 |
SourceElements *elements; |
|
1393 |
}; |
|
1394 |
||
1395 |
class SourceElements: public Node |
|
1396 |
{ |
|
1397 |
public: |
|
1398 |
SourceElements(SourceElement *elt): |
|
1399 |
element (elt), next (this) |
|
1400 |
{ kind = Kind_SourceElements; } |
|
1401 |
||
1402 |
SourceElements(SourceElements *previous, SourceElement *elt): |
|
1403 |
element (elt) |
|
1404 |
{ |
|
1405 |
kind = Kind_SourceElements; |
|
1406 |
next = previous->next; |
|
1407 |
previous->next = this; |
|
1408 |
} |
|
1409 |
||
1410 |
virtual ~SourceElements() {} |
|
1411 |
||
1412 |
virtual void accept0(Visitor *visitor); |
|
1413 |
||
1414 |
inline SourceElements *finish () |
|
1415 |
{ |
|
1416 |
SourceElements *front = next; |
|
1417 |
next = 0; |
|
1418 |
return front; |
|
1419 |
} |
|
1420 |
||
1421 |
// attributes |
|
1422 |
SourceElement *element; |
|
1423 |
SourceElements *next; |
|
1424 |
}; |
|
1425 |
||
1426 |
class SourceElement: public Node |
|
1427 |
{ |
|
1428 |
public: |
|
1429 |
inline SourceElement() |
|
1430 |
{ kind = Kind_SourceElement; } |
|
1431 |
||
1432 |
virtual ~SourceElement() {} |
|
1433 |
}; |
|
1434 |
||
1435 |
class FunctionSourceElement: public SourceElement |
|
1436 |
{ |
|
1437 |
public: |
|
1438 |
FunctionSourceElement(FunctionDeclaration *f): |
|
1439 |
declaration (f) |
|
1440 |
{ kind = Kind_FunctionSourceElement; } |
|
1441 |
||
1442 |
virtual ~FunctionSourceElement() {} |
|
1443 |
||
1444 |
virtual void accept0(Visitor *visitor); |
|
1445 |
||
1446 |
// attributes |
|
1447 |
FunctionDeclaration *declaration; |
|
1448 |
}; |
|
1449 |
||
1450 |
class StatementSourceElement: public SourceElement |
|
1451 |
{ |
|
1452 |
public: |
|
1453 |
StatementSourceElement(Statement *stmt): |
|
1454 |
statement (stmt) |
|
1455 |
{ kind = Kind_StatementSourceElement; } |
|
1456 |
||
1457 |
virtual ~StatementSourceElement() {} |
|
1458 |
||
1459 |
virtual void accept0(Visitor *visitor); |
|
1460 |
||
1461 |
// attributes |
|
1462 |
Statement *statement; |
|
1463 |
}; |
|
1464 |
||
1465 |
class DebuggerStatement: public Statement |
|
1466 |
{ |
|
1467 |
public: |
|
1468 |
DebuggerStatement() |
|
1469 |
{ kind = Kind_DebuggerStatement; } |
|
1470 |
||
1471 |
virtual ~DebuggerStatement() {} |
|
1472 |
||
1473 |
virtual void accept0(Visitor *visitor); |
|
1474 |
}; |
|
1475 |
||
1476 |
} } // namespace AST |
|
1477 |
||
1478 |
QT_END_NAMESPACE |
|
1479 |
||
1480 |
#endif |