AST.h 58.5 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
5
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
7
8
**
** Contact:  Qt Software Information (qt-info@nokia.com)
**
9
** Commercial Usage
10
**
11
12
13
14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
26
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
con's avatar
con committed
27
**
28
**************************************************************************/
con's avatar
con committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef CPLUSPLUS_AST_H
#define CPLUSPLUS_AST_H

#include "CPlusPlusForwardDeclarations.h"
#include "ASTfwd.h"
Roberto Raggi's avatar
Roberto Raggi committed
54
#include "MemoryPool.h"
con's avatar
con committed
55
56
57
58

CPLUSPLUS_BEGIN_HEADER
CPLUSPLUS_BEGIN_NAMESPACE

Roberto Raggi's avatar
Roberto Raggi committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
template <typename _Tp>
class List: public Managed
{
    List(const List &other);
    void operator =(const List &other);

public:
    List()
    { }

    _Tp value;
    List *next;
};

Roberto Raggi's avatar
Roberto Raggi committed
73
class CPLUSPLUS_EXPORT AST: public Managed
con's avatar
con committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
    AST(const AST &other);
    void operator =(const AST &other);

public:
    AST();
    virtual ~AST();

    void accept(ASTVisitor *visitor);

    static void accept(AST *ast, ASTVisitor *visitor)
    { if (ast) ast->accept(visitor); }

    virtual unsigned firstToken() const = 0;
    virtual unsigned lastToken() const = 0;

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    virtual AccessDeclarationAST *asAccessDeclaration() { return 0; }
    virtual ArrayAccessAST *asArrayAccess() { return 0; }
    virtual ArrayDeclaratorAST *asArrayDeclarator() { return 0; }
    virtual ArrayInitializerAST *asArrayInitializer() { return 0; }
    virtual AsmDefinitionAST *asAsmDefinition() { return 0; }
    virtual AttributeAST *asAttribute() { return 0; }
    virtual AttributeSpecifierAST *asAttributeSpecifier() { return 0; }
    virtual BaseSpecifierAST *asBaseSpecifier() { return 0; }
    virtual QtMethodAST *asQtMethod() { return 0; }
    virtual BinaryExpressionAST *asBinaryExpression() { return 0; }
    virtual BoolLiteralAST *asBoolLiteral() { return 0; }
    virtual BreakStatementAST *asBreakStatement() { return 0; }
    virtual CallAST *asCall() { return 0; }
    virtual CaseStatementAST *asCaseStatement() { return 0; }
    virtual CastExpressionAST *asCastExpression() { return 0; }
    virtual CatchClauseAST *asCatchClause() { return 0; }
    virtual ClassSpecifierAST *asClassSpecifier() { return 0; }
    virtual CompoundLiteralAST *asCompoundLiteral() { return 0; }
    virtual CompoundStatementAST *asCompoundStatement() { return 0; }
    virtual ConditionAST *asCondition() { return 0; }
    virtual ConditionalExpressionAST *asConditionalExpression() { return 0; }
    virtual ContinueStatementAST *asContinueStatement() { return 0; }
    virtual ConversionFunctionIdAST *asConversionFunctionId() { return 0; }
    virtual CoreDeclaratorAST *asCoreDeclarator() { return 0; }
    virtual CppCastExpressionAST *asCppCastExpression() { return 0; }
    virtual CtorInitializerAST *asCtorInitializer() { return 0; }
    virtual DeclarationAST *asDeclaration() { return 0; }
    virtual DeclarationStatementAST *asDeclarationStatement() { return 0; }
    virtual DeclaratorAST *asDeclarator() { return 0; }
    virtual DeclaratorIdAST *asDeclaratorId() { return 0; }
    virtual DeclaratorListAST *asDeclaratorList() { return 0; }
    virtual DeleteExpressionAST *asDeleteExpression() { return 0; }
    virtual DestructorNameAST *asDestructorName() { return 0; }
    virtual DoStatementAST *asDoStatement() { return 0; }
    virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() { return 0; }
    virtual EmptyDeclarationAST *asEmptyDeclaration() { return 0; }
    virtual EnumSpecifierAST *asEnumSpecifier() { return 0; }
    virtual EnumeratorAST *asEnumerator() { return 0; }
    virtual ExceptionDeclarationAST *asExceptionDeclaration() { return 0; }
    virtual ExceptionSpecificationAST *asExceptionSpecification() { return 0; }
    virtual ExpressionAST *asExpression() { return 0; }
    virtual ExpressionListAST *asExpressionList() { return 0; }
    virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return 0; }
    virtual ExpressionStatementAST *asExpressionStatement() { return 0; }
    virtual ForStatementAST *asForStatement() { return 0; }
    virtual FunctionDeclaratorAST *asFunctionDeclarator() { return 0; }
    virtual FunctionDefinitionAST *asFunctionDefinition() { return 0; }
    virtual GotoStatementAST *asGotoStatement() { return 0; }
    virtual IfStatementAST *asIfStatement() { return 0; }
    virtual LabeledStatementAST *asLabeledStatement() { return 0; }
    virtual LinkageBodyAST *asLinkageBody() { return 0; }
    virtual LinkageSpecificationAST *asLinkageSpecification() { return 0; }
    virtual MemInitializerAST *asMemInitializer() { return 0; }
    virtual MemberAccessAST *asMemberAccess() { return 0; }
    virtual NameAST *asName() { return 0; }
    virtual NamedTypeSpecifierAST *asNamedTypeSpecifier() { return 0; }
    virtual NamespaceAST *asNamespace() { return 0; }
    virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() { return 0; }
    virtual NestedDeclaratorAST *asNestedDeclarator() { return 0; }
    virtual NestedExpressionAST *asNestedExpression() { return 0; }
    virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return 0; }
