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