1 // Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20
21 #pragma once
22
23 #include "CPlusPlusForwardDeclarations.h"
24 #include "ASTfwd.h"
25 #include "MemoryPool.h"
26
27 namespace CPlusPlus {
28
29 // clang-cl needs an export for the subclass, while msvc fails to build in debug mode if
30 // the export is present.
31 #if defined(Q_CC_CLANG) && defined(Q_CC_MSVC)
32 #define CPLUSPLUS_EXPORT_SUBCLASS CPLUSPLUS_EXPORT
33 #else
34 #define CPLUSPLUS_EXPORT_SUBCLASS
35 #endif
36
37 template <typename Tptr>
38 class CPLUSPLUS_EXPORT List: public Managed
39 {
40 List(const List &other);
41 void operator =(const List &other);
42
43 public:
List()44 List()
45 : value(Tptr()), next(0)
46 { }
47
List(const Tptr & value)48 List(const Tptr &value)
49 : value(value), next(0)
50 { }
51
firstToken()52 int firstToken() const
53 {
54 if (value)
55 return value->firstToken();
56
57 // ### CPP_CHECK(0);
58 return 0;
59 }
60
lastToken()61 int lastToken() const
62 {
63 Tptr lv = lastValue();
64
65 if (lv)
66 return lv->lastToken();
67
68 // ### CPP_CHECK(0);
69 return 0;
70 }
71
lastValue()72 Tptr lastValue() const
73 {
74 Tptr lastValue = 0;
75
76 for (const List *it = this; it; it = it->next) {
77 if (it->value)
78 lastValue = it->value;
79 }
80
81 return lastValue;
82 }
83
84 Tptr value;
85 List *next;
86
87 class CPLUSPLUS_EXPORT_SUBCLASS ListIterator
88 {
89 List<Tptr> *iter;
90
91 public:
ListIterator(List<Tptr> * iter)92 ListIterator(List<Tptr> *iter)
93 : iter(iter)
94 {}
95 Tptr operator*() { return iter->value; }
96 ListIterator &operator++()
97 {
98 if (iter)
99 iter = iter->next;
100 return *this;
101 }
102 bool operator==(const ListIterator &other) { return iter == other.iter; }
103 bool operator!=(const ListIterator &other) { return iter != other.iter; }
104 };
begin()105 ListIterator begin() { return {this}; }
end()106 ListIterator end() { return {nullptr}; }
107
size()108 int size() { return next ? next->size() + 1 : 1; }
109 };
110
111 template<typename Tptr>
begin(List<Tptr> * list)112 typename List<Tptr>::ListIterator begin(List<Tptr> *list)
113 {
114 return list ? list->begin() : typename List<Tptr>::ListIterator(nullptr);
115 }
116
117 template<typename Tptr>
end(List<Tptr> * list)118 typename List<Tptr>::ListIterator end(List<Tptr> *list)
119 {
120 return list ? list->end() : typename List<Tptr>::ListIterator(nullptr);
121 }
122
123 template<typename Tptr>
size(List<Tptr> * list)124 int size(List<Tptr> *list)
125 {
126 if (list)
127 return list->size();
128 return 0;
129 }
130
131 class CPLUSPLUS_EXPORT AST: public Managed
132 {
133 AST(const AST &other);
134 void operator =(const AST &other);
135
136 public:
137 AST();
138 virtual ~AST();
139
140 void accept(ASTVisitor *visitor);
141
accept(AST * ast,ASTVisitor * visitor)142 static void accept(AST *ast, ASTVisitor *visitor)
143 { if (ast) ast->accept(visitor); }
144
145 template <typename Tptr>
accept(List<Tptr> * it,ASTVisitor * visitor)146 static void accept(List<Tptr> *it, ASTVisitor *visitor)
147 {
148 for (; it; it = it->next)
149 accept(it->value, visitor);
150 }
151
152 static bool match(AST *ast, AST *pattern, ASTMatcher *matcher);
153 bool match(AST *pattern, ASTMatcher *matcher);
154
155 template <typename Tptr>
match(List<Tptr> * it,List<Tptr> * patternIt,ASTMatcher * matcher)156 static bool match(List<Tptr> *it, List<Tptr> *patternIt, ASTMatcher *matcher)
157 {
158 while (it && patternIt) {
159 if (! match(it->value, patternIt->value, matcher))
160 return false;
161
162 it = it->next;
163 patternIt = patternIt->next;
164 }
165
166 if (! it && ! patternIt)
167 return true;
168
169 return false;
170 }
171
172 virtual int firstToken() const = 0;
173 virtual int lastToken() const = 0;
174
175 virtual AST *clone(MemoryPool *pool) const = 0;
176
asAccessDeclaration()177 virtual AccessDeclarationAST *asAccessDeclaration() { return nullptr; }
asAliasDeclaration()178 virtual AliasDeclarationAST *asAliasDeclaration() { return nullptr; }
asAlignmentSpecifier()179 virtual AlignmentSpecifierAST *asAlignmentSpecifier() { return nullptr; }
asAlignofExpression()180 virtual AlignofExpressionAST *asAlignofExpression() { return nullptr; }
asAnonymousName()181 virtual AnonymousNameAST *asAnonymousName() { return nullptr; }
asArrayAccess()182 virtual ArrayAccessAST *asArrayAccess() { return nullptr; }
asArrayDeclarator()183 virtual ArrayDeclaratorAST *asArrayDeclarator() { return nullptr; }
asArrayInitializer()184 virtual ArrayInitializerAST *asArrayInitializer() { return nullptr; }
asAsmDefinition()185 virtual AsmDefinitionAST *asAsmDefinition() { return nullptr; }
asAttributeSpecifier()186 virtual AttributeSpecifierAST *asAttributeSpecifier() { return nullptr; }
asBaseSpecifier()187 virtual BaseSpecifierAST *asBaseSpecifier() { return nullptr; }
asBinaryExpression()188 virtual BinaryExpressionAST *asBinaryExpression() { return nullptr; }
asBoolLiteral()189 virtual BoolLiteralAST *asBoolLiteral() { return nullptr; }
asBracedInitializer()190 virtual BracedInitializerAST *asBracedInitializer() { return nullptr; }
asBracketDesignator()191 virtual BracketDesignatorAST *asBracketDesignator() { return nullptr; }
asBreakStatement()192 virtual BreakStatementAST *asBreakStatement() { return nullptr; }
asCall()193 virtual CallAST *asCall() { return nullptr; }
asCapture()194 virtual CaptureAST *asCapture() { return nullptr; }
asCaseStatement()195 virtual CaseStatementAST *asCaseStatement() { return nullptr; }
asCastExpression()196 virtual CastExpressionAST *asCastExpression() { return nullptr; }
asCatchClause()197 virtual CatchClauseAST *asCatchClause() { return nullptr; }
asClassSpecifier()198 virtual ClassSpecifierAST *asClassSpecifier() { return nullptr; }
asCompoundExpression()199 virtual CompoundExpressionAST *asCompoundExpression() { return nullptr; }
asCompoundLiteral()200 virtual CompoundLiteralAST *asCompoundLiteral() { return nullptr; }
asCompoundStatement()201 virtual CompoundStatementAST *asCompoundStatement() { return nullptr; }
asCondition()202 virtual ConditionAST *asCondition() { return nullptr; }
asConditionalExpression()203 virtual ConditionalExpressionAST *asConditionalExpression() { return nullptr; }
asContinueStatement()204 virtual ContinueStatementAST *asContinueStatement() { return nullptr; }
asConversionFunctionId()205 virtual ConversionFunctionIdAST *asConversionFunctionId() { return nullptr; }
asCoreDeclarator()206 virtual CoreDeclaratorAST *asCoreDeclarator() { return nullptr; }
asCppCastExpression()207 virtual CppCastExpressionAST *asCppCastExpression() { return nullptr; }
asCtorInitializer()208 virtual CtorInitializerAST *asCtorInitializer() { return nullptr; }
asDeclaration()209 virtual DeclarationAST *asDeclaration() { return nullptr; }
asDeclarationStatement()210 virtual DeclarationStatementAST *asDeclarationStatement() { return nullptr; }
asDeclarator()211 virtual DeclaratorAST *asDeclarator() { return nullptr; }
asDeclaratorId()212 virtual DeclaratorIdAST *asDeclaratorId() { return nullptr; }
asDecltypeSpecifier()213 virtual DecltypeSpecifierAST *asDecltypeSpecifier() { return nullptr; }
asDeleteExpression()214 virtual DeleteExpressionAST *asDeleteExpression() { return nullptr; }
asDesignatedInitializer()215 virtual DesignatedInitializerAST *asDesignatedInitializer() { return nullptr; }
asDesignator()216 virtual DesignatorAST *asDesignator() { return nullptr; }
asDestructorName()217 virtual DestructorNameAST *asDestructorName() { return nullptr; }
asDoStatement()218 virtual DoStatementAST *asDoStatement() { return nullptr; }
asDotDesignator()219 virtual DotDesignatorAST *asDotDesignator() { return nullptr; }
asDynamicExceptionSpecification()220 virtual DynamicExceptionSpecificationAST *asDynamicExceptionSpecification() { return nullptr; }
asElaboratedTypeSpecifier()221 virtual ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() { return nullptr; }
asEmptyDeclaration()222 virtual EmptyDeclarationAST *asEmptyDeclaration() { return nullptr; }
asEnumSpecifier()223 virtual EnumSpecifierAST *asEnumSpecifier() { return nullptr; }
asEnumerator()224 virtual EnumeratorAST *asEnumerator() { return nullptr; }
asExceptionDeclaration()225 virtual ExceptionDeclarationAST *asExceptionDeclaration() { return nullptr; }
asExceptionSpecification()226 virtual ExceptionSpecificationAST *asExceptionSpecification() { return nullptr; }
asExpression()227 virtual ExpressionAST *asExpression() { return nullptr; }
asExpressionListParen()228 virtual ExpressionListParenAST *asExpressionListParen() { return nullptr; }
asExpressionOrDeclarationStatement()229 virtual ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() { return nullptr; }
asExpressionStatement()230 virtual ExpressionStatementAST *asExpressionStatement() { return nullptr; }
asForStatement()231 virtual ForStatementAST *asForStatement() { return nullptr; }
asForeachStatement()232 virtual ForeachStatementAST *asForeachStatement() { return nullptr; }
asFunctionDeclarator()233 virtual FunctionDeclaratorAST *asFunctionDeclarator() { return nullptr; }
asFunctionDefinition()234 virtual FunctionDefinitionAST *asFunctionDefinition() { return nullptr; }
asGnuAttribute()235 virtual GnuAttributeAST *asGnuAttribute() { return nullptr; }
asGnuAttributeSpecifier()236 virtual GnuAttributeSpecifierAST *asGnuAttributeSpecifier() { return nullptr; }
asGotoStatement()237 virtual GotoStatementAST *asGotoStatement() { return nullptr; }
asIdExpression()238 virtual IdExpressionAST *asIdExpression() { return nullptr; }
asIfStatement()239 virtual IfStatementAST *asIfStatement() { return nullptr; }
asLabeledStatement()240 virtual LabeledStatementAST *asLabeledStatement() { return nullptr; }
asLambdaCapture()241 virtual LambdaCaptureAST *asLambdaCapture() { return nullptr; }
asLambdaDeclarator()242 virtual LambdaDeclaratorAST *asLambdaDeclarator() { return nullptr; }
asLambdaExpression()243 virtual LambdaExpressionAST *asLambdaExpression() { return nullptr; }
asLambdaIntroducer()244 virtual LambdaIntroducerAST *asLambdaIntroducer() { return nullptr; }
asLinkageBody()245 virtual LinkageBodyAST *asLinkageBody() { return nullptr; }
asLinkageSpecification()246 virtual LinkageSpecificationAST *asLinkageSpecification() { return nullptr; }
asMemInitializer()247 virtual MemInitializerAST *asMemInitializer() { return nullptr; }
asMemberAccess()248 virtual MemberAccessAST *asMemberAccess() { return nullptr; }
asMsvcDeclspecSpecifier()249 virtual MsvcDeclspecSpecifierAST *asMsvcDeclspecSpecifier() { return nullptr; }
asName()250 virtual NameAST *asName() { return nullptr; }
asNamedTypeSpecifier()251 virtual NamedTypeSpecifierAST *asNamedTypeSpecifier() { return nullptr; }
asNamespace()252 virtual NamespaceAST *asNamespace() { return nullptr; }
asNamespaceAliasDefinition()253 virtual NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() { return nullptr; }
asNestedDeclarator()254 virtual NestedDeclaratorAST *asNestedDeclarator() { return nullptr; }
asNestedExpression()255 virtual NestedExpressionAST *asNestedExpression() { return nullptr; }
asNestedNameSpecifier()256 virtual NestedNameSpecifierAST *asNestedNameSpecifier() { return nullptr; }
asNewArrayDeclarator()257 virtual NewArrayDeclaratorAST *asNewArrayDeclarator() { return nullptr; }
asNewExpression()258 virtual NewExpressionAST *asNewExpression() { return nullptr; }
asNewTypeId()259 virtual NewTypeIdAST *asNewTypeId() { return nullptr; }
asNoExceptOperatorExpression()260 virtual NoExceptOperatorExpressionAST *asNoExceptOperatorExpression() { return nullptr; }
asNoExceptSpecification()261 virtual NoExceptSpecificationAST *asNoExceptSpecification() { return nullptr; }
asNumericLiteral()262 virtual NumericLiteralAST *asNumericLiteral() { return nullptr; }
asObjCClassDeclaration()263 virtual ObjCClassDeclarationAST *asObjCClassDeclaration() { return nullptr; }
asObjCClassForwardDeclaration()264 virtual ObjCClassForwardDeclarationAST *asObjCClassForwardDeclaration() { return nullptr; }
asObjCDynamicPropertiesDeclaration()265 virtual ObjCDynamicPropertiesDeclarationAST *asObjCDynamicPropertiesDeclaration() { return nullptr; }
asObjCEncodeExpression()266 virtual ObjCEncodeExpressionAST *asObjCEncodeExpression() { return nullptr; }
asObjCFastEnumeration()267 virtual ObjCFastEnumerationAST *asObjCFastEnumeration() { return nullptr; }
asObjCInstanceVariablesDeclaration()268 virtual ObjCInstanceVariablesDeclarationAST *asObjCInstanceVariablesDeclaration() { return nullptr; }
asObjCMessageArgument()269 virtual ObjCMessageArgumentAST *asObjCMessageArgument() { return nullptr; }
asObjCMessageArgumentDeclaration()270 virtual ObjCMessageArgumentDeclarationAST *asObjCMessageArgumentDeclaration() { return nullptr; }
asObjCMessageExpression()271 virtual ObjCMessageExpressionAST *asObjCMessageExpression() { return nullptr; }
asObjCMethodDeclaration()272 virtual ObjCMethodDeclarationAST *asObjCMethodDeclaration() { return nullptr; }
asObjCMethodPrototype()273 virtual ObjCMethodPrototypeAST *asObjCMethodPrototype() { return nullptr; }
asObjCPropertyAttribute()274 virtual ObjCPropertyAttributeAST *asObjCPropertyAttribute() { return nullptr; }
asObjCPropertyDeclaration()275 virtual ObjCPropertyDeclarationAST *asObjCPropertyDeclaration() { return nullptr; }
asObjCProtocolDeclaration()276 virtual ObjCProtocolDeclarationAST *asObjCProtocolDeclaration() { return nullptr; }
asObjCProtocolExpression()277 virtual ObjCProtocolExpressionAST *asObjCProtocolExpression() { return nullptr; }
asObjCProtocolForwardDeclaration()278 virtual ObjCProtocolForwardDeclarationAST *asObjCProtocolForwardDeclaration() { return nullptr; }
asObjCProtocolRefs()279 virtual ObjCProtocolRefsAST *asObjCProtocolRefs() { return nullptr; }
asObjCSelector()280 virtual ObjCSelectorAST *asObjCSelector() { return nullptr; }
asObjCSelectorArgument()281 virtual ObjCSelectorArgumentAST *asObjCSelectorArgument() { return nullptr; }
asObjCSelectorExpression()282 virtual ObjCSelectorExpressionAST *asObjCSelectorExpression() { return nullptr; }
asObjCSynchronizedStatement()283 virtual ObjCSynchronizedStatementAST *asObjCSynchronizedStatement() { return nullptr; }
asObjCSynthesizedPropertiesDeclaration()284 virtual ObjCSynthesizedPropertiesDeclarationAST *asObjCSynthesizedPropertiesDeclaration() { return nullptr; }
asObjCSynthesizedProperty()285 virtual ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() { return nullptr; }
asObjCTypeName()286 virtual ObjCTypeNameAST *asObjCTypeName() { return nullptr; }
asObjCVisibilityDeclaration()287 virtual ObjCVisibilityDeclarationAST *asObjCVisibilityDeclaration() { return nullptr; }
asOperator()288 virtual OperatorAST *asOperator() { return nullptr; }
asOperatorFunctionId()289 virtual OperatorFunctionIdAST *asOperatorFunctionId() { return nullptr; }
asParameterDeclaration()290 virtual ParameterDeclarationAST *asParameterDeclaration() { return nullptr; }
asParameterDeclarationClause()291 virtual ParameterDeclarationClauseAST *asParameterDeclarationClause() { return nullptr; }
asPointer()292 virtual PointerAST *asPointer() { return nullptr; }
asPointerLiteral()293 virtual PointerLiteralAST *asPointerLiteral() { return nullptr; }
asPointerToMember()294 virtual PointerToMemberAST *asPointerToMember() { return nullptr; }
asPostIncrDecr()295 virtual PostIncrDecrAST *asPostIncrDecr() { return nullptr; }
asPostfix()296 virtual PostfixAST *asPostfix() { return nullptr; }
asPostfixDeclarator()297 virtual PostfixDeclaratorAST *asPostfixDeclarator() { return nullptr; }
asPtrOperator()298 virtual PtrOperatorAST *asPtrOperator() { return nullptr; }
asQtEnumDeclaration()299 virtual QtEnumDeclarationAST *asQtEnumDeclaration() { return nullptr; }
asQtFlagsDeclaration()300 virtual QtFlagsDeclarationAST *asQtFlagsDeclaration() { return nullptr; }
asQtInterfaceName()301 virtual QtInterfaceNameAST *asQtInterfaceName() { return nullptr; }
asQtInterfacesDeclaration()302 virtual QtInterfacesDeclarationAST *asQtInterfacesDeclaration() { return nullptr; }
asQtMemberDeclaration()303 virtual QtMemberDeclarationAST *asQtMemberDeclaration() { return nullptr; }
asQtMethod()304 virtual QtMethodAST *asQtMethod() { return nullptr; }
asQtObjectTag()305 virtual QtObjectTagAST *asQtObjectTag() { return nullptr; }
asQtPrivateSlot()306 virtual QtPrivateSlotAST *asQtPrivateSlot() { return nullptr; }
asQtPropertyDeclaration()307 virtual QtPropertyDeclarationAST *asQtPropertyDeclaration() { return nullptr; }
asQtPropertyDeclarationItem()308 virtual QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() { return nullptr; }
asQualifiedName()309 virtual QualifiedNameAST *asQualifiedName() { return nullptr; }
asRangeBasedForStatement()310 virtual RangeBasedForStatementAST *asRangeBasedForStatement() { return nullptr; }
asReference()311 virtual ReferenceAST *asReference() { return nullptr; }
asReturnStatement()312 virtual ReturnStatementAST *asReturnStatement() { return nullptr; }
asSimpleDeclaration()313 virtual SimpleDeclarationAST *asSimpleDeclaration() { return nullptr; }
asSimpleName()314 virtual SimpleNameAST *asSimpleName() { return nullptr; }
asSimpleSpecifier()315 virtual SimpleSpecifierAST *asSimpleSpecifier() { return nullptr; }
asSizeofExpression()316 virtual SizeofExpressionAST *asSizeofExpression() { return nullptr; }
asSpecifier()317 virtual SpecifierAST *asSpecifier() { return nullptr; }
asStatement()318 virtual StatementAST *asStatement() { return nullptr; }
asStaticAssertDeclaration()319 virtual StaticAssertDeclarationAST *asStaticAssertDeclaration() { return nullptr; }
asStdAttributeSpecifier()320 virtual StdAttributeSpecifierAST *asStdAttributeSpecifier() { return nullptr; }
asStringLiteral()321 virtual StringLiteralAST *asStringLiteral() { return nullptr; }
asSwitchStatement()322 virtual SwitchStatementAST *asSwitchStatement() { return nullptr; }
asTemplateDeclaration()323 virtual TemplateDeclarationAST *asTemplateDeclaration() { return nullptr; }
asTemplateId()324 virtual TemplateIdAST *asTemplateId() { return nullptr; }
asTemplateTypeParameter()325 virtual TemplateTypeParameterAST *asTemplateTypeParameter() { return nullptr; }
asThisExpression()326 virtual ThisExpressionAST *asThisExpression() { return nullptr; }
asThrowExpression()327 virtual ThrowExpressionAST *asThrowExpression() { return nullptr; }
asTrailingReturnType()328 virtual TrailingReturnTypeAST *asTrailingReturnType() { return nullptr; }
asTranslationUnit()329 virtual TranslationUnitAST *asTranslationUnit() { return nullptr; }
asTryBlockStatement()330 virtual TryBlockStatementAST *asTryBlockStatement() { return nullptr; }
asTypeConstructorCall()331 virtual TypeConstructorCallAST *asTypeConstructorCall() { return nullptr; }
asTypeId()332 virtual TypeIdAST *asTypeId() { return nullptr; }
asTypeidExpression()333 virtual TypeidExpressionAST *asTypeidExpression() { return nullptr; }
asTypenameCallExpression()334 virtual TypenameCallExpressionAST *asTypenameCallExpression() { return nullptr; }
asTypenameTypeParameter()335 virtual TypenameTypeParameterAST *asTypenameTypeParameter() { return nullptr; }
asTypeofSpecifier()336 virtual TypeofSpecifierAST *asTypeofSpecifier() { return nullptr; }
asUnaryExpression()337 virtual UnaryExpressionAST *asUnaryExpression() { return nullptr; }
asUsing()338 virtual UsingAST *asUsing() { return nullptr; }
asUsingDirective()339 virtual UsingDirectiveAST *asUsingDirective() { return nullptr; }
asWhileStatement()340 virtual WhileStatementAST *asWhileStatement() { return nullptr; }
341
342 protected:
343 virtual void accept0(ASTVisitor *visitor) = 0;
344 virtual bool match0(AST *, ASTMatcher *) = 0;
345 };
346
347 class CPLUSPLUS_EXPORT StatementAST: public AST
348 {
349 public:
asStatement()350 StatementAST *asStatement() override { return this; }
351
352 StatementAST *clone(MemoryPool *pool) const override = 0;
353 };
354
355 class CPLUSPLUS_EXPORT ExpressionAST: public AST
356 {
357 public:
asExpression()358 ExpressionAST *asExpression() override { return this; }
359
360 ExpressionAST *clone(MemoryPool *pool) const override = 0;
361 };
362
363 class CPLUSPLUS_EXPORT DeclarationAST: public AST
364 {
365 public:
asDeclaration()366 DeclarationAST *asDeclaration() override { return this; }
367
368 DeclarationAST *clone(MemoryPool *pool) const override = 0;
369 };
370
371 class CPLUSPLUS_EXPORT NameAST: public AST
372 {
373 public: // annotations
374 const Name *name = nullptr;
375
376 public:
asName()377 NameAST *asName() override { return this; }
378
379 NameAST *clone(MemoryPool *pool) const override = 0;
380 };
381
382 class CPLUSPLUS_EXPORT SpecifierAST: public AST
383 {
384 public:
asSpecifier()385 SpecifierAST *asSpecifier() override { return this; }
386
387 SpecifierAST *clone(MemoryPool *pool) const override = 0;
388 };
389
390 class CPLUSPLUS_EXPORT PtrOperatorAST: public AST
391 {
392 public:
asPtrOperator()393 PtrOperatorAST *asPtrOperator() override { return this; }
394
395 PtrOperatorAST *clone(MemoryPool *pool) const override = 0;
396 };
397
398 class CPLUSPLUS_EXPORT PostfixAST: public ExpressionAST
399 {
400 public:
asPostfix()401 PostfixAST *asPostfix() override { return this; }
402
403 PostfixAST *clone(MemoryPool *pool) const override = 0;
404 };
405
406 class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
407 {
408 public:
asCoreDeclarator()409 CoreDeclaratorAST *asCoreDeclarator() override { return this; }
410
411 CoreDeclaratorAST *clone(MemoryPool *pool) const override = 0;
412 };
413
414 class CPLUSPLUS_EXPORT PostfixDeclaratorAST: public AST
415 {
416 public:
asPostfixDeclarator()417 PostfixDeclaratorAST *asPostfixDeclarator() override { return this; }
418
419 PostfixDeclaratorAST *clone(MemoryPool *pool) const override = 0;
420 };
421
422 class CPLUSPLUS_EXPORT ObjCSelectorArgumentAST: public AST
423 {
424 public:
425 int name_token = 0;
426 int colon_token = 0;
427
428 public:
asObjCSelectorArgument()429 ObjCSelectorArgumentAST *asObjCSelectorArgument() override { return this; }
430
431 int firstToken() const override;
432 int lastToken() const override;
433
434 ObjCSelectorArgumentAST *clone(MemoryPool *pool) const override;
435
436 protected:
437 void accept0(ASTVisitor *visitor) override;
438 bool match0(AST *, ASTMatcher *) override;
439 };
440
441 class CPLUSPLUS_EXPORT ObjCSelectorAST: public NameAST
442 {
443 public:
444 ObjCSelectorArgumentListAST *selector_argument_list = nullptr;
445
446 public:
asObjCSelector()447 ObjCSelectorAST *asObjCSelector() override { return this; }
448
449 int firstToken() const override;
450 int lastToken() const override;
451
452 ObjCSelectorAST *clone(MemoryPool *pool) const override;
453
454 protected:
455 void accept0(ASTVisitor *visitor) override;
456 bool match0(AST *, ASTMatcher *) override;
457 };
458
459 class CPLUSPLUS_EXPORT SimpleSpecifierAST: public SpecifierAST
460 {
461 public:
462 int specifier_token = 0;
463
464 public:
asSimpleSpecifier()465 SimpleSpecifierAST *asSimpleSpecifier() override { return this; }
466
467 int firstToken() const override;
468 int lastToken() const override;
469
470 SimpleSpecifierAST *clone(MemoryPool *pool) const override;
471
472 protected:
473 void accept0(ASTVisitor *visitor) override;
474 bool match0(AST *, ASTMatcher *) override;
475 };
476
477 class CPLUSPLUS_EXPORT AttributeSpecifierAST: public SpecifierAST
478 {
479 public:
asAttributeSpecifier()480 AttributeSpecifierAST *asAttributeSpecifier() override { return this; }
481
482 AttributeSpecifierAST *clone(MemoryPool *pool) const override = 0;
483 };
484
485 class CPLUSPLUS_EXPORT AlignmentSpecifierAST: public AttributeSpecifierAST
486 {
487 public:
488 int align_token = 0;
489 int lparen_token = 0;
490 ExpressionAST *typeIdExprOrAlignmentExpr = nullptr;
491 int ellipses_token = 0;
492 int rparen_token = 0;
493
494 public:
asAlignmentSpecifier()495 AlignmentSpecifierAST *asAlignmentSpecifier() override { return this; }
496
497 int firstToken() const override;
498 int lastToken() const override;
499
500 AlignmentSpecifierAST *clone(MemoryPool *pool) const override;
501
502 protected:
503 void accept0(ASTVisitor *visitor) override;
504 bool match0(AST *, ASTMatcher *) override;
505 };
506
507
508 class CPLUSPLUS_EXPORT GnuAttributeSpecifierAST: public AttributeSpecifierAST
509 {
510 public:
511 int attribute_token = 0;
512 int first_lparen_token = 0;
513 int second_lparen_token = 0;
514 GnuAttributeListAST *attribute_list = nullptr;
515 int first_rparen_token = 0;
516 int second_rparen_token = 0;
517
518 public:
asGnuAttributeSpecifier()519 GnuAttributeSpecifierAST *asGnuAttributeSpecifier() override { return this; }
520
521 int firstToken() const override;
522 int lastToken() const override;
523
524 GnuAttributeSpecifierAST *clone(MemoryPool *pool) const override;
525
526 protected:
527 void accept0(ASTVisitor *visitor) override;
528 bool match0(AST *, ASTMatcher *) override;
529 };
530
531 class CPLUSPLUS_EXPORT MsvcDeclspecSpecifierAST: public AttributeSpecifierAST
532 {
533 public:
534 int attribute_token = 0;
535 int lparen_token = 0;
536 GnuAttributeListAST *attribute_list = nullptr;
537 int rparen_token = 0;
538
539 public:
asMsvcDeclspecSpecifier()540 MsvcDeclspecSpecifierAST *asMsvcDeclspecSpecifier() override { return this; }
541
542 int firstToken() const override;
543 int lastToken() const override;
544
545 MsvcDeclspecSpecifierAST *clone(MemoryPool *pool) const override;
546
547 protected:
548 void accept0(ASTVisitor *visitor) override;
549 bool match0(AST *, ASTMatcher *) override;
550 };
551
552 class CPLUSPLUS_EXPORT StdAttributeSpecifierAST: public AttributeSpecifierAST
553 {
554 public:
555 int first_lbracket_token = 0;
556 int second_lbracket_token = 0;
557 GnuAttributeListAST *attribute_list = nullptr;
558 int first_rbracket_token = 0;
559 int second_rbracket_token = 0;
560
561 public:
asStdAttributeSpecifier()562 StdAttributeSpecifierAST *asStdAttributeSpecifier() override { return this; }
563
564 int firstToken() const override;
565 int lastToken() const override;
566
567 StdAttributeSpecifierAST *clone(MemoryPool *pool) const override;
568
569 protected:
570 void accept0(ASTVisitor *visitor) override;
571 bool match0(AST *, ASTMatcher *) override;
572 };
573
574 class CPLUSPLUS_EXPORT GnuAttributeAST: public AST
575 {
576 public:
577 int identifier_token = 0;
578 int lparen_token = 0;
579 int tag_token = 0;
580 ExpressionListAST *expression_list = nullptr;
581 int rparen_token = 0;
582
583 public:
asGnuAttribute()584 GnuAttributeAST *asGnuAttribute() override { return this; }
585
586 int firstToken() const override;
587 int lastToken() const override;
588
589 GnuAttributeAST *clone(MemoryPool *pool) const override;
590
591 protected:
592 void accept0(ASTVisitor *visitor) override;
593 bool match0(AST *, ASTMatcher *) override;
594 };
595
596 class CPLUSPLUS_EXPORT TypeofSpecifierAST: public SpecifierAST
597 {
598 public:
599 int typeof_token = 0;
600 int lparen_token = 0;
601 ExpressionAST *expression = nullptr;
602 int rparen_token = 0;
603
604 public:
asTypeofSpecifier()605 TypeofSpecifierAST *asTypeofSpecifier() override { return this; }
606
607 int firstToken() const override;
608 int lastToken() const override;
609
610 TypeofSpecifierAST *clone(MemoryPool *pool) const override;
611
612 protected:
613 void accept0(ASTVisitor *visitor) override;
614 bool match0(AST *, ASTMatcher *) override;
615 };
616
617 class CPLUSPLUS_EXPORT DecltypeSpecifierAST: public SpecifierAST
618 {
619 public:
620 int decltype_token = 0;
621 int lparen_token = 0;
622 ExpressionAST *expression = nullptr;
623 int rparen_token = 0;
624
625 public:
asDecltypeSpecifier()626 DecltypeSpecifierAST *asDecltypeSpecifier() override { return this; }
627
628 int firstToken() const override;
629 int lastToken() const override;
630
631 DecltypeSpecifierAST *clone(MemoryPool *pool) const override;
632
633 protected:
634 void accept0(ASTVisitor *visitor) override;
635 bool match0(AST *, ASTMatcher *) override;
636 };
637
638 class CPLUSPLUS_EXPORT DeclaratorAST: public AST
639 {
640 public:
641 SpecifierListAST *attribute_list = nullptr;
642 PtrOperatorListAST *ptr_operator_list = nullptr;
643 CoreDeclaratorAST *core_declarator = nullptr;
644 PostfixDeclaratorListAST *postfix_declarator_list = nullptr;
645 SpecifierListAST *post_attribute_list = nullptr;
646 int equal_token = 0;
647 ExpressionAST *initializer = nullptr;
648
649 public:
asDeclarator()650 DeclaratorAST *asDeclarator() override { return this; }
651
652 int firstToken() const override;
653 int lastToken() const override;
654
655 DeclaratorAST *clone(MemoryPool *pool) const override;
656
657 protected:
658 void accept0(ASTVisitor *visitor) override;
659 bool match0(AST *, ASTMatcher *) override;
660 };
661
662 class CPLUSPLUS_EXPORT SimpleDeclarationAST: public DeclarationAST
663 {
664 public:
665 int qt_invokable_token = 0;
666 SpecifierListAST *decl_specifier_list = nullptr;
667 DeclaratorListAST *declarator_list = nullptr;
668 int semicolon_token = 0;
669
670 public:
671 List<Symbol *> *symbols = nullptr;
672
673 public:
asSimpleDeclaration()674 SimpleDeclarationAST *asSimpleDeclaration() override { return this; }
675
676 int firstToken() const override;
677 int lastToken() const override;
678
679 SimpleDeclarationAST *clone(MemoryPool *pool) const override;
680
681 protected:
682 void accept0(ASTVisitor *visitor) override;
683 bool match0(AST *, ASTMatcher *) override;
684 };
685
686 class CPLUSPLUS_EXPORT EmptyDeclarationAST: public DeclarationAST
687 {
688 public:
689 int semicolon_token = 0;
690
691 public:
asEmptyDeclaration()692 EmptyDeclarationAST *asEmptyDeclaration() override { return this; }
693
694 int firstToken() const override;
695 int lastToken() const override;
696
697 EmptyDeclarationAST *clone(MemoryPool *pool) const override;
698
699 protected:
700 void accept0(ASTVisitor *visitor) override;
701 bool match0(AST *, ASTMatcher *) override;
702 };
703
704 class CPLUSPLUS_EXPORT AccessDeclarationAST: public DeclarationAST
705 {
706 public:
707 int access_specifier_token = 0;
708 int slots_token = 0;
709 int colon_token = 0;
710
711 public:
asAccessDeclaration()712 AccessDeclarationAST *asAccessDeclaration() override { return this; }
713
714 int firstToken() const override;
715 int lastToken() const override;
716
717 AccessDeclarationAST *clone(MemoryPool *pool) const override;
718
719 protected:
720 void accept0(ASTVisitor *visitor) override;
721 bool match0(AST *, ASTMatcher *) override;
722 };
723
724 class CPLUSPLUS_EXPORT QtObjectTagAST: public DeclarationAST
725 {
726 public:
727 int q_object_token = 0;
728
729 public:
asQtObjectTag()730 QtObjectTagAST *asQtObjectTag() override { return this; }
731
732 int firstToken() const override;
733 int lastToken() const override;
734
735 QtObjectTagAST *clone(MemoryPool *pool) const override;
736
737 protected:
738 void accept0(ASTVisitor *visitor) override;
739 bool match0(AST *, ASTMatcher *) override;
740 };
741
742 class CPLUSPLUS_EXPORT QtPrivateSlotAST: public DeclarationAST
743 {
744 public:
745 int q_private_slot_token = 0;
746 int lparen_token = 0;
747 int dptr_token = 0;
748 int dptr_lparen_token = 0;
749 int dptr_rparen_token = 0;
750 int comma_token = 0;
751 SpecifierListAST *type_specifier_list = nullptr;
752 DeclaratorAST *declarator = nullptr;
753 int rparen_token = 0;
754
755 public:
asQtPrivateSlot()756 QtPrivateSlotAST *asQtPrivateSlot() override { return this; }
757
758 int firstToken() const override;
759 int lastToken() const override;
760
761 QtPrivateSlotAST *clone(MemoryPool *pool) const override;
762
763 protected:
764 void accept0(ASTVisitor *visitor) override;
765 bool match0(AST *, ASTMatcher *) override;
766 };
767
768 class QtPropertyDeclarationItemAST: public AST
769 {
770 public:
771 int item_name_token = 0;
772 ExpressionAST *expression = nullptr;
773
774 public:
asQtPropertyDeclarationItem()775 QtPropertyDeclarationItemAST *asQtPropertyDeclarationItem() override { return this; }
776
777 int firstToken() const override;
778 int lastToken() const override;
779
780 QtPropertyDeclarationItemAST *clone(MemoryPool *pool) const override;
781
782 protected:
783 void accept0(ASTVisitor *visitor) override;
784 bool match0(AST *, ASTMatcher *) override;
785 };
786
787 class CPLUSPLUS_EXPORT QtPropertyDeclarationAST: public DeclarationAST
788 {
789 public:
790 int property_specifier_token = 0;
791 int lparen_token = 0;
792 ExpressionAST *expression = nullptr; // for Q_PRIVATE_PROPERTY(expression, ...)
793 int comma_token = 0;
794 ExpressionAST *type_id = nullptr;
795 NameAST *property_name = nullptr;
796 QtPropertyDeclarationItemListAST *property_declaration_item_list = nullptr;
797 int rparen_token = 0;
798
799 public:
asQtPropertyDeclaration()800 QtPropertyDeclarationAST *asQtPropertyDeclaration() override { return this; }
801
802 int firstToken() const override;
803 int lastToken() const override;
804
805 QtPropertyDeclarationAST *clone(MemoryPool *pool) const override;
806
807 protected:
808 void accept0(ASTVisitor *visitor) override;
809 bool match0(AST *, ASTMatcher *) override;
810 };
811
812 class CPLUSPLUS_EXPORT QtEnumDeclarationAST: public DeclarationAST
813 {
814 public:
815 int enum_specifier_token = 0;
816 int lparen_token = 0;
817 NameListAST *enumerator_list = nullptr;
818 int rparen_token = 0;
819
820 public:
asQtEnumDeclaration()821 QtEnumDeclarationAST *asQtEnumDeclaration() override { return this; }
822
823 int firstToken() const override;
824 int lastToken() const override;
825
826 QtEnumDeclarationAST *clone(MemoryPool *pool) const override;
827
828 protected:
829 void accept0(ASTVisitor *visitor) override;
830 bool match0(AST *, ASTMatcher *) override;
831 };
832
833 class CPLUSPLUS_EXPORT QtFlagsDeclarationAST: public DeclarationAST
834 {
835 public:
836 int flags_specifier_token = 0;
837 int lparen_token = 0;
838 NameListAST *flag_enums_list = nullptr;
839 int rparen_token = 0;
840
841 public:
asQtFlagsDeclaration()842 QtFlagsDeclarationAST *asQtFlagsDeclaration() override { return this; }
843
844 int firstToken() const override;
845 int lastToken() const override;
846
847 QtFlagsDeclarationAST *clone(MemoryPool *pool) const override;
848
849 protected:
850 void accept0(ASTVisitor *visitor) override;
851 bool match0(AST *, ASTMatcher *) override;
852 };
853
854 class CPLUSPLUS_EXPORT QtInterfaceNameAST: public AST
855 {
856 public:
857 NameAST *interface_name = nullptr;
858 NameListAST *constraint_list = nullptr;
859
860 public:
asQtInterfaceName()861 QtInterfaceNameAST *asQtInterfaceName() override { return this; }
862
863 int firstToken() const override;
864 int lastToken() const override;
865
866 QtInterfaceNameAST *clone(MemoryPool *pool) const override;
867
868 protected:
869 void accept0(ASTVisitor *visitor) override;
870 bool match0(AST *, ASTMatcher *) override;
871 };
872
873 class CPLUSPLUS_EXPORT QtInterfacesDeclarationAST: public DeclarationAST
874 {
875 public:
876 int interfaces_token = 0;
877 int lparen_token = 0;
878 QtInterfaceNameListAST *interface_name_list = nullptr;
879 int rparen_token = 0;
880
881 public:
asQtInterfacesDeclaration()882 QtInterfacesDeclarationAST *asQtInterfacesDeclaration() override { return this; }
883
884 int firstToken() const override;
885 int lastToken() const override;
886
887 QtInterfacesDeclarationAST *clone(MemoryPool *pool) const override;
888
889 protected:
890 void accept0(ASTVisitor *visitor) override;
891 bool match0(AST *, ASTMatcher *) override;
892 };
893
894 class CPLUSPLUS_EXPORT AsmDefinitionAST: public DeclarationAST
895 {
896 public:
897 int asm_token = 0;
898 int volatile_token = 0;
899 int lparen_token = 0;
900 // ### string literals
901 // ### asm operand list
902 int rparen_token = 0;
903 int semicolon_token = 0;
904
905 public:
asAsmDefinition()906 AsmDefinitionAST *asAsmDefinition() override { return this; }
907
908 int firstToken() const override;
909 int lastToken() const override;
910
911 AsmDefinitionAST *clone(MemoryPool *pool) const override;
912
913 protected:
914 void accept0(ASTVisitor *visitor) override;
915 bool match0(AST *, ASTMatcher *) override;
916 };
917
918 class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
919 {
920 public:
921 int virtual_token = 0;
922 int access_specifier_token = 0;
923 NameAST *name = nullptr;
924 int ellipsis_token = 0;
925
926 public: // annotations
927 BaseClass *symbol = nullptr;
928
929 public:
asBaseSpecifier()930 BaseSpecifierAST *asBaseSpecifier() override { return this; }
931
932 int firstToken() const override;
933 int lastToken() const override;
934
935 BaseSpecifierAST *clone(MemoryPool *pool) const override;
936
937 protected:
938 void accept0(ASTVisitor *visitor) override;
939 bool match0(AST *, ASTMatcher *) override;
940 };
941
942 class CPLUSPLUS_EXPORT IdExpressionAST: public ExpressionAST
943 {
944 public:
945 NameAST *name = nullptr;
946
947 public:
asIdExpression()948 IdExpressionAST *asIdExpression() override { return this; }
949
950 int firstToken() const override;
951 int lastToken() const override;
952
953 IdExpressionAST *clone(MemoryPool *pool) const override;
954
955 protected:
956 void accept0(ASTVisitor *visitor) override;
957 bool match0(AST *, ASTMatcher *) override;
958 };
959
960 class CPLUSPLUS_EXPORT CompoundExpressionAST: public ExpressionAST
961 {
962 public:
963 int lparen_token = 0;
964 CompoundStatementAST *statement = nullptr;
965 int rparen_token = 0;
966
967 public:
asCompoundExpression()968 CompoundExpressionAST *asCompoundExpression() override { return this; }
969
970 int firstToken() const override;
971 int lastToken() const override;
972
973 CompoundExpressionAST *clone(MemoryPool *pool) const override;
974
975 protected:
976 void accept0(ASTVisitor *visitor) override;
977 bool match0(AST *, ASTMatcher *) override;
978 };
979
980 class CPLUSPLUS_EXPORT CompoundLiteralAST: public ExpressionAST
981 {
982 public:
983 int lparen_token = 0;
984 ExpressionAST *type_id = nullptr;
985 int rparen_token = 0;
986 ExpressionAST *initializer = nullptr;
987
988 public:
asCompoundLiteral()989 CompoundLiteralAST *asCompoundLiteral() override { return this; }
990
991 int firstToken() const override;
992 int lastToken() const override;
993
994 CompoundLiteralAST *clone(MemoryPool *pool) const override;
995
996 protected:
997 void accept0(ASTVisitor *visitor) override;
998 bool match0(AST *, ASTMatcher *) override;
999 };
1000
1001 class CPLUSPLUS_EXPORT QtMethodAST: public ExpressionAST
1002 {
1003 public:
1004 int method_token = 0;
1005 int lparen_token = 0;
1006 DeclaratorAST *declarator = nullptr;
1007 int rparen_token = 0;
1008
1009 public:
asQtMethod()1010 QtMethodAST *asQtMethod() override { return this; }
1011
1012 int firstToken() const override;
1013 int lastToken() const override;
1014
1015 QtMethodAST *clone(MemoryPool *pool) const override;
1016
1017 protected:
1018 void accept0(ASTVisitor *visitor) override;
1019 bool match0(AST *, ASTMatcher *) override;
1020 };
1021
1022 class CPLUSPLUS_EXPORT QtMemberDeclarationAST: public StatementAST
1023 {
1024 public:
1025 int q_token = 0;
1026 int lparen_token = 0;
1027 ExpressionAST *type_id = nullptr;
1028 int rparen_token = 0;
1029
1030 public:
asQtMemberDeclaration()1031 QtMemberDeclarationAST *asQtMemberDeclaration() override { return this; }
1032
1033 int firstToken() const override;
1034 int lastToken() const override;
1035
1036 QtMemberDeclarationAST *clone(MemoryPool *pool) const override;
1037
1038 protected:
1039 void accept0(ASTVisitor *visitor) override;
1040 bool match0(AST *, ASTMatcher *) override;
1041 };
1042
1043 class CPLUSPLUS_EXPORT BinaryExpressionAST: public ExpressionAST
1044 {
1045 public:
1046 ExpressionAST *left_expression = nullptr;
1047 int binary_op_token = 0;
1048 ExpressionAST *right_expression = nullptr;
1049
1050 public:
asBinaryExpression()1051 BinaryExpressionAST *asBinaryExpression() override { return this; }
1052
1053 int firstToken() const override;
1054 int lastToken() const override;
1055
1056 BinaryExpressionAST *clone(MemoryPool *pool) const override;
1057
1058 protected:
1059 void accept0(ASTVisitor *visitor) override;
1060 bool match0(AST *, ASTMatcher *) override;
1061 };
1062
1063 class CPLUSPLUS_EXPORT CastExpressionAST: public ExpressionAST
1064 {
1065 public:
1066 int lparen_token = 0;
1067 ExpressionAST *type_id = nullptr;
1068 int rparen_token = 0;
1069 ExpressionAST *expression = nullptr;
1070
1071 public:
asCastExpression()1072 CastExpressionAST *asCastExpression() override { return this; }
1073
1074 int firstToken() const override;
1075 int lastToken() const override;
1076
1077 CastExpressionAST *clone(MemoryPool *pool) const override;
1078
1079 protected:
1080 void accept0(ASTVisitor *visitor) override;
1081 bool match0(AST *, ASTMatcher *) override;
1082 };
1083
1084 class CPLUSPLUS_EXPORT ClassSpecifierAST: public SpecifierAST
1085 {
1086 public:
1087 int classkey_token = 0;
1088 SpecifierListAST *attribute_list = nullptr;
1089 NameAST *name = nullptr;
1090 int final_token = 0;
1091 int colon_token = 0;
1092 BaseSpecifierListAST *base_clause_list = nullptr;
1093 int dot_dot_dot_token = 0;
1094 int lbrace_token = 0;
1095 DeclarationListAST *member_specifier_list = nullptr;
1096 int rbrace_token = 0;
1097
1098 public: // annotations
1099 Class *symbol = nullptr;
1100
1101 public:
asClassSpecifier()1102 ClassSpecifierAST *asClassSpecifier() override { return this; }
1103
1104 int firstToken() const override;
1105 int lastToken() const override;
1106
1107 ClassSpecifierAST *clone(MemoryPool *pool) const override;
1108
1109 protected:
1110 void accept0(ASTVisitor *visitor) override;
1111 bool match0(AST *, ASTMatcher *) override;
1112 };
1113
1114 class CPLUSPLUS_EXPORT CaseStatementAST: public StatementAST
1115 {
1116 public:
1117 int case_token = 0;
1118 ExpressionAST *expression = nullptr;
1119 int colon_token = 0;
1120 StatementAST *statement = nullptr;
1121
1122 public:
asCaseStatement()1123 CaseStatementAST *asCaseStatement() override { return this; }
1124
1125 int firstToken() const override;
1126 int lastToken() const override;
1127
1128 CaseStatementAST *clone(MemoryPool *pool) const override;
1129
1130 protected:
1131 void accept0(ASTVisitor *visitor) override;
1132 bool match0(AST *, ASTMatcher *) override;
1133 };
1134
1135 class CPLUSPLUS_EXPORT CompoundStatementAST: public StatementAST
1136 {
1137 public:
1138 int lbrace_token = 0;
1139 StatementListAST *statement_list = nullptr;
1140 int rbrace_token = 0;
1141
1142 public: // annotations
1143 Block *symbol = nullptr;
1144
1145 public:
asCompoundStatement()1146 CompoundStatementAST *asCompoundStatement() override { return this; }
1147
1148 int firstToken() const override;
1149 int lastToken() const override;
1150
1151 CompoundStatementAST *clone(MemoryPool *pool) const override;
1152
1153 protected:
1154 void accept0(ASTVisitor *visitor) override;
1155 bool match0(AST *, ASTMatcher *) override;
1156 };
1157
1158 class CPLUSPLUS_EXPORT ConditionAST: public ExpressionAST
1159 {
1160 public:
1161 SpecifierListAST *type_specifier_list = nullptr;
1162 DeclaratorAST *declarator = nullptr;
1163
1164 public:
asCondition()1165 ConditionAST *asCondition() override { return this; }
1166
1167 int firstToken() const override;
1168 int lastToken() const override;
1169
1170 ConditionAST *clone(MemoryPool *pool) const override;
1171
1172 protected:
1173 void accept0(ASTVisitor *visitor) override;
1174 bool match0(AST *, ASTMatcher *) override;
1175 };
1176
1177 class CPLUSPLUS_EXPORT ConditionalExpressionAST: public ExpressionAST
1178 {
1179 public:
1180 ExpressionAST *condition = nullptr;
1181 int question_token = 0;
1182 ExpressionAST *left_expression = nullptr;
1183 int colon_token = 0;
1184 ExpressionAST *right_expression = nullptr;
1185
1186 public:
asConditionalExpression()1187 ConditionalExpressionAST *asConditionalExpression() override { return this; }
1188
1189 int firstToken() const override;
1190 int lastToken() const override;
1191
1192 ConditionalExpressionAST *clone(MemoryPool *pool) const override;
1193
1194 protected:
1195 void accept0(ASTVisitor *visitor) override;
1196 bool match0(AST *, ASTMatcher *) override;
1197 };
1198
1199 class CPLUSPLUS_EXPORT CppCastExpressionAST: public ExpressionAST
1200 {
1201 public:
1202 int cast_token = 0;
1203 int less_token = 0;
1204 ExpressionAST *type_id = nullptr;
1205 int greater_token = 0;
1206 int lparen_token = 0;
1207 ExpressionAST *expression = nullptr;
1208 int rparen_token = 0;
1209
1210 public:
asCppCastExpression()1211 CppCastExpressionAST *asCppCastExpression() override { return this; }
1212
1213 int firstToken() const override;
1214 int lastToken() const override;
1215
1216 CppCastExpressionAST *clone(MemoryPool *pool) const override;
1217
1218 protected:
1219 void accept0(ASTVisitor *visitor) override;
1220 bool match0(AST *, ASTMatcher *) override;
1221 };
1222
1223 class CPLUSPLUS_EXPORT CtorInitializerAST: public AST
1224 {
1225 public:
1226 int colon_token = 0;
1227 MemInitializerListAST *member_initializer_list = nullptr;
1228 int dot_dot_dot_token = 0;
1229
1230 public:
asCtorInitializer()1231 CtorInitializerAST *asCtorInitializer() override { return this; }
1232
1233 int firstToken() const override;
1234 int lastToken() const override;
1235
1236 CtorInitializerAST *clone(MemoryPool *pool) const override;
1237
1238 protected:
1239 void accept0(ASTVisitor *visitor) override;
1240 bool match0(AST *, ASTMatcher *) override;
1241 };
1242
1243 class CPLUSPLUS_EXPORT DeclarationStatementAST: public StatementAST
1244 {
1245 public:
1246 DeclarationAST *declaration = nullptr;
1247
1248 public:
asDeclarationStatement()1249 DeclarationStatementAST *asDeclarationStatement() override { return this; }
1250
1251 int firstToken() const override;
1252 int lastToken() const override;
1253
1254 DeclarationStatementAST *clone(MemoryPool *pool) const override;
1255
1256 protected:
1257 void accept0(ASTVisitor *visitor) override;
1258 bool match0(AST *, ASTMatcher *) override;
1259 };
1260
1261 class CPLUSPLUS_EXPORT DeclaratorIdAST: public CoreDeclaratorAST
1262 {
1263 public:
1264 int dot_dot_dot_token = 0;
1265 NameAST *name = nullptr;
1266
1267 public:
asDeclaratorId()1268 DeclaratorIdAST *asDeclaratorId() override { return this; }
1269
1270 int firstToken() const override;
1271 int lastToken() const override;
1272
1273 DeclaratorIdAST *clone(MemoryPool *pool) const override;
1274
1275 protected:
1276 void accept0(ASTVisitor *visitor) override;
1277 bool match0(AST *, ASTMatcher *) override;
1278 };
1279
1280 class CPLUSPLUS_EXPORT NestedDeclaratorAST: public CoreDeclaratorAST
1281 {
1282 public:
1283 int lparen_token = 0;
1284 DeclaratorAST *declarator = nullptr;
1285 int rparen_token = 0;
1286
1287 public:
asNestedDeclarator()1288 NestedDeclaratorAST *asNestedDeclarator() override { return this; }
1289
1290 int firstToken() const override;
1291 int lastToken() const override;
1292
1293 NestedDeclaratorAST *clone(MemoryPool *pool) const override;
1294
1295 protected:
1296 void accept0(ASTVisitor *visitor) override;
1297 bool match0(AST *, ASTMatcher *) override;
1298 };
1299
1300 class CPLUSPLUS_EXPORT FunctionDeclaratorAST: public PostfixDeclaratorAST
1301 {
1302 public:
1303 SpecifierListAST *decl_specifier_list = nullptr;
1304 int lparen_token = 0;
1305 ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr;
1306 int rparen_token = 0;
1307 SpecifierListAST *cv_qualifier_list = nullptr;
1308 int ref_qualifier_token = 0;
1309 ExceptionSpecificationAST *exception_specification = nullptr;
1310 TrailingReturnTypeAST *trailing_return_type = nullptr;
1311 // Some FunctionDeclarators can also be interpreted as an initializer, like for 'A b(c);'
1312 ExpressionAST *as_cpp_initializer = nullptr;
1313
1314 public: // annotations
1315 Function *symbol = nullptr;
1316
1317 public:
asFunctionDeclarator()1318 FunctionDeclaratorAST *asFunctionDeclarator() override { return this; }
1319
1320 int firstToken() const override;
1321 int lastToken() const override;
1322
1323 FunctionDeclaratorAST *clone(MemoryPool *pool) const override;
1324
1325 protected:
1326 void accept0(ASTVisitor *visitor) override;
1327 bool match0(AST *, ASTMatcher *) override;
1328 };
1329
1330 class CPLUSPLUS_EXPORT ArrayDeclaratorAST: public PostfixDeclaratorAST
1331 {
1332 public:
1333 int lbracket_token = 0;
1334 ExpressionAST *expression = nullptr;
1335 int rbracket_token = 0;
1336
1337 public:
asArrayDeclarator()1338 ArrayDeclaratorAST *asArrayDeclarator() override { return this; }
1339
1340 int firstToken() const override;
1341 int lastToken() const override;
1342
1343 ArrayDeclaratorAST *clone(MemoryPool *pool) const override;
1344
1345 protected:
1346 void accept0(ASTVisitor *visitor) override;
1347 bool match0(AST *, ASTMatcher *) override;
1348 };
1349
1350 class CPLUSPLUS_EXPORT DeleteExpressionAST: public ExpressionAST
1351 {
1352 public:
1353 int scope_token = 0;
1354 int delete_token = 0;
1355 int lbracket_token = 0;
1356 int rbracket_token = 0;
1357 ExpressionAST *expression = nullptr;
1358
1359 public:
asDeleteExpression()1360 DeleteExpressionAST *asDeleteExpression() override { return this; }
1361
1362 int firstToken() const override;
1363 int lastToken() const override;
1364
1365 DeleteExpressionAST *clone(MemoryPool *pool) const override;
1366
1367 protected:
1368 void accept0(ASTVisitor *visitor) override;
1369 bool match0(AST *, ASTMatcher *) override;
1370 };
1371
1372 class CPLUSPLUS_EXPORT DoStatementAST: public StatementAST
1373 {
1374 public:
1375 int do_token = 0;
1376 StatementAST *statement = nullptr;
1377 int while_token = 0;
1378 int lparen_token = 0;
1379 ExpressionAST *expression = nullptr;
1380 int rparen_token = 0;
1381 int semicolon_token = 0;
1382
1383 public:
asDoStatement()1384 DoStatementAST *asDoStatement() override { return this; }
1385
1386 int firstToken() const override;
1387 int lastToken() const override;
1388
1389 DoStatementAST *clone(MemoryPool *pool) const override;
1390
1391 protected:
1392 void accept0(ASTVisitor *visitor) override;
1393 bool match0(AST *, ASTMatcher *) override;
1394 };
1395
1396 class CPLUSPLUS_EXPORT NamedTypeSpecifierAST: public SpecifierAST
1397 {
1398 public:
1399 NameAST *name = nullptr;
1400
1401 public:
asNamedTypeSpecifier()1402 NamedTypeSpecifierAST *asNamedTypeSpecifier() override { return this; }
1403
1404 int firstToken() const override;
1405 int lastToken() const override;
1406
1407 NamedTypeSpecifierAST *clone(MemoryPool *pool) const override;
1408
1409 protected:
1410 void accept0(ASTVisitor *visitor) override;
1411 bool match0(AST *, ASTMatcher *) override;
1412 };
1413
1414 class CPLUSPLUS_EXPORT ElaboratedTypeSpecifierAST: public SpecifierAST
1415 {
1416 public:
1417 int classkey_token = 0;
1418 SpecifierListAST *attribute_list = nullptr;
1419 NameAST *name = nullptr;
1420
1421 public:
asElaboratedTypeSpecifier()1422 ElaboratedTypeSpecifierAST *asElaboratedTypeSpecifier() override { return this; }
1423
1424 int firstToken() const override;
1425 int lastToken() const override;
1426
1427 ElaboratedTypeSpecifierAST *clone(MemoryPool *pool) const override;
1428
1429 protected:
1430 void accept0(ASTVisitor *visitor) override;
1431 bool match0(AST *, ASTMatcher *) override;
1432 };
1433
1434 class CPLUSPLUS_EXPORT EnumSpecifierAST: public SpecifierAST
1435 {
1436 public:
1437 int enum_token = 0;
1438 int key_token = 0; // struct, class or 0
1439 NameAST *name = nullptr;
1440 int colon_token = 0; // can be 0 if there is no enum-base
1441 SpecifierListAST *type_specifier_list = nullptr; // ditto
1442 int lbrace_token = 0;
1443 EnumeratorListAST *enumerator_list = nullptr;
1444 int stray_comma_token = 0;
1445 int rbrace_token = 0;
1446
1447 public: // annotations
1448 Enum *symbol = nullptr;
1449
1450 public:
asEnumSpecifier()1451 EnumSpecifierAST *asEnumSpecifier() override { return this; }
1452
1453 int firstToken() const override;
1454 int lastToken() const override;
1455
1456 EnumSpecifierAST *clone(MemoryPool *pool) const override;
1457
1458 protected:
1459 void accept0(ASTVisitor *visitor) override;
1460 bool match0(AST *, ASTMatcher *) override;
1461 };
1462
1463 class CPLUSPLUS_EXPORT EnumeratorAST: public AST
1464 {
1465 public:
1466 int identifier_token = 0;
1467 int equal_token = 0;
1468 ExpressionAST *expression = nullptr;
1469
1470 public:
asEnumerator()1471 EnumeratorAST *asEnumerator() override { return this; }
1472
1473 int firstToken() const override;
1474 int lastToken() const override;
1475
1476 EnumeratorAST *clone(MemoryPool *pool) const override;
1477
1478 protected:
1479 void accept0(ASTVisitor *visitor) override;
1480 bool match0(AST *, ASTMatcher *) override;
1481 };
1482
1483 class CPLUSPLUS_EXPORT ExceptionDeclarationAST: public DeclarationAST
1484 {
1485 public:
1486 SpecifierListAST *type_specifier_list = nullptr;
1487 DeclaratorAST *declarator = nullptr;
1488 int dot_dot_dot_token = 0;
1489
1490 public:
asExceptionDeclaration()1491 ExceptionDeclarationAST *asExceptionDeclaration() override { return this; }
1492
1493 int firstToken() const override;
1494 int lastToken() const override;
1495
1496 ExceptionDeclarationAST *clone(MemoryPool *pool) const override;
1497
1498 protected:
1499 void accept0(ASTVisitor *visitor) override;
1500 bool match0(AST *, ASTMatcher *) override;
1501 };
1502
1503 class CPLUSPLUS_EXPORT ExceptionSpecificationAST: public AST
1504 {
1505 public:
asExceptionSpecification()1506 ExceptionSpecificationAST *asExceptionSpecification() override { return this; }
1507
1508 ExceptionSpecificationAST *clone(MemoryPool *pool) const override = 0;
1509 };
1510
1511 class CPLUSPLUS_EXPORT DynamicExceptionSpecificationAST: public ExceptionSpecificationAST
1512 {
1513 public:
1514 int throw_token = 0;
1515 int lparen_token = 0;
1516 int dot_dot_dot_token = 0;
1517 ExpressionListAST *type_id_list = nullptr;
1518 int rparen_token = 0;
1519
1520 public:
asDynamicExceptionSpecification()1521 DynamicExceptionSpecificationAST *asDynamicExceptionSpecification() override { return this; }
1522
1523 int firstToken() const override;
1524 int lastToken() const override;
1525
1526 DynamicExceptionSpecificationAST *clone(MemoryPool *pool) const override;
1527
1528 protected:
1529 void accept0(ASTVisitor *visitor) override;
1530 bool match0(AST *, ASTMatcher *) override;
1531 };
1532
1533 class CPLUSPLUS_EXPORT NoExceptSpecificationAST: public ExceptionSpecificationAST
1534 {
1535 public:
1536 int noexcept_token = 0;
1537 int lparen_token = 0;
1538 ExpressionAST *expression = nullptr;
1539 int rparen_token = 0;
1540
1541 public:
asNoExceptSpecification()1542 NoExceptSpecificationAST *asNoExceptSpecification() override { return this; }
1543
1544 int firstToken() const override;
1545 int lastToken() const override;
1546
1547 NoExceptSpecificationAST *clone(MemoryPool *pool) const override;
1548
1549 protected:
1550 void accept0(ASTVisitor *visitor) override;
1551 bool match0(AST *, ASTMatcher *) override;
1552 };
1553
1554 class CPLUSPLUS_EXPORT ExpressionOrDeclarationStatementAST: public StatementAST
1555 {
1556 public:
1557 ExpressionStatementAST *expression = nullptr;
1558 DeclarationStatementAST *declaration = nullptr;
1559
1560 public:
asExpressionOrDeclarationStatement()1561 ExpressionOrDeclarationStatementAST *asExpressionOrDeclarationStatement() override { return this; }
1562
1563 int firstToken() const override;
1564 int lastToken() const override;
1565
1566 ExpressionOrDeclarationStatementAST *clone(MemoryPool *pool) const override;
1567
1568 protected:
1569 void accept0(ASTVisitor *visitor) override;
1570 bool match0(AST *, ASTMatcher *) override;
1571 };
1572
1573 class CPLUSPLUS_EXPORT ExpressionStatementAST: public StatementAST
1574 {
1575 public:
1576 ExpressionAST *expression = nullptr;
1577 int semicolon_token = 0;
1578
1579 public:
asExpressionStatement()1580 ExpressionStatementAST *asExpressionStatement() override { return this; }
1581
1582 int firstToken() const override;
1583 int lastToken() const override;
1584
1585 ExpressionStatementAST *clone(MemoryPool *pool) const override;
1586
1587 protected:
1588 void accept0(ASTVisitor *visitor) override;
1589 bool match0(AST *, ASTMatcher *) override;
1590 };
1591
1592 class CPLUSPLUS_EXPORT FunctionDefinitionAST: public DeclarationAST
1593 {
1594 public:
1595 int qt_invokable_token = 0;
1596 SpecifierListAST *decl_specifier_list = nullptr;
1597 DeclaratorAST *declarator = nullptr;
1598 CtorInitializerAST *ctor_initializer = nullptr;
1599 StatementAST *function_body = nullptr;
1600
1601 public: // annotations
1602 Function *symbol = nullptr;
1603
1604 public:
asFunctionDefinition()1605 FunctionDefinitionAST *asFunctionDefinition() override { return this; }
1606
1607 int firstToken() const override;
1608 int lastToken() const override;
1609
1610 FunctionDefinitionAST *clone(MemoryPool *pool) const override;
1611
1612 protected:
1613 void accept0(ASTVisitor *visitor) override;
1614 bool match0(AST *, ASTMatcher *) override;
1615 };
1616
1617 class CPLUSPLUS_EXPORT ForeachStatementAST: public StatementAST
1618 {
1619 public:
1620 int foreach_token = 0;
1621 int lparen_token = 0;
1622 // declaration
1623 SpecifierListAST *type_specifier_list = nullptr;
1624 DeclaratorAST *declarator = nullptr;
1625 // or an expression
1626 ExpressionAST *initializer = nullptr;
1627 int comma_token = 0;
1628 ExpressionAST *expression = nullptr;
1629 int rparen_token = 0;
1630 StatementAST *statement = nullptr;
1631
1632 public: // annotations
1633 Block *symbol = nullptr;
1634
1635 public:
asForeachStatement()1636 ForeachStatementAST *asForeachStatement() override { return this; }
1637
1638 int firstToken() const override;
1639 int lastToken() const override;
1640
1641 ForeachStatementAST *clone(MemoryPool *pool) const override;
1642
1643 protected:
1644 void accept0(ASTVisitor *visitor) override;
1645 bool match0(AST *, ASTMatcher *) override;
1646 };
1647
1648 class CPLUSPLUS_EXPORT RangeBasedForStatementAST : public StatementAST
1649 {
1650 public:
1651 int for_token = 0;
1652 int lparen_token = 0;
1653 // declaration
1654 SpecifierListAST *type_specifier_list = nullptr;
1655 DeclaratorAST *declarator = nullptr;
1656 // or an expression
1657 int colon_token = 0;
1658 ExpressionAST *expression = nullptr;
1659 int rparen_token = 0;
1660 StatementAST *statement = nullptr;
1661
1662 public: // annotations
1663 Block *symbol = nullptr;
1664
1665 public:
asRangeBasedForStatement()1666 RangeBasedForStatementAST *asRangeBasedForStatement() override { return this; }
1667
1668 int firstToken() const override;
1669 int lastToken() const override;
1670
1671 RangeBasedForStatementAST *clone(MemoryPool *pool) const override;
1672
1673 protected:
1674 void accept0(ASTVisitor *visitor) override;
1675 bool match0(AST *, ASTMatcher *) override;
1676 };
1677
1678 class CPLUSPLUS_EXPORT ForStatementAST: public StatementAST
1679 {
1680 public:
1681 int for_token = 0;
1682 int lparen_token = 0;
1683 StatementAST *initializer = nullptr;
1684 ExpressionAST *condition = nullptr;
1685 int semicolon_token = 0;
1686 ExpressionAST *expression = nullptr;
1687 int rparen_token = 0;
1688 StatementAST *statement = nullptr;
1689
1690 public: // annotations
1691 Block *symbol = nullptr;
1692
1693 public:
asForStatement()1694 ForStatementAST *asForStatement() override { return this; }
1695
1696 int firstToken() const override;
1697 int lastToken() const override;
1698
1699 ForStatementAST *clone(MemoryPool *pool) const override;
1700
1701 protected:
1702 void accept0(ASTVisitor *visitor) override;
1703 bool match0(AST *, ASTMatcher *) override;
1704 };
1705
1706 class CPLUSPLUS_EXPORT IfStatementAST: public StatementAST
1707 {
1708 public:
1709 int if_token = 0;
1710 int constexpr_token = 0;
1711 int lparen_token = 0;
1712 ExpressionAST *condition = nullptr;
1713 int rparen_token = 0;
1714 StatementAST *statement = nullptr;
1715 int else_token = 0;
1716 StatementAST *else_statement = nullptr;
1717
1718 public: // annotations
1719 Block *symbol = nullptr;
1720
1721 public:
asIfStatement()1722 IfStatementAST *asIfStatement() override { return this; }
1723
1724 int firstToken() const override;
1725 int lastToken() const override;
1726
1727 IfStatementAST *clone(MemoryPool *pool) const override;
1728
1729 protected:
1730 void accept0(ASTVisitor *visitor) override;
1731 bool match0(AST *, ASTMatcher *) override;
1732 };
1733
1734 class CPLUSPLUS_EXPORT ArrayInitializerAST: public ExpressionAST
1735 {
1736 public:
1737 int lbrace_token = 0;
1738 ExpressionListAST *expression_list = nullptr;
1739 int rbrace_token = 0;
1740
1741 public:
asArrayInitializer()1742 ArrayInitializerAST *asArrayInitializer() override { return this; }
1743
1744 int firstToken() const override;
1745 int lastToken() const override;
1746
1747 ArrayInitializerAST *clone(MemoryPool *pool) const override;
1748
1749 protected:
1750 void accept0(ASTVisitor *visitor) override;
1751 bool match0(AST *, ASTMatcher *) override;
1752 };
1753
1754 class CPLUSPLUS_EXPORT LabeledStatementAST: public StatementAST
1755 {
1756 public:
1757 int label_token = 0;
1758 int colon_token = 0;
1759 StatementAST *statement = nullptr;
1760
1761 public:
asLabeledStatement()1762 LabeledStatementAST *asLabeledStatement() override { return this; }
1763
1764 int firstToken() const override;
1765 int lastToken() const override;
1766
1767 LabeledStatementAST *clone(MemoryPool *pool) const override;
1768
1769 protected:
1770 void accept0(ASTVisitor *visitor) override;
1771 bool match0(AST *, ASTMatcher *) override;
1772 };
1773
1774 class CPLUSPLUS_EXPORT LinkageBodyAST: public DeclarationAST
1775 {
1776 public:
1777 int lbrace_token = 0;
1778 DeclarationListAST *declaration_list = nullptr;
1779 int rbrace_token = 0;
1780
1781 public:
asLinkageBody()1782 LinkageBodyAST *asLinkageBody() override { return this; }
1783 int firstToken() const override;
1784 int lastToken() const override;
1785
1786 LinkageBodyAST *clone(MemoryPool *pool) const override;
1787
1788 protected:
1789 void accept0(ASTVisitor *visitor) override;
1790 bool match0(AST *, ASTMatcher *) override;
1791 };
1792
1793 class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
1794 {
1795 public:
1796 int extern_token = 0;
1797 int extern_type_token = 0;
1798 DeclarationAST *declaration = nullptr;
1799
1800 public:
asLinkageSpecification()1801 LinkageSpecificationAST *asLinkageSpecification() override { return this; }
1802
1803 int firstToken() const override;
1804 int lastToken() const override;
1805
1806 LinkageSpecificationAST *clone(MemoryPool *pool) const override;
1807
1808 protected:
1809 void accept0(ASTVisitor *visitor) override;
1810 bool match0(AST *, ASTMatcher *) override;
1811 };
1812
1813 class CPLUSPLUS_EXPORT MemInitializerAST: public AST
1814 {
1815 public:
1816 NameAST *name = nullptr;
1817 // either a BracedInitializerAST or a ExpressionListParenAST
1818 ExpressionAST *expression = nullptr;
1819
1820 public:
asMemInitializer()1821 MemInitializerAST *asMemInitializer() override { return this; }
1822
1823 int firstToken() const override;
1824 int lastToken() const override;
1825
1826 MemInitializerAST *clone(MemoryPool *pool) const override;
1827
1828 protected:
1829 void accept0(ASTVisitor *visitor) override;
1830 bool match0(AST *, ASTMatcher *) override;
1831 };
1832
1833 class CPLUSPLUS_EXPORT NestedNameSpecifierAST: public AST
1834 {
1835 public:
1836 NameAST *class_or_namespace_name = nullptr;
1837 int scope_token = 0;
1838
1839 public:
asNestedNameSpecifier()1840 NestedNameSpecifierAST *asNestedNameSpecifier() override { return this; }
1841
1842 int firstToken() const override;
1843 int lastToken() const override;
1844
1845 NestedNameSpecifierAST *clone(MemoryPool *pool) const override;
1846
1847 protected:
1848 void accept0(ASTVisitor *visitor) override;
1849 bool match0(AST *, ASTMatcher *) override;
1850 };
1851
1852 class CPLUSPLUS_EXPORT QualifiedNameAST: public NameAST
1853 {
1854 public:
1855 int global_scope_token = 0;
1856 NestedNameSpecifierListAST *nested_name_specifier_list = nullptr;
1857 NameAST *unqualified_name = nullptr;
1858
1859 public:
asQualifiedName()1860 QualifiedNameAST *asQualifiedName() override { return this; }
1861
1862 int firstToken() const override;
1863 int lastToken() const override;
1864
1865 QualifiedNameAST *clone(MemoryPool *pool) const override;
1866
1867 protected:
1868 void accept0(ASTVisitor *visitor) override;
1869 bool match0(AST *, ASTMatcher *) override;
1870 };
1871
1872 class CPLUSPLUS_EXPORT OperatorFunctionIdAST: public NameAST
1873 {
1874 public:
1875 int operator_token = 0;
1876 OperatorAST *op = nullptr;
1877
1878 public:
asOperatorFunctionId()1879 OperatorFunctionIdAST *asOperatorFunctionId() override { return this; }
1880
1881 int firstToken() const override;
1882 int lastToken() const override;
1883
1884 OperatorFunctionIdAST *clone(MemoryPool *pool) const override;
1885
1886 protected:
1887 void accept0(ASTVisitor *visitor) override;
1888 bool match0(AST *, ASTMatcher *) override;
1889 };
1890
1891 class CPLUSPLUS_EXPORT ConversionFunctionIdAST: public NameAST
1892 {
1893 public:
1894 int operator_token = 0;
1895 SpecifierListAST *type_specifier_list = nullptr;
1896 PtrOperatorListAST *ptr_operator_list = nullptr;
1897
1898 public:
asConversionFunctionId()1899 ConversionFunctionIdAST *asConversionFunctionId() override { return this; }
1900
1901 int firstToken() const override;
1902 int lastToken() const override;
1903
1904 ConversionFunctionIdAST *clone(MemoryPool *pool) const override;
1905
1906 protected:
1907 void accept0(ASTVisitor *visitor) override;
1908 bool match0(AST *, ASTMatcher *) override;
1909 };
1910
1911 class CPLUSPLUS_EXPORT AnonymousNameAST: public NameAST
1912 {
1913 public:
1914 int class_token = 0;
1915
1916 public:
asAnonymousName()1917 AnonymousNameAST *asAnonymousName() override { return this; }
firstToken()1918 int firstToken() const override { return 0; }
lastToken()1919 int lastToken() const override { return 0; }
1920
1921 AnonymousNameAST *clone(MemoryPool *pool) const override;
1922
1923 protected:
1924 void accept0(ASTVisitor *visitor) override;
1925 bool match0(AST *, ASTMatcher *) override;
1926 };
1927
1928 class CPLUSPLUS_EXPORT SimpleNameAST: public NameAST
1929 {
1930 public:
1931 int identifier_token = 0;
1932
1933 public:
asSimpleName()1934 SimpleNameAST *asSimpleName() override { return this; }
1935
1936 int firstToken() const override;
1937 int lastToken() const override;
1938
1939 SimpleNameAST *clone(MemoryPool *pool) const override;
1940
1941 protected:
1942 void accept0(ASTVisitor *visitor) override;
1943 bool match0(AST *, ASTMatcher *) override;
1944 };
1945
1946 class CPLUSPLUS_EXPORT DestructorNameAST: public NameAST
1947 {
1948 public:
1949 int tilde_token = 0;
1950 NameAST *unqualified_name = nullptr;
1951
1952 public:
asDestructorName()1953 DestructorNameAST *asDestructorName() override { return this; }
1954
1955 int firstToken() const override;
1956 int lastToken() const override;
1957
1958 DestructorNameAST *clone(MemoryPool *pool) const override;
1959
1960 protected:
1961 void accept0(ASTVisitor *visitor) override;
1962 bool match0(AST *, ASTMatcher *) override;
1963 };
1964
1965 class CPLUSPLUS_EXPORT TemplateIdAST: public NameAST
1966 {
1967 public:
1968 int template_token = 0;
1969 int identifier_token = 0;
1970 int less_token = 0;
1971 ExpressionListAST *template_argument_list = nullptr;
1972 int greater_token = 0;
1973
1974 public:
asTemplateId()1975 TemplateIdAST *asTemplateId() override { return this; }
1976
1977 int firstToken() const override;
1978 int lastToken() const override;
1979
1980 TemplateIdAST *clone(MemoryPool *pool) const override;
1981
1982 protected:
1983 void accept0(ASTVisitor *visitor) override;
1984 bool match0(AST *, ASTMatcher *) override;
1985 };
1986
1987 class CPLUSPLUS_EXPORT NamespaceAST: public DeclarationAST
1988 {
1989 public:
1990 int inline_token = 0;
1991 int namespace_token = 0;
1992 int identifier_token = 0;
1993 SpecifierListAST *attribute_list = nullptr;
1994 DeclarationAST *linkage_body = nullptr;
1995
1996 public: // annotations
1997 Namespace *symbol = nullptr;
1998
1999 public:
asNamespace()2000 NamespaceAST *asNamespace() override { return this; }
2001
2002 int firstToken() const override;
2003 int lastToken() const override;
2004
2005 NamespaceAST *clone(MemoryPool *pool) const override;
2006
2007 protected:
2008 void accept0(ASTVisitor *visitor) override;
2009 bool match0(AST *, ASTMatcher *) override;
2010 };
2011
2012 class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
2013 {
2014 public:
2015 int namespace_token = 0;
2016 int namespace_name_token = 0;
2017 int equal_token = 0;
2018 NameAST *name = nullptr;
2019 int semicolon_token = 0;
2020
2021 public:
asNamespaceAliasDefinition()2022 NamespaceAliasDefinitionAST *asNamespaceAliasDefinition() override { return this; }
2023
2024 int firstToken() const override;
2025 int lastToken() const override;
2026
2027 NamespaceAliasDefinitionAST *clone(MemoryPool *pool) const override;
2028
2029 protected:
2030 void accept0(ASTVisitor *visitor) override;
2031 bool match0(AST *, ASTMatcher *) override;
2032 };
2033
2034 class CPLUSPLUS_EXPORT AliasDeclarationAST: public DeclarationAST
2035 {
2036 public:
2037 int using_token = 0;
2038 NameAST *name = nullptr;
2039 int equal_token = 0;
2040 TypeIdAST *typeId = nullptr;
2041 int semicolon_token = 0;
2042
2043 public: // annotations
2044 Declaration *symbol = nullptr;
2045
2046 public:
asAliasDeclaration()2047 AliasDeclarationAST *asAliasDeclaration() override { return this; }
2048
2049 int firstToken() const override;
2050 int lastToken() const override;
2051
2052 AliasDeclarationAST *clone(MemoryPool *pool) const override;
2053
2054 protected:
2055 void accept0(ASTVisitor *visitor) override;
2056 bool match0(AST *, ASTMatcher *) override;
2057 };
2058
2059 class CPLUSPLUS_EXPORT ExpressionListParenAST: public ExpressionAST
2060 {
2061 public:
2062 int lparen_token = 0;
2063 ExpressionListAST *expression_list = nullptr;
2064 int rparen_token = 0;
2065
2066 public:
asExpressionListParen()2067 ExpressionListParenAST *asExpressionListParen() override { return this; }
2068
2069 int firstToken() const override;
2070 int lastToken() const override;
2071
2072 ExpressionListParenAST *clone(MemoryPool *pool) const override;
2073
2074 protected:
2075 void accept0(ASTVisitor *visitor) override;
2076 bool match0(AST *, ASTMatcher *) override;
2077 };
2078
2079 class CPLUSPLUS_EXPORT NewArrayDeclaratorAST: public AST
2080 {
2081 public:
2082 int lbracket_token = 0;
2083 ExpressionAST *expression = nullptr;
2084 int rbracket_token = 0;
2085
2086 public:
asNewArrayDeclarator()2087 NewArrayDeclaratorAST *asNewArrayDeclarator() override { return this; }
2088
2089 int firstToken() const override;
2090 int lastToken() const override;
2091
2092 NewArrayDeclaratorAST *clone(MemoryPool *pool) const override;
2093
2094 protected:
2095 void accept0(ASTVisitor *visitor) override;
2096 bool match0(AST *, ASTMatcher *) override;
2097 };
2098
2099 class CPLUSPLUS_EXPORT NewExpressionAST: public ExpressionAST
2100 {
2101 public:
2102 int scope_token = 0;
2103 int new_token = 0;
2104 ExpressionListParenAST *new_placement = nullptr;
2105
2106 int lparen_token = 0;
2107 ExpressionAST *type_id = nullptr;
2108 int rparen_token = 0;
2109
2110 NewTypeIdAST *new_type_id = nullptr;
2111
2112 ExpressionAST *new_initializer = nullptr; // either ExpressionListParenAST or BracedInitializerAST
2113
2114 public:
asNewExpression()2115 NewExpressionAST *asNewExpression() override { return this; }
2116
2117 int firstToken() const override;
2118 int lastToken() const override;
2119
2120 NewExpressionAST *clone(MemoryPool *pool) const override;
2121
2122 protected:
2123 void accept0(ASTVisitor *visitor) override;
2124 bool match0(AST *, ASTMatcher *) override;
2125 };
2126
2127 class CPLUSPLUS_EXPORT NewTypeIdAST: public AST
2128 {
2129 public:
2130 SpecifierListAST *type_specifier_list = nullptr;
2131 PtrOperatorListAST *ptr_operator_list = nullptr;
2132 NewArrayDeclaratorListAST *new_array_declarator_list = nullptr;
2133
2134 public:
asNewTypeId()2135 NewTypeIdAST *asNewTypeId() override { return this; }
2136
2137 int firstToken() const override;
2138 int lastToken() const override;
2139
2140 NewTypeIdAST *clone(MemoryPool *pool) const override;
2141
2142 protected:
2143 void accept0(ASTVisitor *visitor) override;
2144 bool match0(AST *, ASTMatcher *) override;
2145 };
2146
2147 class CPLUSPLUS_EXPORT OperatorAST: public AST
2148 {
2149 public:
2150 int op_token = 0;
2151 int open_token = 0;
2152 int close_token = 0;
2153
2154 public:
asOperator()2155 OperatorAST *asOperator() override{ return this; }
2156
2157 int firstToken() const override;
2158 int lastToken() const override;
2159
2160 OperatorAST *clone(MemoryPool *pool) const override;
2161
2162 protected:
2163 void accept0(ASTVisitor *visitor) override;
2164 bool match0(AST *, ASTMatcher *) override;
2165 };
2166
2167 class CPLUSPLUS_EXPORT ParameterDeclarationAST: public DeclarationAST
2168 {
2169 public:
2170 SpecifierListAST *type_specifier_list = nullptr;
2171 DeclaratorAST *declarator = nullptr;
2172 int equal_token = 0;
2173 ExpressionAST *expression = nullptr;
2174
2175 public: // annotations
2176 Argument *symbol = nullptr;
2177
2178 public:
asParameterDeclaration()2179 ParameterDeclarationAST *asParameterDeclaration() override { return this; }
2180
2181 int firstToken() const override;
2182 int lastToken() const override;
2183
2184 ParameterDeclarationAST *clone(MemoryPool *pool) const override;
2185
2186 protected:
2187 void accept0(ASTVisitor *visitor) override;
2188 bool match0(AST *, ASTMatcher *) override;
2189 };
2190
2191 class CPLUSPLUS_EXPORT ParameterDeclarationClauseAST: public AST
2192 {
2193 public:
2194 ParameterDeclarationListAST *parameter_declaration_list = nullptr;
2195 int dot_dot_dot_token = 0;
2196
2197 public:
asParameterDeclarationClause()2198 ParameterDeclarationClauseAST *asParameterDeclarationClause() override { return this; }
2199
2200 int firstToken() const override;
2201 int lastToken() const override;
2202
2203 ParameterDeclarationClauseAST *clone(MemoryPool *pool) const override;
2204
2205 protected:
2206 void accept0(ASTVisitor *visitor) override;
2207 bool match0(AST *, ASTMatcher *) override;
2208 };
2209
2210 class CPLUSPLUS_EXPORT CallAST: public PostfixAST
2211 {
2212 public:
2213 ExpressionAST *base_expression = nullptr;
2214 int lparen_token = 0;
2215 ExpressionListAST *expression_list = nullptr;
2216 int rparen_token = 0;
2217
2218 public:
asCall()2219 CallAST *asCall() override { return this; }
2220
2221 int firstToken() const override;
2222 int lastToken() const override;
2223
2224 CallAST *clone(MemoryPool *pool) const override;
2225
2226 protected:
2227 void accept0(ASTVisitor *visitor) override;
2228 bool match0(AST *, ASTMatcher *) override;
2229 };
2230
2231 class CPLUSPLUS_EXPORT ArrayAccessAST: public PostfixAST
2232 {
2233 public:
2234 ExpressionAST *base_expression = nullptr;
2235 int lbracket_token = 0;
2236 ExpressionAST *expression = nullptr;
2237 int rbracket_token = 0;
2238
2239 public:
asArrayAccess()2240 ArrayAccessAST *asArrayAccess() override { return this; }
2241
2242 int firstToken() const override;
2243 int lastToken() const override;
2244
2245 ArrayAccessAST *clone(MemoryPool *pool) const override;
2246
2247 protected:
2248 void accept0(ASTVisitor *visitor) override;
2249 bool match0(AST *, ASTMatcher *) override;
2250 };
2251
2252 class CPLUSPLUS_EXPORT PostIncrDecrAST: public PostfixAST
2253 {
2254 public:
2255 ExpressionAST *base_expression = nullptr;
2256 int incr_decr_token = 0;
2257
2258 public:
asPostIncrDecr()2259 PostIncrDecrAST *asPostIncrDecr() override{ return this; }
2260
2261 int firstToken() const override;
2262 int lastToken() const override;
2263
2264 PostIncrDecrAST *clone(MemoryPool *pool) const override;
2265
2266 protected:
2267 void accept0(ASTVisitor *visitor) override;
2268 bool match0(AST *, ASTMatcher *) override;
2269 };
2270
2271 class CPLUSPLUS_EXPORT MemberAccessAST: public PostfixAST
2272 {
2273 public:
2274 ExpressionAST *base_expression = nullptr;
2275 int access_token = 0;
2276 int template_token = 0;
2277 NameAST *member_name = nullptr;
2278
2279 public:
asMemberAccess()2280 MemberAccessAST *asMemberAccess() override { return this; }
2281
2282 int firstToken() const override;
2283 int lastToken() const override;
2284
2285 MemberAccessAST *clone(MemoryPool *pool) const override;
2286
2287 protected:
2288 void accept0(ASTVisitor *visitor) override;
2289 bool match0(AST *, ASTMatcher *) override;
2290 };
2291
2292 class CPLUSPLUS_EXPORT TypeidExpressionAST: public ExpressionAST
2293 {
2294 public:
2295 int typeid_token = 0;
2296 int lparen_token = 0;
2297 ExpressionAST *expression = nullptr;
2298 int rparen_token = 0;
2299
2300 public:
asTypeidExpression()2301 TypeidExpressionAST *asTypeidExpression() override { return this; }
2302
2303 int firstToken() const override;
2304 int lastToken() const override;
2305
2306 TypeidExpressionAST *clone(MemoryPool *pool) const override;
2307
2308 protected:
2309 void accept0(ASTVisitor *visitor) override;
2310 bool match0(AST *, ASTMatcher *) override;
2311 };
2312
2313 class CPLUSPLUS_EXPORT TypenameCallExpressionAST: public ExpressionAST
2314 {
2315 public:
2316 int typename_token = 0;
2317 NameAST *name = nullptr;
2318 ExpressionAST *expression = nullptr; // either ExpressionListParenAST or BracedInitializerAST
2319
2320 public:
asTypenameCallExpression()2321 TypenameCallExpressionAST *asTypenameCallExpression() override { return this; }
2322
2323 int firstToken() const override;
2324 int lastToken() const override;
2325
2326 TypenameCallExpressionAST *clone(MemoryPool *pool) const override;
2327
2328 protected:
2329 void accept0(ASTVisitor *visitor) override;
2330 bool match0(AST *, ASTMatcher *) override;
2331 };
2332
2333 class CPLUSPLUS_EXPORT TypeConstructorCallAST: public ExpressionAST
2334 {
2335 public:
2336 SpecifierListAST *type_specifier_list = nullptr;
2337 ExpressionAST *expression = nullptr; // either ExpressionListParenAST or BracedInitializerAST
2338
2339 public:
asTypeConstructorCall()2340 TypeConstructorCallAST *asTypeConstructorCall() override { return this; }
2341
2342 int firstToken() const override;
2343 int lastToken() const override;
2344
2345 TypeConstructorCallAST *clone(MemoryPool *pool) const override;
2346
2347 protected:
2348 void accept0(ASTVisitor *visitor) override;
2349 bool match0(AST *, ASTMatcher *) override;
2350 };
2351
2352 class CPLUSPLUS_EXPORT PointerToMemberAST: public PtrOperatorAST
2353 {
2354 public:
2355 int global_scope_token = 0;
2356 NestedNameSpecifierListAST *nested_name_specifier_list = nullptr;
2357 int star_token = 0;
2358 SpecifierListAST *cv_qualifier_list = nullptr;
2359 int ref_qualifier_token = 0;
2360
2361 public:
asPointerToMember()2362 PointerToMemberAST *asPointerToMember() override { return this; }
2363
2364 int firstToken() const override;
2365 int lastToken() const override;
2366
2367 PointerToMemberAST *clone(MemoryPool *pool) const override;
2368
2369 protected:
2370 void accept0(ASTVisitor *visitor) override;
2371 bool match0(AST *, ASTMatcher *) override;
2372 };
2373
2374 class CPLUSPLUS_EXPORT PointerAST: public PtrOperatorAST
2375 {
2376 public:
2377 int star_token = 0;
2378 SpecifierListAST *cv_qualifier_list = nullptr;
2379
2380 public:
asPointer()2381 PointerAST *asPointer() override { return this; }
2382
2383 int firstToken() const override;
2384 int lastToken() const override;
2385
2386 PointerAST *clone(MemoryPool *pool) const override;
2387
2388 protected:
2389 void accept0(ASTVisitor *visitor) override;
2390 bool match0(AST *, ASTMatcher *) override;
2391 };
2392
2393 class CPLUSPLUS_EXPORT ReferenceAST: public PtrOperatorAST
2394 {
2395 public:
2396 int reference_token = 0;
2397
2398 public:
asReference()2399 ReferenceAST *asReference() override { return this; }
2400
2401 int firstToken() const override;
2402 int lastToken() const override;
2403
2404 ReferenceAST *clone(MemoryPool *pool) const override;
2405
2406 protected:
2407 void accept0(ASTVisitor *visitor) override;
2408 bool match0(AST *, ASTMatcher *) override;
2409 };
2410
2411 class CPLUSPLUS_EXPORT BreakStatementAST: public StatementAST
2412 {
2413 public:
2414 int break_token = 0;
2415 int semicolon_token = 0;
2416
2417 public:
asBreakStatement()2418 BreakStatementAST *asBreakStatement() override { return this; }
2419
2420 int firstToken() const override;
2421 int lastToken() const override;
2422
2423 BreakStatementAST *clone(MemoryPool *pool) const override;
2424
2425 protected:
2426 void accept0(ASTVisitor *visitor) override;
2427 bool match0(AST *, ASTMatcher *) override;
2428 };
2429
2430 class CPLUSPLUS_EXPORT ContinueStatementAST: public StatementAST
2431 {
2432 public:
2433 int continue_token = 0;
2434 int semicolon_token = 0;
2435
2436 public:
asContinueStatement()2437 ContinueStatementAST *asContinueStatement() override { return this; }
2438
2439 int firstToken() const override;
2440 int lastToken() const override;
2441
2442 ContinueStatementAST *clone(MemoryPool *pool) const override;
2443
2444 protected:
2445 void accept0(ASTVisitor *visitor) override;
2446 bool match0(AST *, ASTMatcher *) override;
2447 };
2448
2449 class CPLUSPLUS_EXPORT GotoStatementAST: public StatementAST
2450 {
2451 public:
2452 int goto_token = 0;
2453 int identifier_token = 0;
2454 int semicolon_token = 0;
2455
2456 public:
asGotoStatement()2457 GotoStatementAST *asGotoStatement() override { return this; }
2458
2459 int firstToken() const override;
2460 int lastToken() const override;
2461
2462 GotoStatementAST *clone(MemoryPool *pool) const override;
2463
2464 protected:
2465 void accept0(ASTVisitor *visitor) override;
2466 bool match0(AST *, ASTMatcher *) override;
2467 };
2468
2469 class CPLUSPLUS_EXPORT ReturnStatementAST: public StatementAST
2470 {
2471 public:
2472 int return_token = 0;
2473 ExpressionAST *expression = nullptr;
2474 int semicolon_token = 0;
2475
2476 public:
asReturnStatement()2477 ReturnStatementAST *asReturnStatement() override { return this; }
2478
2479 int firstToken() const override;
2480 int lastToken() const override;
2481
2482 ReturnStatementAST *clone(MemoryPool *pool) const override;
2483
2484 protected:
2485 void accept0(ASTVisitor *visitor) override;
2486 bool match0(AST *, ASTMatcher *) override;
2487 };
2488
2489 class CPLUSPLUS_EXPORT SizeofExpressionAST: public ExpressionAST
2490 {
2491 public:
2492 int sizeof_token = 0;
2493 int dot_dot_dot_token = 0;
2494 int lparen_token = 0;
2495 ExpressionAST *expression = nullptr;
2496 int rparen_token = 0;
2497
2498 public:
asSizeofExpression()2499 SizeofExpressionAST *asSizeofExpression() override { return this; }
2500
2501 int firstToken() const override;
2502 int lastToken() const override;
2503
2504 SizeofExpressionAST *clone(MemoryPool *pool) const override;
2505
2506 protected:
2507 void accept0(ASTVisitor *visitor) override;
2508 bool match0(AST *, ASTMatcher *) override;
2509 };
2510
2511 class CPLUSPLUS_EXPORT AlignofExpressionAST: public ExpressionAST
2512 {
2513 public:
2514 int alignof_token = 0;
2515 int lparen_token = 0;
2516 TypeIdAST *typeId = nullptr;
2517 int rparen_token = 0;
2518
2519 public:
asAlignofExpression()2520 AlignofExpressionAST *asAlignofExpression() override { return this; }
2521
2522 int firstToken() const override;
2523 int lastToken() const override;
2524
2525 AlignofExpressionAST *clone(MemoryPool *pool) const override;
2526
2527 protected:
2528 void accept0(ASTVisitor *visitor) override;
2529 bool match0(AST *, ASTMatcher *) override;
2530 };
2531
2532 class CPLUSPLUS_EXPORT PointerLiteralAST: public ExpressionAST
2533 {
2534 public:
2535 int literal_token = 0;
2536
2537 public:
asPointerLiteral()2538 PointerLiteralAST *asPointerLiteral() override { return this; }
2539
2540 int firstToken() const override;
2541 int lastToken() const override;
2542
2543 PointerLiteralAST *clone(MemoryPool *pool) const override;
2544
2545 protected:
2546 void accept0(ASTVisitor *visitor) override;
2547 bool match0(AST *, ASTMatcher *) override;
2548 };
2549
2550 class CPLUSPLUS_EXPORT NumericLiteralAST: public ExpressionAST
2551 {
2552 public:
2553 int literal_token = 0;
2554
2555 public:
asNumericLiteral()2556 NumericLiteralAST *asNumericLiteral() override { return this; }
2557
2558 int firstToken() const override;
2559 int lastToken() const override;
2560
2561 NumericLiteralAST *clone(MemoryPool *pool) const override;
2562
2563 protected:
2564 void accept0(ASTVisitor *visitor) override;
2565 bool match0(AST *, ASTMatcher *) override;
2566 };
2567
2568 class CPLUSPLUS_EXPORT BoolLiteralAST: public ExpressionAST
2569 {
2570 public:
2571 int literal_token = 0;
2572
2573 public:
asBoolLiteral()2574 BoolLiteralAST *asBoolLiteral() override { return this; }
2575
2576 int firstToken() const override;
2577 int lastToken() const override;
2578
2579 BoolLiteralAST *clone(MemoryPool *pool) const override;
2580
2581 protected:
2582 void accept0(ASTVisitor *visitor) override;
2583 bool match0(AST *, ASTMatcher *) override;
2584 };
2585
2586 class CPLUSPLUS_EXPORT ThisExpressionAST: public ExpressionAST
2587 {
2588 public:
2589 int this_token = 0;
2590
2591 public:
asThisExpression()2592 ThisExpressionAST *asThisExpression() override { return this; }
2593
2594 int firstToken() const override;
2595 int lastToken() const override;
2596
2597 ThisExpressionAST *clone(MemoryPool *pool) const override;
2598
2599 protected:
2600 void accept0(ASTVisitor *visitor) override;
2601 bool match0(AST *, ASTMatcher *) override;
2602 };
2603
2604 class CPLUSPLUS_EXPORT NestedExpressionAST: public ExpressionAST
2605 {
2606 public:
2607 int lparen_token = 0;
2608 ExpressionAST *expression = nullptr;
2609 int rparen_token = 0;
2610
2611 public:
asNestedExpression()2612 NestedExpressionAST *asNestedExpression() override { return this; }
2613
2614 int firstToken() const override;
2615 int lastToken() const override;
2616
2617 NestedExpressionAST *clone(MemoryPool *pool) const override;
2618
2619 protected:
2620 void accept0(ASTVisitor *visitor) override;
2621 bool match0(AST *, ASTMatcher *) override;
2622 };
2623
2624 class CPLUSPLUS_EXPORT StaticAssertDeclarationAST: public DeclarationAST
2625 {
2626 public:
2627 int static_assert_token = 0;
2628 int lparen_token = 0;
2629 ExpressionAST *expression = nullptr;
2630 int comma_token = 0;
2631 ExpressionAST *string_literal = nullptr;
2632 int rparen_token = 0;
2633 int semicolon_token = 0;
2634
2635 public:
asStaticAssertDeclaration()2636 StaticAssertDeclarationAST *asStaticAssertDeclaration() override { return this; }
2637
2638 int firstToken() const override;
2639 int lastToken() const override;
2640
2641 StaticAssertDeclarationAST *clone(MemoryPool *pool) const override;
2642
2643 protected:
2644 void accept0(ASTVisitor *visitor) override;
2645 bool match0(AST *, ASTMatcher *) override;
2646 };
2647
2648 class CPLUSPLUS_EXPORT StringLiteralAST: public ExpressionAST
2649 {
2650 public:
2651 int literal_token = 0;
2652 StringLiteralAST *next = nullptr;
2653
2654 public:
asStringLiteral()2655 StringLiteralAST *asStringLiteral() override { return this; }
2656
2657 int firstToken() const override;
2658 int lastToken() const override;
2659
2660 StringLiteralAST *clone(MemoryPool *pool) const override;
2661
2662 protected:
2663 void accept0(ASTVisitor *visitor) override;
2664 bool match0(AST *, ASTMatcher *) override;
2665 };
2666
2667 class CPLUSPLUS_EXPORT SwitchStatementAST: public StatementAST
2668 {
2669 public:
2670 int switch_token = 0;
2671 int lparen_token = 0;
2672 ExpressionAST *condition = nullptr;
2673 int rparen_token = 0;
2674 StatementAST *statement = nullptr;
2675
2676 public: // annotations
2677 Block *symbol = nullptr;
2678
2679 public:
asSwitchStatement()2680 SwitchStatementAST *asSwitchStatement() override { return this; }
2681
2682 int firstToken() const override;
2683 int lastToken() const override;
2684
2685 SwitchStatementAST *clone(MemoryPool *pool) const override;
2686
2687 protected:
2688 void accept0(ASTVisitor *visitor) override;
2689 bool match0(AST *, ASTMatcher *) override;
2690 };
2691
2692 class CPLUSPLUS_EXPORT TemplateDeclarationAST: public DeclarationAST
2693 {
2694 public:
2695 int export_token = 0;
2696 int template_token = 0;
2697 int less_token = 0;
2698 DeclarationListAST *template_parameter_list = nullptr;
2699 int greater_token = 0;
2700 DeclarationAST *declaration = nullptr;
2701
2702 public: // annotations
2703 Template *symbol = nullptr;
2704
2705 public:
asTemplateDeclaration()2706 TemplateDeclarationAST *asTemplateDeclaration() override { return this; }
2707
2708 int firstToken() const override;
2709 int lastToken() const override;
2710
2711 TemplateDeclarationAST *clone(MemoryPool *pool) const override;
2712
2713 protected:
2714 void accept0(ASTVisitor *visitor) override;
2715 bool match0(AST *, ASTMatcher *) override;
2716 };
2717
2718 class CPLUSPLUS_EXPORT ThrowExpressionAST: public ExpressionAST
2719 {
2720 public:
2721 int throw_token = 0;
2722 ExpressionAST *expression = nullptr;
2723
2724 public:
asThrowExpression()2725 ThrowExpressionAST *asThrowExpression() override { return this; }
2726
2727 int firstToken() const override;
2728 int lastToken() const override;
2729
2730 ThrowExpressionAST *clone(MemoryPool *pool) const override;
2731
2732 protected:
2733 void accept0(ASTVisitor *visitor) override;
2734 bool match0(AST *, ASTMatcher *) override;
2735 };
2736
2737 class CPLUSPLUS_EXPORT NoExceptOperatorExpressionAST: public ExpressionAST
2738 {
2739 public:
2740 int noexcept_token = 0;
2741 ExpressionAST *expression = nullptr;
2742
2743 public:
asNoExceptOperatorExpression()2744 NoExceptOperatorExpressionAST *asNoExceptOperatorExpression() override { return this; }
2745
2746 int firstToken() const override;
2747 int lastToken() const override;
2748
2749 NoExceptOperatorExpressionAST *clone(MemoryPool *pool) const override;
2750
2751 protected:
2752 void accept0(ASTVisitor *visitor) override;
2753 bool match0(AST *, ASTMatcher *) override;
2754 };
2755
2756 class CPLUSPLUS_EXPORT TranslationUnitAST: public AST
2757 {
2758 public:
2759 DeclarationListAST *declaration_list = nullptr;
2760
2761 public:
asTranslationUnit()2762 TranslationUnitAST *asTranslationUnit() override { return this; }
2763
2764 int firstToken() const override;
2765 int lastToken() const override;
2766
2767 TranslationUnitAST *clone(MemoryPool *pool) const override;
2768
2769 protected:
2770 void accept0(ASTVisitor *visitor) override;
2771 bool match0(AST *, ASTMatcher *) override;
2772 };
2773
2774 class CPLUSPLUS_EXPORT TryBlockStatementAST: public StatementAST
2775 {
2776 public:
2777 int try_token = 0;
2778 StatementAST *statement = nullptr;
2779 CatchClauseListAST *catch_clause_list = nullptr;
2780
2781 public:
asTryBlockStatement()2782 TryBlockStatementAST *asTryBlockStatement() override { return this; }
2783
2784 int firstToken() const override;
2785 int lastToken() const override;
2786
2787 TryBlockStatementAST *clone(MemoryPool *pool) const override;
2788
2789 protected:
2790 void accept0(ASTVisitor *visitor) override;
2791 bool match0(AST *, ASTMatcher *) override;
2792 };
2793
2794 class CPLUSPLUS_EXPORT CatchClauseAST: public StatementAST
2795 {
2796 public:
2797 int catch_token = 0;
2798 int lparen_token = 0;
2799 ExceptionDeclarationAST *exception_declaration = nullptr;
2800 int rparen_token = 0;
2801 StatementAST *statement = nullptr;
2802
2803 public: // annotations
2804 Block *symbol = nullptr;
2805
2806 public:
asCatchClause()2807 CatchClauseAST *asCatchClause() override { return this; }
2808
2809 int firstToken() const override;
2810 int lastToken() const override;
2811
2812 CatchClauseAST *clone(MemoryPool *pool) const override;
2813
2814 protected:
2815 void accept0(ASTVisitor *visitor) override;
2816 bool match0(AST *, ASTMatcher *) override;
2817 };
2818
2819 class CPLUSPLUS_EXPORT TypeIdAST: public ExpressionAST
2820 {
2821 public:
2822 SpecifierListAST *type_specifier_list = nullptr;
2823 DeclaratorAST *declarator = nullptr;
2824
2825 public:
asTypeId()2826 TypeIdAST *asTypeId() override { return this; }
2827
2828 int firstToken() const override;
2829 int lastToken() const override;
2830
2831 TypeIdAST *clone(MemoryPool *pool) const override;
2832
2833 protected:
2834 void accept0(ASTVisitor *visitor) override;
2835 bool match0(AST *, ASTMatcher *) override;
2836 };
2837
2838 class CPLUSPLUS_EXPORT TypenameTypeParameterAST: public DeclarationAST
2839 {
2840 public:
2841 int classkey_token = 0;
2842 int dot_dot_dot_token = 0;
2843 NameAST *name = nullptr;
2844 int equal_token = 0;
2845 ExpressionAST *type_id = nullptr;
2846
2847 public: // annotations
2848 TypenameArgument *symbol = nullptr;
2849
2850 public:
asTypenameTypeParameter()2851 TypenameTypeParameterAST *asTypenameTypeParameter() override { return this; }
2852
2853 int firstToken() const override;
2854 int lastToken() const override;
2855
2856 TypenameTypeParameterAST *clone(MemoryPool *pool) const override;
2857
2858 protected:
2859 void accept0(ASTVisitor *visitor) override;
2860 bool match0(AST *, ASTMatcher *) override;
2861 };
2862
2863 class CPLUSPLUS_EXPORT TemplateTypeParameterAST: public DeclarationAST
2864 {
2865 public:
2866 int template_token = 0;
2867 int less_token = 0;
2868 DeclarationListAST *template_parameter_list = nullptr;
2869 int greater_token = 0;
2870 int class_token = 0;
2871 int dot_dot_dot_token = 0;
2872 NameAST *name = nullptr;
2873 int equal_token = 0;
2874 ExpressionAST *type_id = nullptr;
2875
2876 public:
2877 TypenameArgument *symbol = nullptr;
2878
2879 public:
asTemplateTypeParameter()2880 TemplateTypeParameterAST *asTemplateTypeParameter() override { return this; }
2881
2882 int firstToken() const override;
2883 int lastToken() const override;
2884
2885 TemplateTypeParameterAST *clone(MemoryPool *pool) const override;
2886
2887 protected:
2888 void accept0(ASTVisitor *visitor) override;
2889 bool match0(AST *, ASTMatcher *) override;
2890 };
2891
2892 class CPLUSPLUS_EXPORT UnaryExpressionAST: public ExpressionAST
2893 {
2894 public:
2895 int unary_op_token = 0;
2896 ExpressionAST *expression = nullptr;
2897
2898 public:
asUnaryExpression()2899 UnaryExpressionAST *asUnaryExpression() override { return this; }
2900
2901 int firstToken() const override;
2902 int lastToken() const override;
2903
2904 UnaryExpressionAST *clone(MemoryPool *pool) const override;
2905
2906 protected:
2907 void accept0(ASTVisitor *visitor) override;
2908 bool match0(AST *, ASTMatcher *) override;
2909 };
2910
2911 class CPLUSPLUS_EXPORT UsingAST: public DeclarationAST
2912 {
2913 public:
2914 int using_token = 0;
2915 int typename_token = 0;
2916 NameAST *name = nullptr;
2917 int semicolon_token = 0;
2918
2919 public: // annotations
2920 UsingDeclaration *symbol = nullptr;
2921
2922 public:
asUsing()2923 UsingAST *asUsing() override { return this; }
2924
2925 int firstToken() const override;
2926 int lastToken() const override;
2927
2928 UsingAST *clone(MemoryPool *pool) const override;
2929
2930 protected:
2931 void accept0(ASTVisitor *visitor) override;
2932 bool match0(AST *, ASTMatcher *) override;
2933 };
2934
2935 class CPLUSPLUS_EXPORT UsingDirectiveAST: public DeclarationAST
2936 {
2937 public:
2938 int using_token = 0;
2939 int namespace_token = 0;
2940 NameAST *name = nullptr;
2941 int semicolon_token = 0;
2942
2943 public:
2944 UsingNamespaceDirective *symbol = nullptr;
2945
2946 public:
asUsingDirective()2947 UsingDirectiveAST *asUsingDirective() override { return this; }
2948
2949 int firstToken() const override;
2950 int lastToken() const override;
2951
2952 UsingDirectiveAST *clone(MemoryPool *pool) const override;
2953
2954 protected:
2955 void accept0(ASTVisitor *visitor) override;
2956 bool match0(AST *, ASTMatcher *) override;
2957 };
2958
2959 class CPLUSPLUS_EXPORT WhileStatementAST: public StatementAST
2960 {
2961 public:
2962 int while_token = 0;
2963 int lparen_token = 0;
2964 ExpressionAST *condition = nullptr;
2965 int rparen_token = 0;
2966 StatementAST *statement = nullptr;
2967
2968 public: // annotations
2969 Block *symbol = nullptr;
2970
2971 public:
asWhileStatement()2972 WhileStatementAST *asWhileStatement() override { return this; }
2973
2974 int firstToken() const override;
2975 int lastToken() const override;
2976
2977 WhileStatementAST *clone(MemoryPool *pool) const override;
2978
2979 protected:
2980 void accept0(ASTVisitor *visitor) override;
2981 bool match0(AST *, ASTMatcher *) override;
2982 };
2983
2984 class CPLUSPLUS_EXPORT ObjCClassForwardDeclarationAST: public DeclarationAST
2985 {
2986 public:
2987 SpecifierListAST *attribute_list = nullptr;
2988 int class_token = 0;
2989 NameListAST *identifier_list = nullptr;
2990 int semicolon_token = 0;
2991
2992 public: // annotations
2993 List<ObjCForwardClassDeclaration *> *symbols = nullptr;
2994
2995 public:
asObjCClassForwardDeclaration()2996 ObjCClassForwardDeclarationAST *asObjCClassForwardDeclaration() override { return this; }
2997
2998 int firstToken() const override;
2999 int lastToken() const override;
3000
3001 ObjCClassForwardDeclarationAST *clone(MemoryPool *pool) const override;
3002
3003 protected:
3004 void accept0(ASTVisitor *visitor) override;
3005 bool match0(AST *, ASTMatcher *) override;
3006 };
3007
3008 class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
3009 {
3010 public:
3011 SpecifierListAST *attribute_list = nullptr;
3012 int interface_token = 0;
3013 int implementation_token = 0;
3014 NameAST *class_name = nullptr;
3015 int lparen_token = 0;
3016 NameAST *category_name = nullptr;
3017 int rparen_token = 0;
3018 int colon_token = 0;
3019 NameAST *superclass = nullptr;
3020 ObjCProtocolRefsAST *protocol_refs = nullptr;
3021 ObjCInstanceVariablesDeclarationAST *inst_vars_decl = nullptr;
3022 DeclarationListAST *member_declaration_list = nullptr;
3023 int end_token = 0;
3024
3025 public: // annotations
3026 ObjCClass *symbol = nullptr;
3027
3028 public:
asObjCClassDeclaration()3029 ObjCClassDeclarationAST *asObjCClassDeclaration() override { return this; }
3030
3031 int firstToken() const override;
3032 int lastToken() const override;
3033
3034 ObjCClassDeclarationAST *clone(MemoryPool *pool) const override;
3035
3036 protected:
3037 void accept0(ASTVisitor *visitor) override;
3038 bool match0(AST *, ASTMatcher *) override;
3039 };
3040
3041 class CPLUSPLUS_EXPORT ObjCProtocolForwardDeclarationAST: public DeclarationAST
3042 {
3043 public:
3044 SpecifierListAST *attribute_list = nullptr;
3045 int protocol_token = 0;
3046 NameListAST *identifier_list = nullptr;
3047 int semicolon_token = 0;
3048
3049 public: // annotations
3050 List<ObjCForwardProtocolDeclaration *> *symbols = nullptr;
3051
3052 public:
asObjCProtocolForwardDeclaration()3053 ObjCProtocolForwardDeclarationAST *asObjCProtocolForwardDeclaration() override { return this; }
3054
3055 int firstToken() const override;
3056 int lastToken() const override;
3057
3058 ObjCProtocolForwardDeclarationAST *clone(MemoryPool *pool) const override;
3059
3060 protected:
3061 void accept0(ASTVisitor *visitor) override;
3062 bool match0(AST *, ASTMatcher *) override;
3063 };
3064
3065 class CPLUSPLUS_EXPORT ObjCProtocolDeclarationAST: public DeclarationAST
3066 {
3067 public:
3068 SpecifierListAST *attribute_list = nullptr;
3069 int protocol_token = 0;
3070 NameAST *name = nullptr;
3071 ObjCProtocolRefsAST *protocol_refs = nullptr;
3072 DeclarationListAST *member_declaration_list = nullptr;
3073 int end_token = 0;
3074
3075 public: // annotations
3076 ObjCProtocol *symbol = nullptr;
3077
3078 public:
asObjCProtocolDeclaration()3079 ObjCProtocolDeclarationAST *asObjCProtocolDeclaration() override { return this; }
3080
3081 int firstToken() const override;
3082 int lastToken() const override;
3083
3084 ObjCProtocolDeclarationAST *clone(MemoryPool *pool) const override;
3085
3086 protected:
3087 void accept0(ASTVisitor *visitor) override;
3088 bool match0(AST *, ASTMatcher *) override;
3089 };
3090
3091 class CPLUSPLUS_EXPORT ObjCProtocolRefsAST: public AST
3092 {
3093 public:
3094 int less_token = 0;
3095 NameListAST *identifier_list = nullptr;
3096 int greater_token = 0;
3097
3098 public:
asObjCProtocolRefs()3099 ObjCProtocolRefsAST *asObjCProtocolRefs() override { return this; }
3100
3101 int firstToken() const override;
3102 int lastToken() const override;
3103
3104 ObjCProtocolRefsAST *clone(MemoryPool *pool) const override;
3105
3106 protected:
3107 void accept0(ASTVisitor *visitor) override;
3108 bool match0(AST *, ASTMatcher *) override;
3109 };
3110
3111 class CPLUSPLUS_EXPORT ObjCMessageArgumentAST: public AST
3112 {
3113 public:
3114 ExpressionAST *parameter_value_expression = nullptr;
3115
3116 public:
asObjCMessageArgument()3117 ObjCMessageArgumentAST *asObjCMessageArgument() override { return this; }
3118
3119 int firstToken() const override;
3120 int lastToken() const override;
3121
3122 ObjCMessageArgumentAST *clone(MemoryPool *pool) const override;
3123
3124 protected:
3125 void accept0(ASTVisitor *visitor) override;
3126 bool match0(AST *, ASTMatcher *) override;
3127 };
3128
3129 class CPLUSPLUS_EXPORT ObjCMessageExpressionAST: public ExpressionAST
3130 {
3131 public:
3132 int lbracket_token = 0;
3133 ExpressionAST *receiver_expression = nullptr;
3134 ObjCSelectorAST *selector = nullptr;
3135 ObjCMessageArgumentListAST *argument_list = nullptr;
3136 int rbracket_token = 0;
3137
3138 public:
asObjCMessageExpression()3139 ObjCMessageExpressionAST *asObjCMessageExpression() override { return this; }
3140
3141 int firstToken() const override;
3142 int lastToken() const override;
3143
3144 ObjCMessageExpressionAST *clone(MemoryPool *pool) const override;
3145
3146 protected:
3147 void accept0(ASTVisitor *visitor) override;
3148 bool match0(AST *, ASTMatcher *) override;
3149 };
3150
3151 class CPLUSPLUS_EXPORT ObjCProtocolExpressionAST: public ExpressionAST
3152 {
3153 public:
3154 int protocol_token = 0;
3155 int lparen_token = 0;
3156 int identifier_token = 0;
3157 int rparen_token = 0;
3158
3159 public:
asObjCProtocolExpression()3160 ObjCProtocolExpressionAST *asObjCProtocolExpression() override { return this; }
3161
3162 int firstToken() const override;
3163 int lastToken() const override;
3164
3165 ObjCProtocolExpressionAST *clone(MemoryPool *pool) const override;
3166
3167 protected:
3168 void accept0(ASTVisitor *visitor) override;
3169 bool match0(AST *, ASTMatcher *) override;
3170 };
3171
3172 class CPLUSPLUS_EXPORT ObjCTypeNameAST: public AST
3173 {
3174 public:
3175 int lparen_token = 0;
3176 int type_qualifier_token = 0;
3177 ExpressionAST *type_id = nullptr;
3178 int rparen_token = 0;
3179
3180 public:
asObjCTypeName()3181 ObjCTypeNameAST *asObjCTypeName() override { return this; }
3182
3183 int firstToken() const override;
3184 int lastToken() const override;
3185
3186 ObjCTypeNameAST *clone(MemoryPool *pool) const override;
3187
3188 protected:
3189 void accept0(ASTVisitor *visitor) override;
3190 bool match0(AST *, ASTMatcher *) override;
3191 };
3192
3193 class CPLUSPLUS_EXPORT ObjCEncodeExpressionAST: public ExpressionAST
3194 {
3195 public:
3196 int encode_token = 0;
3197 ObjCTypeNameAST *type_name = nullptr;
3198
3199 public:
asObjCEncodeExpression()3200 ObjCEncodeExpressionAST *asObjCEncodeExpression() override { return this; }
3201
3202 int firstToken() const override;
3203 int lastToken() const override;
3204
3205 ObjCEncodeExpressionAST *clone(MemoryPool *pool) const override;
3206
3207 protected:
3208 void accept0(ASTVisitor *visitor) override;
3209 bool match0(AST *, ASTMatcher *) override;
3210 };
3211
3212 class CPLUSPLUS_EXPORT ObjCSelectorExpressionAST: public ExpressionAST
3213 {
3214 public:
3215 int selector_token = 0;
3216 int lparen_token = 0;
3217 ObjCSelectorAST *selector = nullptr;
3218 int rparen_token = 0;
3219
3220 public:
asObjCSelectorExpression()3221 ObjCSelectorExpressionAST *asObjCSelectorExpression() override { return this; }
3222
3223 int firstToken() const override;
3224 int lastToken() const override;
3225
3226 ObjCSelectorExpressionAST *clone(MemoryPool *pool) const override;
3227
3228 protected:
3229 void accept0(ASTVisitor *visitor) override;
3230 bool match0(AST *, ASTMatcher *) override;
3231 };
3232
3233 class CPLUSPLUS_EXPORT ObjCInstanceVariablesDeclarationAST: public AST
3234 {
3235 public:
3236 int lbrace_token = 0;
3237 DeclarationListAST *instance_variable_list = nullptr;
3238 int rbrace_token = 0;
3239
3240 public:
asObjCInstanceVariablesDeclaration()3241 ObjCInstanceVariablesDeclarationAST *asObjCInstanceVariablesDeclaration() override { return this; }
3242
3243 int firstToken() const override;
3244 int lastToken() const override;
3245
3246 ObjCInstanceVariablesDeclarationAST *clone(MemoryPool *pool) const override;
3247
3248 protected:
3249 void accept0(ASTVisitor *visitor) override;
3250 bool match0(AST *, ASTMatcher *) override;
3251 };
3252
3253 class CPLUSPLUS_EXPORT ObjCVisibilityDeclarationAST: public DeclarationAST
3254 {
3255 public:
3256 int visibility_token = 0;
3257
3258 public:
asObjCVisibilityDeclaration()3259 ObjCVisibilityDeclarationAST *asObjCVisibilityDeclaration() override { return this; }
3260
3261 int firstToken() const override;
3262 int lastToken() const override;
3263
3264 ObjCVisibilityDeclarationAST *clone(MemoryPool *pool) const override;
3265
3266 protected:
3267 void accept0(ASTVisitor *visitor) override;
3268 bool match0(AST *, ASTMatcher *) override;
3269 };
3270
3271 class CPLUSPLUS_EXPORT ObjCPropertyAttributeAST: public AST
3272 {
3273 public:
3274 int attribute_identifier_token = 0;
3275 int equals_token = 0;
3276 ObjCSelectorAST *method_selector = nullptr;
3277
3278 public:
asObjCPropertyAttribute()3279 ObjCPropertyAttributeAST *asObjCPropertyAttribute() override { return this; }
3280
3281 int firstToken() const override;
3282 int lastToken() const override;
3283
3284 ObjCPropertyAttributeAST *clone(MemoryPool *pool) const override;
3285
3286 protected:
3287 void accept0(ASTVisitor *visitor) override;
3288 bool match0(AST *, ASTMatcher *) override;
3289 };
3290
3291 class CPLUSPLUS_EXPORT ObjCPropertyDeclarationAST: public DeclarationAST
3292 {
3293 public:
3294 SpecifierListAST *attribute_list = nullptr;
3295 int property_token = 0;
3296 int lparen_token = 0;
3297 ObjCPropertyAttributeListAST *property_attribute_list = nullptr;
3298 int rparen_token = 0;
3299 DeclarationAST *simple_declaration = nullptr;
3300
3301 public: // annotations
3302 List<ObjCPropertyDeclaration *> *symbols = nullptr;
3303
3304 public:
asObjCPropertyDeclaration()3305 ObjCPropertyDeclarationAST *asObjCPropertyDeclaration() override { return this; }
3306
3307 int firstToken() const override;
3308 int lastToken() const override;
3309
3310 ObjCPropertyDeclarationAST *clone(MemoryPool *pool) const override;
3311
3312 protected:
3313 void accept0(ASTVisitor *visitor) override;
3314 bool match0(AST *, ASTMatcher *) override;
3315 };
3316
3317 class CPLUSPLUS_EXPORT ObjCMessageArgumentDeclarationAST: public AST
3318 {
3319 public:
3320 ObjCTypeNameAST *type_name = nullptr;
3321 SpecifierListAST *attribute_list = nullptr;
3322 NameAST *param_name = nullptr;
3323
3324 public: // annotations
3325 Argument *argument = nullptr;
3326
3327 public:
asObjCMessageArgumentDeclaration()3328 ObjCMessageArgumentDeclarationAST *asObjCMessageArgumentDeclaration() override { return this; }
3329
3330 int firstToken() const override;
3331 int lastToken() const override;
3332
3333 ObjCMessageArgumentDeclarationAST *clone(MemoryPool *pool) const override;
3334
3335 protected:
3336 void accept0(ASTVisitor *visitor) override;
3337 bool match0(AST *, ASTMatcher *) override;
3338 };
3339
3340 class CPLUSPLUS_EXPORT ObjCMethodPrototypeAST: public AST
3341 {
3342 public:
3343 int method_type_token = 0;
3344 ObjCTypeNameAST *type_name = nullptr;
3345 ObjCSelectorAST *selector = nullptr;
3346 ObjCMessageArgumentDeclarationListAST *argument_list = nullptr;
3347 int dot_dot_dot_token = 0;
3348 SpecifierListAST *attribute_list = nullptr;
3349
3350 public: // annotations
3351 ObjCMethod *symbol = nullptr;
3352
3353 public:
asObjCMethodPrototype()3354 ObjCMethodPrototypeAST *asObjCMethodPrototype() override { return this; }
3355
3356 int firstToken() const override;
3357 int lastToken() const override;
3358
3359 ObjCMethodPrototypeAST *clone(MemoryPool *pool) const override;
3360
3361 protected:
3362 void accept0(ASTVisitor *visitor) override;
3363 bool match0(AST *, ASTMatcher *) override;
3364 };
3365
3366 class CPLUSPLUS_EXPORT ObjCMethodDeclarationAST: public DeclarationAST
3367 {
3368 public:
3369 ObjCMethodPrototypeAST *method_prototype = nullptr;
3370 StatementAST *function_body = nullptr;
3371 int semicolon_token = 0;
3372
3373 public:
asObjCMethodDeclaration()3374 ObjCMethodDeclarationAST *asObjCMethodDeclaration() override { return this; }
3375
3376 int firstToken() const override;
3377 int lastToken() const override;
3378
3379 ObjCMethodDeclarationAST *clone(MemoryPool *pool) const override;
3380
3381 protected:
3382 void accept0(ASTVisitor *visitor) override;
3383 bool match0(AST *, ASTMatcher *) override;
3384 };
3385
3386 class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyAST: public AST
3387 {
3388 public:
3389 int property_identifier_token = 0;
3390 int equals_token = 0;
3391 int alias_identifier_token = 0;
3392
3393 public:
asObjCSynthesizedProperty()3394 ObjCSynthesizedPropertyAST *asObjCSynthesizedProperty() override { return this; }
3395
3396 int firstToken() const override;
3397 int lastToken() const override;
3398
3399 ObjCSynthesizedPropertyAST *clone(MemoryPool *pool) const override;
3400
3401 protected:
3402 void accept0(ASTVisitor *visitor) override;
3403 bool match0(AST *, ASTMatcher *) override;
3404 };
3405
3406 class CPLUSPLUS_EXPORT ObjCSynthesizedPropertiesDeclarationAST: public DeclarationAST
3407 {
3408 public:
3409 int synthesized_token = 0;
3410 ObjCSynthesizedPropertyListAST *property_identifier_list = nullptr;
3411 int semicolon_token = 0;
3412
3413 public:
asObjCSynthesizedPropertiesDeclaration()3414 ObjCSynthesizedPropertiesDeclarationAST *asObjCSynthesizedPropertiesDeclaration() override { return this; }
3415
3416 int firstToken() const override;
3417 int lastToken() const override;
3418
3419 ObjCSynthesizedPropertiesDeclarationAST *clone(MemoryPool *pool) const override;
3420
3421 protected:
3422 void accept0(ASTVisitor *visitor) override;
3423 bool match0(AST *, ASTMatcher *) override;
3424 };
3425
3426 class CPLUSPLUS_EXPORT ObjCDynamicPropertiesDeclarationAST: public DeclarationAST
3427 {
3428 public:
3429 int dynamic_token = 0;
3430 NameListAST *property_identifier_list = nullptr;
3431 int semicolon_token = 0;
3432
3433 public:
asObjCDynamicPropertiesDeclaration()3434 ObjCDynamicPropertiesDeclarationAST *asObjCDynamicPropertiesDeclaration() override { return this; }
3435
3436 int firstToken() const override;
3437 int lastToken() const override;
3438
3439 ObjCDynamicPropertiesDeclarationAST *clone(MemoryPool *pool) const override;
3440
3441 protected:
3442 void accept0(ASTVisitor *visitor) override;
3443 bool match0(AST *, ASTMatcher *) override;
3444 };
3445
3446 class CPLUSPLUS_EXPORT ObjCFastEnumerationAST: public StatementAST
3447 {
3448 public:
3449 int for_token = 0;
3450 int lparen_token = 0;
3451
3452 // declaration
3453 SpecifierListAST *type_specifier_list = nullptr;
3454 DeclaratorAST *declarator = nullptr;
3455 // or an expression
3456 ExpressionAST *initializer = nullptr;
3457
3458 int in_token = 0;
3459 ExpressionAST *fast_enumeratable_expression = nullptr;
3460 int rparen_token = 0;
3461 StatementAST *statement = nullptr;
3462
3463 public: // annotations
3464 Block *symbol = nullptr;
3465
3466 public:
asObjCFastEnumeration()3467 ObjCFastEnumerationAST *asObjCFastEnumeration() override { return this; }
3468
3469 int firstToken() const override;
3470 int lastToken() const override;
3471
3472 ObjCFastEnumerationAST *clone(MemoryPool *pool) const override;
3473
3474 protected:
3475 void accept0(ASTVisitor *visitor) override;
3476 bool match0(AST *, ASTMatcher *) override;
3477 };
3478
3479 class CPLUSPLUS_EXPORT ObjCSynchronizedStatementAST: public StatementAST
3480 {
3481 public:
3482 int synchronized_token = 0;
3483 int lparen_token = 0;
3484 ExpressionAST *synchronized_object = nullptr;
3485 int rparen_token = 0;
3486 StatementAST *statement = nullptr;
3487
3488 public:
asObjCSynchronizedStatement()3489 ObjCSynchronizedStatementAST *asObjCSynchronizedStatement() override { return this; }
3490
3491 int firstToken() const override;
3492 int lastToken() const override;
3493
3494 ObjCSynchronizedStatementAST *clone(MemoryPool *pool) const override;
3495
3496 protected:
3497 void accept0(ASTVisitor *visitor) override;
3498 bool match0(AST *, ASTMatcher *) override;
3499 };
3500
3501
3502 class LambdaExpressionAST: public ExpressionAST
3503 {
3504 public:
3505 LambdaIntroducerAST *lambda_introducer = nullptr;
3506 LambdaDeclaratorAST *lambda_declarator = nullptr;
3507 StatementAST *statement = nullptr;
3508
3509 public:
asLambdaExpression()3510 LambdaExpressionAST *asLambdaExpression() override { return this; }
3511
3512 int firstToken() const override;
3513 int lastToken() const override;
3514 LambdaExpressionAST *clone(MemoryPool *pool) const override;
3515
3516 protected:
3517 void accept0(ASTVisitor *visitor) override;
3518 bool match0(AST *, ASTMatcher *) override;
3519 };
3520
3521 class LambdaIntroducerAST: public AST
3522 {
3523 public:
3524 int lbracket_token = 0;
3525 LambdaCaptureAST *lambda_capture = nullptr;
3526 int rbracket_token = 0;
3527
3528 public:
asLambdaIntroducer()3529 LambdaIntroducerAST *asLambdaIntroducer() override { return this; }
3530 int firstToken() const override;
3531 int lastToken() const override;
3532
3533 LambdaIntroducerAST *clone(MemoryPool *pool) const override;
3534
3535 protected:
3536 void accept0(ASTVisitor *visitor) override;
3537 bool match0(AST *, ASTMatcher *) override;
3538 };
3539
3540 class LambdaCaptureAST: public AST
3541 {
3542 public:
3543 int default_capture_token = 0;
3544 CaptureListAST *capture_list = nullptr;
3545
3546 public:
asLambdaCapture()3547 LambdaCaptureAST *asLambdaCapture() override { return this; }
3548 int firstToken() const override;
3549 int lastToken() const override;
3550
3551 LambdaCaptureAST *clone(MemoryPool *pool) const override;
3552
3553 protected:
3554 void accept0(ASTVisitor *visitor) override;
3555 bool match0(AST *, ASTMatcher *) override;
3556 };
3557
3558 class CaptureAST: public AST
3559 {
3560 public:
3561 int amper_token = 0;
3562 NameAST *identifier = nullptr;
3563
3564 public:
asCapture()3565 CaptureAST *asCapture() override { return this; }
3566 int firstToken() const override;
3567 int lastToken() const override;
3568
3569 CaptureAST *clone(MemoryPool *pool) const override;
3570
3571 protected:
3572 void accept0(ASTVisitor *visitor) override;
3573 bool match0(AST *, ASTMatcher *) override;
3574 };
3575
3576 class LambdaDeclaratorAST: public AST
3577 {
3578 public:
3579 int lparen_token = 0;
3580 ParameterDeclarationClauseAST *parameter_declaration_clause = nullptr;
3581 int rparen_token = 0;
3582 SpecifierListAST *attributes = nullptr;
3583 int mutable_token = 0;
3584 ExceptionSpecificationAST *exception_specification = nullptr;
3585 TrailingReturnTypeAST *trailing_return_type = nullptr;
3586
3587 public: // annotations
3588 Function *symbol = nullptr;
3589
3590 public:
asLambdaDeclarator()3591 LambdaDeclaratorAST *asLambdaDeclarator() override { return this; }
3592 int firstToken() const override;
3593 int lastToken() const override;
3594
3595 LambdaDeclaratorAST *clone(MemoryPool *pool) const override;
3596
3597 protected:
3598 void accept0(ASTVisitor *visitor) override;
3599 bool match0(AST *, ASTMatcher *) override;
3600 };
3601
3602 class TrailingReturnTypeAST: public AST
3603 {
3604 public:
3605 int arrow_token = 0;
3606 SpecifierListAST *attributes = nullptr;
3607 SpecifierListAST *type_specifier_list = nullptr;
3608 DeclaratorAST *declarator = nullptr;
3609
3610 public:
asTrailingReturnType()3611 TrailingReturnTypeAST *asTrailingReturnType() override { return this; }
3612 int firstToken() const override;
3613 int lastToken() const override;
3614
3615 TrailingReturnTypeAST *clone(MemoryPool *pool) const override;
3616
3617 protected:
3618 void accept0(ASTVisitor *visitor) override;
3619 bool match0(AST *, ASTMatcher *) override;
3620 };
3621
3622 class BracedInitializerAST: public ExpressionAST
3623 {
3624 public:
3625 int lbrace_token = 0;
3626 ExpressionListAST *expression_list = nullptr;
3627 int comma_token = 0;
3628 int rbrace_token = 0;
3629
3630 public:
asBracedInitializer()3631 BracedInitializerAST *asBracedInitializer() override { return this; }
3632 int firstToken() const override;
3633 int lastToken() const override;
3634
3635 BracedInitializerAST *clone(MemoryPool *pool) const override;
3636
3637 protected:
3638 void accept0(ASTVisitor *visitor) override;
3639 bool match0(AST *, ASTMatcher *) override;
3640 };
3641
3642 class DesignatorAST: public AST
3643 {
3644 public:
asDesignator()3645 DesignatorAST *asDesignator() override { return this; }
3646 DesignatorAST *clone(MemoryPool *pool) const override = 0;
3647 };
3648
3649 class DotDesignatorAST: public DesignatorAST
3650 {
3651 public:
3652 int dot_token = 0;
3653 int identifier_token = 0;
3654
3655 public:
asDotDesignator()3656 DotDesignatorAST *asDotDesignator() override { return this; }
3657 int firstToken() const override;
3658 int lastToken() const override;
3659
3660 DotDesignatorAST *clone(MemoryPool *pool) const override;
3661
3662 protected:
3663 void accept0(ASTVisitor *visitor) override;
3664 bool match0(AST *, ASTMatcher *) override;
3665 };
3666
3667 class BracketDesignatorAST: public DesignatorAST
3668 {
3669 public:
3670 int lbracket_token = 0;
3671 ExpressionAST *expression = nullptr;
3672 int rbracket_token = 0;
3673
3674 public:
asBracketDesignator()3675 BracketDesignatorAST *asBracketDesignator() override { return this; }
3676 int firstToken() const override;
3677 int lastToken() const override;
3678
3679 BracketDesignatorAST *clone(MemoryPool *pool) const override;
3680
3681 protected:
3682 void accept0(ASTVisitor *visitor) override;
3683 bool match0(AST *, ASTMatcher *) override;
3684 };
3685
3686 class DesignatedInitializerAST: public ExpressionAST
3687 {
3688 public:
3689 DesignatorListAST *designator_list = nullptr;
3690 int equal_token = 0;
3691 ExpressionAST *initializer = nullptr;
3692
3693 public:
asDesignatedInitializer()3694 DesignatedInitializerAST *asDesignatedInitializer() override { return this; }
3695 int firstToken() const override;
3696 int lastToken() const override;
3697
3698 DesignatedInitializerAST *clone(MemoryPool *pool) const override;
3699
3700 protected:
3701 void accept0(ASTVisitor *visitor) override;
3702 bool match0(AST *, ASTMatcher *) override;
3703 };
3704
3705 } // namespace CPlusPlus
3706