151
152
    virtual NewPlacementAST *asNewPlacement() { return 0; }
    virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return 0; }
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
    virtual NewExpressionAST *asNewExpression() { return 0; }
    virtual NewInitializerAST *asNewInitializer() { return 0; }
    virtual NewTypeIdAST *asNewTypeId() { return 0; }
    virtual NumericLiteralAST *asNumericLiteral() { return 0; }
    virtual OperatorAST *asOperator() { return 0; }
    virtual OperatorFunctionIdAST *asOperatorFunctionId() { return 0; }
    virtual ParameterDeclarationAST *asParameterDeclaration() { return 0; }
    virtual ParameterDeclarationClauseAST *asParameterDeclarationClause() { return 0; }
    virtual PointerAST *asPointer() { return 0; }
    virtual PointerToMemberAST *asPointerToMember() { return 0; }
    virtual PostIncrDecrAST *asPostIncrDecr() { return 0; }
    virtual PostfixAST *asPostfix() { return 0; }
    virtual PostfixDeclaratorAST *asPostfixDeclarator() { return 0; }
    virtual PostfixExpressionAST *asPostfixExpression() { return 0; }
    virtual PtrOperatorAST *asPtrOperator() { return 0; }
    virtual QualifiedNameAST *asQualifiedName() { return 0; }
    virtual ReferenceAST *asReference() { return 0; }
    virtual ReturnStatementAST *asReturnStatement() { return 0; }
    virtual SimpleDeclarationAST *asSimpleDeclaration() { return 0; }
    virtual SimpleNameAST *asSimpleName() { return 0; }
    virtual SimpleSpecifierAST *asSimpleSpecifier() { return 0; }
    virtual SizeofExpressionAST *asSizeofExpression() { return 0; }
    virtual SpecifierAST *asSpecifier() { return 0; }
    virtual StatementAST *asStatement() { return 0; }
    virtual StringLiteralAST *asStringLiteral() { return 0; }
    virtual SwitchStatementAST *asSwitchStatement() { return 0; }
    virtual TemplateArgumentListAST *asTemplateArgumentList() { return 0; }
    virtual TemplateDeclarationAST *asTemplateDeclaration() { return 0; }
    virtual TemplateIdAST *asTemplateId() { return 0; }
    virtual TemplateTypeParameterAST *asTemplateTypeParameter() { return 0; }
    virtual ThisExpressionAST *asThisExpression() { return 0; }
    virtual ThrowExpressionAST *asThrowExpression() { return 0; }
    virtual TranslationUnitAST *asTranslationUnit() { return 0; }
    virtual TryBlockStatementAST *asTryBlockStatement() { return 0; }
    virtual TypeConstructorCallAST *asTypeConstructorCall() { return 0; }
    virtual TypeIdAST *asTypeId() { return 0; }
    virtual TypeidExpressionAST *asTypeidExpression() { return 0; }
    virtual TypenameCallExpressionAST *asTypenameCallExpression() { return 0; }
    virtual TypenameTypeParameterAST *asTypenameTypeParameter() { return 0; }
    virtual TypeofSpecifierAST *asTypeofSpecifier() { return 0; }
    virtual UnaryExpressionAST *asUnaryExpression() { return 0; }
    virtual UsingAST *asUsing() { return 0; }
    virtual UsingDirectiveAST *asUsingDirective() { return 0; }
    virtual WhileStatementAST *asWhileStatement() { return 0; }
    virtual IdentifierListAST *asIdentifierList() { return 0; }
    virtual ObjCClassDeclarationAST *asObjCClassDeclaration() { return 0; }
con's avatar
con committed
199

200
201
    virtual AST *clone(MemoryPool *pool) const = 0;

con's avatar
con committed
202
203
204
205
206
207
208
209
protected:
    virtual void accept0(ASTVisitor *visitor) = 0;
};

class CPLUSPLUS_EXPORT SpecifierAST: public AST
{
public:
    SpecifierAST *next;
210
211

public:
212
213
214
    virtual SpecifierAST *asSpecifier()
    { return this; }

215
    virtual SpecifierAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
216
217
218
219
220
221
222
223
};

class CPLUSPLUS_EXPORT SimpleSpecifierAST: public SpecifierAST
{
public:
    unsigned specifier_token;

public:
224
225
226
    virtual SimpleSpecifierAST *asSimpleSpecifier()
    { return this; }

con's avatar
con committed
227
228
229
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

230
231
    virtual SimpleSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT AttributeSpecifierAST: public SpecifierAST
{
public:
    unsigned attribute_token;
    unsigned first_lparen_token;
    unsigned second_lparen_token;
    AttributeAST *attributes;
    unsigned first_rparen_token;
    unsigned second_rparen_token;

public:
247
248
249
    virtual AttributeSpecifierAST *asAttributeSpecifier()
    { return this; }

con's avatar
con committed
250
251
252
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

253
254
    virtual AttributeSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
255
256
257
258
259
260
261
262
263
264
265
266
267
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT AttributeAST: public AST
{
public:
    unsigned identifier_token;
    unsigned lparen_token;
    unsigned tag_token;
    ExpressionListAST *expression_list;
    unsigned rparen_token;
    AttributeAST *next;
268
    unsigned comma_token;
con's avatar
con committed
269
270

public:
271
272
273
    virtual AttributeAST *asAttribute()
    { return this; }

con's avatar
con committed
274
275
276
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

277
278
    virtual AttributeAST *clone(MemoryPool *pool) const;

con's avatar
con committed
279
280
281
282
283
284
285
286
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT TypeofSpecifierAST: public SpecifierAST
{
public:
    unsigned typeof_token;
287
    unsigned lparen_token;
con's avatar
con committed
288
    ExpressionAST *expression;
289
    unsigned rparen_token;
con's avatar
con committed
290
291

public:
292
293
294
    virtual TypeofSpecifierAST *asTypeofSpecifier()
    { return this; }

con's avatar
con committed
295
296
297
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

298
299
    virtual TypeofSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
300
301
302
303
304
305
306
307
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT StatementAST: public AST
{
public:
    StatementAST *next;
308
309

public:
310
311
312
    virtual StatementAST *asStatement()
    { return this; }

313
    virtual StatementAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
314
315
316
317
318
};

class CPLUSPLUS_EXPORT ExpressionAST: public AST
{
public:
319
320
321
    virtual ExpressionAST *asExpression()
    { return this; }

322
    virtual ExpressionAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
323
324
325
326
327
328
};

class CPLUSPLUS_EXPORT DeclarationAST: public AST
{
public:
    DeclarationAST *next;
329
330

public:
331
332
333
    virtual DeclarationAST *asDeclaration()
    { return this; }

334
    virtual DeclarationAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
335
336
337
338
339
};

class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
{
public:
340
341
342
    virtual CoreDeclaratorAST *asCoreDeclarator()
    { return this; }

343
    virtual CoreDeclaratorAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
344
345
346
347
348
349
};

class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST
{
public:
    PostfixDeclaratorAST *next;
350
351

public:
352
353
354
    virtual PostfixDeclaratorAST *asPostfixDeclarator()
    { return this; }

355
    virtual PostfixDeclaratorAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
356
357
358
359
360
361
362
363
364
};

class CPLUSPLUS_EXPORT DeclaratorAST: public AST
{
public:
    PtrOperatorAST *ptr_operators;
    CoreDeclaratorAST *core_declarator;
    PostfixDeclaratorAST *postfix_declarators;
    SpecifierAST *attributes;
365
    unsigned equals_token;
con's avatar
con committed
366
367
368
    ExpressionAST *initializer;

public:
369
370
371
    virtual DeclaratorAST *asDeclarator()
    { return this; }

con's avatar
con committed
372
373
374
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

375
376
    virtual DeclaratorAST *clone(MemoryPool *pool) const;

con's avatar
con committed
377
378
379
380
381
382
383
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ExpressionListAST: public ExpressionAST
{
public:
384
    unsigned comma_token;
con's avatar
con committed
385
386
387
388
    ExpressionAST *expression;
    ExpressionListAST *next;

public:
389
390
391
    virtual ExpressionListAST *asExpressionList()
    { return this; }

con's avatar
con committed
392
393
394
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

395
396
    virtual ExpressionListAST *clone(MemoryPool *pool) const;

con's avatar
con committed
397
398
399
400
401
402
403
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT SimpleDeclarationAST: public DeclarationAST
{
public:
404
    unsigned qt_invokable_token;
con's avatar
con committed
405
406
407
408
    SpecifierAST *decl_specifier_seq;
    DeclaratorListAST *declarators;
    unsigned semicolon_token;

Roberto Raggi's avatar
Roberto Raggi committed
409
410
411
public:
    List<Declaration *> *symbols;

con's avatar
con committed
412
public:
413
414
415
    virtual SimpleDeclarationAST *asSimpleDeclaration()
    { return this; }

con's avatar
con committed
416
417
418
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

419
420
    virtual SimpleDeclarationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
421
422
423
424
425
426
427
428
429
430
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT EmptyDeclarationAST: public DeclarationAST
{
public:
    unsigned semicolon_token;

public:
431
432
433
    virtual EmptyDeclarationAST *asEmptyDeclaration()
    { return this; }

con's avatar
con committed
434
435
436
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

437
438
    virtual EmptyDeclarationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
439
440
441
442
443
444
445
446
447
448
449
450
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT AccessDeclarationAST: public DeclarationAST
{
public:
    unsigned access_specifier_token;
    unsigned slots_token;
    unsigned colon_token;

public:
451
452
453
    virtual AccessDeclarationAST *asAccessDeclaration()
    { return this; }

con's avatar
con committed
454
455
456
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

457
458
    virtual AccessDeclarationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
459
460
461
462
463
464
465
466
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST
{
public:
    unsigned asm_token;
467
    unsigned volatile_token;
con's avatar
con committed
468
    unsigned lparen_token;
469
470
    // ### string literals
    // ### asm operand list
con's avatar
con committed
471
472
473
474
    unsigned rparen_token;
    unsigned semicolon_token;

public:
475
476
477
    virtual AsmDefinitionAST *asAsmDefinition()
    { return this; }

con's avatar
con committed
478
479
480
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

481
482
    virtual AsmDefinitionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
483
484
485
486
487
488
489
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
{
public:
490
    unsigned comma_token;
Roberto Raggi's avatar
cleanup    
Roberto Raggi committed
491
492
    unsigned virtual_token;
    unsigned access_specifier_token;
con's avatar
con committed
493
494
495
    NameAST *name;
    BaseSpecifierAST *next;

Roberto Raggi's avatar
Roberto Raggi committed
496
public: // annotations
Roberto Raggi's avatar
Roberto Raggi committed
497
    BaseClass *symbol;
Roberto Raggi's avatar
Roberto Raggi committed
498

con's avatar
con committed
499
public:
500
501
502
    virtual BaseSpecifierAST *asBaseSpecifier()
    { return this; }

con's avatar
con committed
503
504
505
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

506
507
    virtual BaseSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
508
509
510
511
protected:
    virtual void accept0(ASTVisitor *visitor);
};

512
513
514
515
516
517
518
519
520
class CPLUSPLUS_EXPORT CompoundLiteralAST: public ExpressionAST
{
public:
    unsigned lparen_token;
    ExpressionAST *type_id;
    unsigned rparen_token;
    ExpressionAST *initializer;

public:
521
522
523
    virtual CompoundLiteralAST *asCompoundLiteral()
    { return this; }

524
525
526
527
528
529
530
531
532
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

    virtual CompoundLiteralAST *clone(MemoryPool *pool) const;

protected:
    virtual void accept0(ASTVisitor *visitor);
};

con's avatar
con committed
533
534
535
536
537
538
539
540
541
class CPLUSPLUS_EXPORT QtMethodAST: public ExpressionAST
{
public:
    unsigned method_token;
    unsigned lparen_token;
    DeclaratorAST *declarator;
    unsigned rparen_token;

public:
542
543
544
    virtual QtMethodAST *asQtMethod()
    { return this; }

con's avatar
con committed
545
546
547
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

548
549
    virtual QtMethodAST *clone(MemoryPool *pool) const;

con's avatar
con committed
550
551
552
553
554
555
556
557
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT BinaryExpressionAST: public ExpressionAST
{
public:
    ExpressionAST *left_expression;
558
    unsigned binary_op_token;
con's avatar
con committed
559
560
561
    ExpressionAST *right_expression;

public:
562
563
564
    virtual BinaryExpressionAST *asBinaryExpression()
    { return this; }

con's avatar
con committed
565
566
567
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

568
569
    virtual BinaryExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
570
571
572
573
574
575
576
577
578
579
580
581
582
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT CastExpressionAST: public ExpressionAST
{
public:
    unsigned lparen_token;
    ExpressionAST *type_id;
    unsigned rparen_token;
    ExpressionAST *expression;

public:
583
584
585
    virtual CastExpressionAST *asCastExpression()
    { return this; }

con's avatar
con committed
586
587
588
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

589
590
    virtual CastExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
591
592
593
594
595
596
597
598
599
600
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ClassSpecifierAST: public SpecifierAST
{
public:
    unsigned classkey_token;
    SpecifierAST *attributes;
    NameAST *name;
601
    unsigned colon_token;
con's avatar
con committed
602
603
604
605
606
    BaseSpecifierAST *base_clause;
    unsigned lbrace_token;
    DeclarationAST *member_specifiers;
    unsigned rbrace_token;

607
public: // annotations
Roberto Raggi's avatar
Roberto Raggi committed
608
    Class *symbol;
609

con's avatar
con committed
610
public:
611
612
613
    virtual ClassSpecifierAST *asClassSpecifier()
    { return this; }

con's avatar
con committed
614
615
616
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

617
618
    virtual ClassSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
619
620
621
622
623
624
625
626
627
628
629
630
631
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT CaseStatementAST: public StatementAST
{
public:
    unsigned case_token;
    ExpressionAST *expression;
    unsigned colon_token;
    StatementAST *statement;

public:
632
633
634
    virtual CaseStatementAST *asCaseStatement()
    { return this; }

con's avatar
con committed
635
636
637
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

638
639
    virtual CaseStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
640
641
642
643
644
645
646
647
648
649
650
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT CompoundStatementAST: public StatementAST
{
public:
    unsigned lbrace_token;
    StatementAST *statements;
    unsigned rbrace_token;

651
652
653
public: // annotations
    Block *symbol;

con's avatar
con committed
654
public:
655
656
657
    virtual CompoundStatementAST *asCompoundStatement()
    { return this; }

con's avatar
con committed
658
659
660
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

661
662
    virtual CompoundStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
663
664
665
666
667
668
669
670
671
672
673
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ConditionAST: public ExpressionAST
{
public:
    SpecifierAST *type_specifier;
    DeclaratorAST *declarator;

public:
674
675
676
    virtual ConditionAST *asCondition()
    { return this; }

con's avatar
con committed
677
678
679
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

680
681
    virtual ConditionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
682
683
684
685
686
687
688
689
690
691
692
693
694
695
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ConditionalExpressionAST: public ExpressionAST
{
public:
    ExpressionAST *condition;
    unsigned question_token;
    ExpressionAST *left_expression;
    unsigned colon_token;
    ExpressionAST *right_expression;

public:
696
697
698
    virtual ConditionalExpressionAST *asConditionalExpression()
    { return this; }

con's avatar
con committed
699
700
701
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

702
703
    virtual ConditionalExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT CppCastExpressionAST: public ExpressionAST
{
public:
    unsigned cast_token;
    unsigned less_token;
    ExpressionAST *type_id;
    unsigned greater_token;
    unsigned lparen_token;
    ExpressionAST *expression;
    unsigned rparen_token;

public:
720
721
722
    virtual CppCastExpressionAST *asCppCastExpression()
    { return this; }

con's avatar
con committed
723
724
725
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

726
727
    virtual CppCastExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
728
729
730
731
732
733
734
735
736
737
738
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT CtorInitializerAST: public AST
{
public:
    unsigned colon_token;
    MemInitializerAST *member_initializers;

public:
739
740
741
    virtual CtorInitializerAST *asCtorInitializer()
    { return this; }

con's avatar
con committed
742
743
744
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

745
746
    virtual CtorInitializerAST *clone(MemoryPool *pool) const;

con's avatar
con committed
747
748
749
750
751
752
753
754
755
756
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DeclarationStatementAST: public StatementAST
{
public:
    DeclarationAST *declaration;

public:
757
758
759
    virtual DeclarationStatementAST *asDeclarationStatement()
    { return this; }

con's avatar
con committed
760
761
762
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

763
764
    virtual DeclarationStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
765
766
767
768
769
770
771
772
773
774
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DeclaratorIdAST: public CoreDeclaratorAST
{
public:
    NameAST *name;

public:
775
776
777
    virtual DeclaratorIdAST *asDeclaratorId()
    { return this; }

con's avatar
con committed
778
779
780
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

781
782
    virtual DeclaratorIdAST *clone(MemoryPool *pool) const;

con's avatar
con committed
783
784
785
786
787
788
789
790
791
792
793
794
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NestedDeclaratorAST: public CoreDeclaratorAST
{
public:
    unsigned lparen_token;
    DeclaratorAST *declarator;
    unsigned rparen_token;

public:
795
796
797
    virtual NestedDeclaratorAST *asNestedDeclarator()
    { return this; }

con's avatar
con committed
798
799
800
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

801
802
    virtual NestedDeclaratorAST *clone(MemoryPool *pool) const;

con's avatar
con committed
803
804
805
806
807
808
809
810
811
812
813
814
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT FunctionDeclaratorAST: public PostfixDeclaratorAST
{
public:
    unsigned lparen_token;
    ParameterDeclarationClauseAST *parameters;
    unsigned rparen_token;
    SpecifierAST *cv_qualifier_seq;
    ExceptionSpecificationAST *exception_specification;
815
    ExpressionAST *as_cpp_initializer;
con's avatar
con committed
816

Roberto Raggi's avatar
Roberto Raggi committed
817
818
819
public: // annotations
    Function *symbol;

con's avatar
con committed
820
public:
821
822
823
    virtual FunctionDeclaratorAST *asFunctionDeclarator()
    { return this; }

con's avatar
con committed
824
825
826
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

827
828
    virtual FunctionDeclaratorAST *clone(MemoryPool *pool) const;

con's avatar
con committed
829
830
831
832
833
834
835
836
837
838
839
840
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ArrayDeclaratorAST: public PostfixDeclaratorAST
{
public:
    unsigned lbracket_token;
    ExpressionAST *expression;
    unsigned rbracket_token;

public:
841
842
843
    virtual ArrayDeclaratorAST *asArrayDeclarator()
    { return this; }

con's avatar
con committed
844
845
846
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

847
848
    virtual ArrayDeclaratorAST *clone(MemoryPool *pool) const;

con's avatar
con committed
849
850
851
852
853
854
855
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DeclaratorListAST: public AST
{
public:
856
    unsigned comma_token;
con's avatar
con committed
857
858
859
860
    DeclaratorAST *declarator;
    DeclaratorListAST *next;

public:
861
862
863
    virtual DeclaratorListAST *asDeclaratorList()
    { return this; }

con's avatar
con committed
864
865
866
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

867
868
    virtual DeclaratorListAST *clone(MemoryPool *pool) const;

con's avatar
con committed
869
870
871
872
873
874
875
876
877
878
879
880
881
882
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DeleteExpressionAST: public ExpressionAST
{
public:
    unsigned scope_token;
    unsigned delete_token;
    unsigned lbracket_token;
    unsigned rbracket_token;
    ExpressionAST *expression;

public:
883
884
885
    virtual DeleteExpressionAST *asDeleteExpression()
    { return this; }

con's avatar
con committed
886
887
888
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

889
890
    virtual DeleteExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DoStatementAST: public StatementAST
{
public:
    unsigned do_token;
    StatementAST *statement;
    unsigned while_token;
    unsigned lparen_token;
    ExpressionAST *expression;
    unsigned rparen_token;
    unsigned semicolon_token;

public:
907
908
909
    virtual DoStatementAST *asDoStatement()
    { return this; }

con's avatar
con committed
910
911
912
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

913
914
    virtual DoStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
915
916
917
918
919
920
921
922
923
924
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NamedTypeSpecifierAST: public SpecifierAST
{
public:
    NameAST *name;

public:
925
926
927
    virtual NamedTypeSpecifierAST *asNamedTypeSpecifier()
    { return this; }

con's avatar
con committed
928
929
930
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

931
932
    virtual NamedTypeSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
933
934
935
936
937
938
939
940
941
942
943
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ElaboratedTypeSpecifierAST: public SpecifierAST
{
public:
    unsigned classkey_token;
    NameAST *name;

public:
944
945
946
    virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier()
    { return this; }

con's avatar
con committed
947
948
949
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

950
951
    virtual ElaboratedTypeSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
952
953
954
955
956
957
958
959
960
961
962
963
964
965
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT EnumSpecifierAST: public SpecifierAST
{
public:
    unsigned enum_token;
    NameAST *name;
    unsigned lbrace_token;
    EnumeratorAST *enumerators;
    unsigned rbrace_token;

public:
966
967
968
    virtual EnumSpecifierAST *asEnumSpecifier()
    { return this; }

con's avatar
con committed
969
970
971
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

972
973
    virtual EnumSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
974
975
976
977
978
979
980
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT EnumeratorAST: public AST
{
public:
981
    unsigned comma_token;
con's avatar
con committed
982
983
984
985
986
987
    unsigned identifier_token;
    unsigned equal_token;
    ExpressionAST *expression;
    EnumeratorAST *next;

public:
988
989
990
    virtual EnumeratorAST *asEnumerator()
    { return this; }

con's avatar
con committed
991
992
993
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

994
995
    virtual EnumeratorAST *clone(MemoryPool *pool) const;

con's avatar
con committed
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ExceptionDeclarationAST: public DeclarationAST
{
public:
    SpecifierAST *type_specifier;
    DeclaratorAST *declarator;
    unsigned dot_dot_dot_token;

public:
1008
1009
1010
    virtual ExceptionDeclarationAST *asExceptionDeclaration()
    { return this; }

con's avatar
con committed
1011
1012
1013
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1014
1015
    virtual ExceptionDeclarationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ExceptionSpecificationAST: public AST
{
public:
    unsigned throw_token;
    unsigned lparen_token;
    unsigned dot_dot_dot_token;
    ExpressionListAST *type_ids;
    unsigned rparen_token;

public:
1030
1031
1032
    virtual ExceptionSpecificationAST *asExceptionSpecification()
    { return this; }

con's avatar
con committed
1033
1034
1035
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1036
1037
    virtual ExceptionSpecificationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ExpressionOrDeclarationStatementAST: public StatementAST
{
public:
    StatementAST *expression;
    StatementAST *declaration;

public:
1049
1050
1051
    virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement()
    { return this; }

con's avatar
con committed
1052
1053
1054
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1055
1056
    virtual ExpressionOrDeclarationStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ExpressionStatementAST: public StatementAST
{
public:
    ExpressionAST *expression;
    unsigned semicolon_token;

public:
1068
1069
1070
    virtual ExpressionStatementAST *asExpressionStatement()
    { return this; }

con's avatar
con committed
1071
1072
1073
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1074
1075
    virtual ExpressionStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1076
1077
1078
1079
1080
1081
1082
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT FunctionDefinitionAST: public DeclarationAST
{
public:
1083
    unsigned qt_invokable_token;
con's avatar
con committed
1084
1085
1086
1087
1088
    SpecifierAST *decl_specifier_seq;
    DeclaratorAST *declarator;
    CtorInitializerAST *ctor_initializer;
    StatementAST *function_body;

Roberto Raggi's avatar
Roberto Raggi committed
1089
1090
1091
public: // annotations
    Function *symbol;

con's avatar
con committed
1092
public:
1093
1094
1095
    virtual FunctionDefinitionAST *asFunctionDefinition()
    { return this; }

con's avatar
con committed
1096
1097
1098
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1099
1100
    virtual FunctionDefinitionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ForStatementAST: public StatementAST
{
public:
    unsigned for_token;
    unsigned lparen_token;
    StatementAST *initializer;
    ExpressionAST *condition;
    unsigned semicolon_token;
    ExpressionAST *expression;
    unsigned rparen_token;
    StatementAST *statement;

1117
1118
1119
public: // annotations
    Block *symbol;

con's avatar
con committed
1120
public:
1121
1122
1123
    virtual ForStatementAST *asForStatement()
    { return this; }

con's avatar
con committed
1124
1125
1126
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1127
1128
    virtual ForStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT IfStatementAST: public StatementAST
{
public:
    unsigned if_token;
    unsigned lparen_token;
    ExpressionAST *condition;
    unsigned rparen_token;
    StatementAST *statement;
    unsigned else_token;
    StatementAST *else_statement;

1144
1145
1146
public: // annotations
    Block *symbol;

con's avatar
con committed
1147
public:
1148
1149
1150
    virtual IfStatementAST *asIfStatement()
    { return this; }

con's avatar
con committed
1151
1152
1153
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1154
1155
    virtual IfStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ArrayInitializerAST: public ExpressionAST
{
public:
    unsigned lbrace_token;
    ExpressionListAST *expression_list;
    unsigned rbrace_token;

public:
1168
1169
1170
    virtual ArrayInitializerAST *asArrayInitializer()
    { return this; }

con's avatar
con committed
1171
1172
1173
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1174
1175
    virtual ArrayInitializerAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT LabeledStatementAST: public StatementAST
{
public:
    unsigned label_token;
    unsigned colon_token;
    StatementAST *statement;

public:
1188
1189
1190
    virtual LabeledStatementAST *asLabeledStatement()
    { return this; }

con's avatar
con committed
1191
1192
1193
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1194
1195
    virtual LabeledStatementAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT LinkageBodyAST: public DeclarationAST
{
public:
    unsigned lbrace_token;
    DeclarationAST *declarations;
    unsigned rbrace_token;

public:
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1211
1212
    virtual LinkageBodyAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1213
1214
1215
1216
1217
1218
1219
1220
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
{
public:
    unsigned extern_token;
Roberto Raggi's avatar
cleanup    
Roberto Raggi committed
1221
    unsigned extern_type_token;
con's avatar
con committed
1222
1223
1224
    DeclarationAST *declaration;

public:
1225
1226
1227
    virtual LinkageSpecificationAST *asLinkageSpecification()
    { return this; }

con's avatar
con committed
1228
1229
1230
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1231
1232
    virtual LinkageSpecificationAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1233
1234
1235
1236
1237
1238
1239
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT MemInitializerAST: public AST
{
public:
1240
    unsigned comma_token;
con's avatar
con committed
1241
1242
1243
1244
1245
1246
1247
    NameAST *name;
    unsigned lparen_token;
    ExpressionAST *expression;
    unsigned rparen_token;
    MemInitializerAST *next;

public:
1248
1249
1250
    virtual MemInitializerAST *asMemInitializer()
    { return this; }

con's avatar
con committed
1251
1252
1253
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1254
1255
    virtual MemInitializerAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1256
1257
1258
1259
1260
1261
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NameAST: public ExpressionAST
{
Roberto Raggi's avatar
Roberto Raggi committed
1262
1263
1264
public: // annotations
    Name *name;

Roberto Raggi's avatar
Roberto Raggi committed
1265
1266
    virtual NameAST *asName() { return this; }

con's avatar
con committed
1267
public:
1268
    virtual NameAST *clone(MemoryPool *pool) const = 0;
con's avatar
con committed
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
};

class CPLUSPLUS_EXPORT NestedNameSpecifierAST: public AST
{
public:
    NameAST *class_or_namespace_name;
    unsigned scope_token;
    NestedNameSpecifierAST *next;

public:
1279
1280
1281
    virtual NestedNameSpecifierAST *asNestedNameSpecifier()
    { return this; }

con's avatar
con committed
1282
1283
1284
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1285
1286
    virtual NestedNameSpecifierAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT QualifiedNameAST: public NameAST
{
public:
    unsigned global_scope_token;
    NestedNameSpecifierAST *nested_name_specifier;
    NameAST *unqualified_name;

public:
1299
1300
1301
    virtual QualifiedNameAST *asQualifiedName()
    { return this; }

con's avatar
con committed
1302
1303
1304
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1305
1306
    virtual QualifiedNameAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT OperatorFunctionIdAST: public NameAST
{
public:
    unsigned operator_token;
    OperatorAST *op;

public:
1318
1319
1320
    virtual OperatorFunctionIdAST *asOperatorFunctionId()
    { return this; }

con's avatar
con committed
1321
1322
1323
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1324
1325
    virtual OperatorFunctionIdAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT ConversionFunctionIdAST: public NameAST
{
public:
    unsigned operator_token;
    SpecifierAST *type_specifier;
    PtrOperatorAST *ptr_operators;

public:
1338
1339
1340
    virtual ConversionFunctionIdAST *asConversionFunctionId()
    { return this; }

con's avatar
con committed
1341
1342
1343
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1344
1345
    virtual ConversionFunctionIdAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT SimpleNameAST: public NameAST
{
public:
    unsigned identifier_token;

public:
1356
1357
1358
    virtual SimpleNameAST *asSimpleName()
    { return this; }

con's avatar
con committed
1359
1360
1361
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1362
1363
    virtual SimpleNameAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT DestructorNameAST: public NameAST
{
public:
    unsigned tilde_token;
    unsigned identifier_token;

public:
1375
1376
1377
    virtual DestructorNameAST *asDestructorName()
    { return this; }

con's avatar
con committed
1378
1379
1380
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1381
1382
    virtual DestructorNameAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT TemplateIdAST: public NameAST
{
public:
    unsigned identifier_token;
    unsigned less_token;
    TemplateArgumentListAST *template_arguments;
    unsigned greater_token;

public:
1396
1397
1398
    virtual TemplateIdAST *asTemplateId()
    { return this; }

con's avatar
con committed
1399
1400
1401
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1402
1403
    virtual TemplateIdAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NamespaceAST: public DeclarationAST
{
public:
    unsigned namespace_token;
    unsigned identifier_token;
    SpecifierAST *attributes;
    DeclarationAST *linkage_body;

Roberto Raggi's avatar
Roberto Raggi committed
1416
public: // annotations
Roberto Raggi's avatar
Roberto Raggi committed
1417
    Namespace *symbol;
Roberto Raggi's avatar
Roberto Raggi committed
1418

con's avatar
con committed
1419
public:
1420
1421
1422
    virtual NamespaceAST *asNamespace()
    { return this; }

con's avatar
con committed
1423
1424
1425
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1426
1427
    virtual NamespaceAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1428
1429
1430
1431
1432
1433
1434
1435
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
{
public:
    unsigned namespace_token;
Roberto Raggi's avatar
cleanup    
Roberto Raggi committed
1436
    unsigned namespace_name_token;
con's avatar
con committed
1437
1438
1439
1440
1441
    unsigned equal_token;
    NameAST *name;
    unsigned semicolon_token;

public:
1442
1443
1444
    virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition()
    { return this; }

con's avatar
con committed
1445
1446
1447
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1448
1449
    virtual NamespaceAliasDefinitionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1450
1451
1452
1453
protected:
    virtual void accept0(ASTVisitor *visitor);
};

1454
class CPLUSPLUS_EXPORT NewPlacementAST: public AST
con's avatar
con committed
1455
1456
{
public:
1457
1458
1459
    unsigned lparen_token;
    ExpressionListAST *expression_list;
    unsigned rparen_token;
con's avatar
con committed
1460
1461

public:
1462
    virtual NewPlacementAST *asNewPlacement()
1463
1464
    { return this; }

con's avatar
con committed
1465
1466
1467
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
    virtual NewPlacementAST *clone(MemoryPool *pool) const;

protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NewArrayDeclaratorAST: public AST
{
public:
    unsigned lbracket_token;
    ExpressionAST *expression;
    unsigned rbracket_token;
    NewArrayDeclaratorAST *next;

public:
    virtual NewArrayDeclaratorAST *asNewArrayDeclarator()
    { return this; }

    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

    virtual NewArrayDeclaratorAST *clone(MemoryPool *pool) const;
1490

con's avatar
con committed
1491
1492
1493
1494
1495
1496
1497
1498
1499
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
{
public:
    unsigned scope_token;
    unsigned new_token;
1500
1501
1502
    NewPlacementAST *new_placement;

    unsigned lparen_token;
con's avatar
con committed
1503
    ExpressionAST *type_id;
1504
1505
    unsigned rparen_token;

con's avatar
con committed
1506
    NewTypeIdAST *new_type_id;
1507

con's avatar
con committed
1508
1509
1510
    NewInitializerAST *new_initializer;

public:
1511
1512
1513
    virtual NewExpressionAST *asNewExpression()
    { return this; }

con's avatar
con committed
1514
1515
1516
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1517
1518
    virtual NewExpressionAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NewInitializerAST: public AST
{
public:
    unsigned lparen_token;
    ExpressionAST *expression;
    unsigned rparen_token;

public:
1531
1532
1533
    virtual NewInitializerAST *asNewInitializer()
    { return this; }

con's avatar
con committed
1534
1535
1536
    virtual unsigned firstToken() const;
    virtual unsigned lastToken() const;

1537
1538
    virtual NewInitializerAST *clone(MemoryPool *pool) const;

con's avatar
con committed
1539
1540
1541
1542
1543
1544
1545
1546
protected:
    virtual void accept0(ASTVisitor *visitor);
};

class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
{
public:
    SpecifierAST *type_specifier;