1 // Written in the D programming language.
2 
3 /**
4  * This module defines an Abstract Syntax Tree for the D language
5  *
6  * Examples:
7  * ---
8  * // TODO
9  * ---
10  *
11  * Copyright: Brian Schott 2013
12  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt Boost, License 1.0)
13  * Authors: Brian Schott
14  */
15 
16 module dparse.ast;
17 
18 import dparse.lexer;
19 import std.traits;
20 import std.algorithm;
21 import std.array;
22 import std.string;
23 
24 private immutable uint[TypeInfo] typeMap;
25 
26 shared static this()
27 {
28     typeMap[typeid(AddExpression)] = 1;
29     typeMap[typeid(AndAndExpression)] = 2;
30     typeMap[typeid(AndExpression)] = 3;
31     typeMap[typeid(AsmAddExp)] = 4;
32     typeMap[typeid(AsmAndExp)] = 5;
33     typeMap[typeid(AsmBrExp)] = 6;
34     typeMap[typeid(AsmExp)] = 7;
35     typeMap[typeid(AsmEqualExp)] = 8;
36     typeMap[typeid(AsmLogAndExp)] = 9;
37     typeMap[typeid(AsmLogOrExp)] = 10;
38     typeMap[typeid(AsmMulExp)] = 11;
39     typeMap[typeid(AsmOrExp)] = 12;
40     typeMap[typeid(AsmRelExp)] = 13;
41     typeMap[typeid(AsmUnaExp)] = 14;
42     typeMap[typeid(AsmShiftExp)] = 15;
43     typeMap[typeid(AsmXorExp)] = 16;
44     typeMap[typeid(AssertExpression)] = 17;
45     typeMap[typeid(AssignExpression)] = 18;
46     typeMap[typeid(CmpExpression)] = 19;
47     typeMap[typeid(DeleteExpression)] = 20;
48     typeMap[typeid(EqualExpression)] = 21;
49     typeMap[typeid(Expression)] = 22;
50     typeMap[typeid(FunctionCallExpression)] = 23;
51     typeMap[typeid(FunctionLiteralExpression)] = 24;
52     typeMap[typeid(IdentityExpression)] = 25;
53     typeMap[typeid(ImportExpression)] = 26;
54     typeMap[typeid(IndexExpression)] = 27;
55     typeMap[typeid(InExpression)] = 28;
56     typeMap[typeid(IsExpression)] = 29;
57     typeMap[typeid(MixinExpression)] = 30;
58     typeMap[typeid(MulExpression)] = 31;
59     typeMap[typeid(NewAnonClassExpression)] = 32;
60     typeMap[typeid(NewExpression)] = 33;
61     typeMap[typeid(OrExpression)] = 34;
62     typeMap[typeid(OrOrExpression)] = 35;
63     typeMap[typeid(PowExpression)] = 36;
64     typeMap[typeid(PragmaExpression)] = 37;
65     typeMap[typeid(PrimaryExpression)] = 38;
66     typeMap[typeid(RelExpression)] = 39;
67     typeMap[typeid(ShiftExpression)] = 40;
68     typeMap[typeid(Index)] = 41;
69     typeMap[typeid(TemplateMixinExpression)] = 42;
70     typeMap[typeid(TernaryExpression)] = 43;
71     typeMap[typeid(TraitsExpression)] = 44;
72     typeMap[typeid(TypeidExpression)] = 45;
73     typeMap[typeid(TypeofExpression)] = 46;
74     typeMap[typeid(UnaryExpression)] = 47;
75     typeMap[typeid(XorExpression)] = 48;
76 }
77 
78 /**
79  * Implements the $(LINK2 http://en.wikipedia.org/wiki/Visitor_pattern, Visitor Pattern)
80  * for the various AST classes
81  */
82 abstract class ASTVisitor
83 {
84 public:
85 
86     /** */
87     void visit(const ExpressionNode n)
88     {
89         switch (typeMap[typeid(n)])
90         {
91         case 1: visit(cast(AddExpression) n); break;
92         case 2: visit(cast(AndAndExpression) n); break;
93         case 3: visit(cast(AndExpression) n); break;
94         case 4: visit(cast(AsmAddExp) n); break;
95         case 5: visit(cast(AsmAndExp) n); break;
96         case 6: visit(cast(AsmBrExp) n); break;
97         case 7: visit(cast(AsmExp) n); break;
98         case 8: visit(cast(AsmEqualExp) n); break;
99         case 9: visit(cast(AsmLogAndExp) n); break;
100         case 10: visit(cast(AsmLogOrExp) n); break;
101         case 11: visit(cast(AsmMulExp) n); break;
102         case 12: visit(cast(AsmOrExp) n); break;
103         case 13: visit(cast(AsmRelExp) n); break;
104         case 14: visit(cast(AsmUnaExp) n); break;
105         case 15: visit(cast(AsmShiftExp) n); break;
106         case 16: visit(cast(AsmXorExp) n); break;
107         case 17: visit(cast(AssertExpression) n); break;
108         case 18: visit(cast(AssignExpression) n); break;
109         case 19: visit(cast(CmpExpression) n); break;
110         case 20: visit(cast(DeleteExpression) n); break;
111         case 21: visit(cast(EqualExpression) n); break;
112         case 22: visit(cast(Expression) n); break;
113         case 23: visit(cast(FunctionCallExpression) n); break;
114         case 24: visit(cast(FunctionLiteralExpression) n); break;
115         case 25: visit(cast(IdentityExpression) n); break;
116         case 26: visit(cast(ImportExpression) n); break;
117         case 27: visit(cast(IndexExpression) n); break;
118         case 28: visit(cast(InExpression) n); break;
119         case 29: visit(cast(IsExpression) n); break;
120         case 30: visit(cast(MixinExpression) n); break;
121         case 31: visit(cast(MulExpression) n); break;
122         case 32: visit(cast(NewAnonClassExpression) n); break;
123         case 33: visit(cast(NewExpression) n); break;
124         case 34: visit(cast(OrExpression) n); break;
125         case 35: visit(cast(OrOrExpression) n); break;
126         case 36: visit(cast(PowExpression) n); break;
127         case 37: visit(cast(PragmaExpression) n); break;
128         case 38: visit(cast(PrimaryExpression) n); break;
129         case 39: visit(cast(RelExpression) n); break;
130         case 40: visit(cast(ShiftExpression) n); break;
131         case 41: visit(cast(Index) n); break;
132         case 42: visit(cast(TemplateMixinExpression) n); break;
133         case 43: visit(cast(TernaryExpression) n); break;
134         case 44: visit(cast(TraitsExpression) n); break;
135         case 45: visit(cast(TypeidExpression) n); break;
136         case 46: visit(cast(TypeofExpression) n); break;
137         case 47: visit(cast(UnaryExpression) n); break;
138         case 48: visit(cast(XorExpression) n); break;
139         default: assert(false, __MODULE__ ~ " has a bug");
140         }
141     }
142 
143     /** */ void visit(const AddExpression addExpression) { addExpression.accept(this); }
144     /** */ void visit(const AliasDeclaration aliasDeclaration) { aliasDeclaration.accept(this); }
145     /** */ void visit(const AliasInitializer aliasInitializer) { aliasInitializer.accept(this); }
146     /** */ void visit(const AliasThisDeclaration aliasThisDeclaration) { aliasThisDeclaration.accept(this); }
147     /** */ void visit(const AlignAttribute alignAttribute) { alignAttribute.accept(this); }
148     /** */ void visit(const AndAndExpression andAndExpression) { andAndExpression.accept(this); }
149     /** */ void visit(const AndExpression andExpression) { andExpression.accept(this); }
150     /** */ void visit(const AnonymousEnumDeclaration anonymousEnumDeclaration) { anonymousEnumDeclaration.accept(this); }
151     /** */ void visit(const AnonymousEnumMember anonymousEnumMember) { anonymousEnumMember.accept(this); }
152     /** */ void visit(const ArgumentList argumentList) { argumentList.accept(this); }
153     /** */ void visit(const Arguments arguments) { arguments.accept(this); }
154     /** */ void visit(const ArrayInitializer arrayInitializer) { arrayInitializer.accept(this); }
155     /** */ void visit(const ArrayLiteral arrayLiteral) { arrayLiteral.accept(this); }
156     /** */ void visit(const ArrayMemberInitialization arrayMemberInitialization) { arrayMemberInitialization.accept(this); }
157     /** */ void visit(const AsmAddExp asmAddExp) { asmAddExp.accept(this); }
158     /** */ void visit(const AsmAndExp asmAndExp) { asmAndExp.accept(this); }
159     /** */ void visit(const AsmBrExp asmBrExp) { asmBrExp.accept(this); }
160     /** */ void visit(const AsmEqualExp asmEqualExp) { asmEqualExp.accept(this); }
161     /** */ void visit(const AsmExp asmExp) { asmExp.accept(this); }
162     /** */ void visit(const AsmInstruction asmInstruction) { asmInstruction.accept(this); }
163     /** */ void visit(const AsmLogAndExp asmLogAndExp) { asmLogAndExp.accept(this); }
164     /** */ void visit(const AsmLogOrExp asmLogOrExp) { asmLogOrExp.accept(this); }
165     /** */ void visit(const AsmMulExp asmMulExp) { asmMulExp.accept(this); }
166     /** */ void visit(const AsmOrExp asmOrExp) { asmOrExp.accept(this); }
167     /** */ void visit(const AsmPrimaryExp asmPrimaryExp) { asmPrimaryExp.accept(this); }
168     /** */ void visit(const AsmRelExp asmRelExp) { asmRelExp.accept(this); }
169     /** */ void visit(const AsmShiftExp asmShiftExp) { asmShiftExp.accept(this); }
170     /** */ void visit(const AsmStatement asmStatement) { asmStatement.accept(this); }
171     /** */ void visit(const AsmTypePrefix asmTypePrefix) { asmTypePrefix.accept(this); }
172     /** */ void visit(const AsmUnaExp asmUnaExp) { asmUnaExp.accept(this); }
173     /** */ void visit(const AsmXorExp asmXorExp) { asmXorExp.accept(this); }
174     /** */ void visit(const AssertExpression assertExpression) { assertExpression.accept(this); }
175     /** */ void visit(const AssignExpression assignExpression) { assignExpression.accept(this); }
176     /** */ void visit(const AssocArrayLiteral assocArrayLiteral) { assocArrayLiteral.accept(this); }
177     /** */ void visit(const AtAttribute atAttribute) { atAttribute.accept(this); }
178     /** */ void visit(const Attribute attribute) { attribute.accept(this); }
179     /** */ void visit(const AttributeDeclaration attributeDeclaration) { attributeDeclaration.accept(this); }
180     /** */ void visit(const AutoDeclaration autoDeclaration) { autoDeclaration.accept(this); }
181     /** */ void visit(const BlockStatement blockStatement) { blockStatement.accept(this); }
182     /** */ void visit(const BodyStatement bodyStatement) { bodyStatement.accept(this); }
183     /** */ void visit(const BreakStatement breakStatement) { breakStatement.accept(this); }
184     /** */ void visit(const BaseClass baseClass) { baseClass.accept(this); }
185     /** */ void visit(const BaseClassList baseClassList) { baseClassList.accept(this); }
186     /** */ void visit(const CaseRangeStatement caseRangeStatement) { caseRangeStatement.accept(this); }
187     /** */ void visit(const CaseStatement caseStatement) { caseStatement.accept(this); }
188     /** */ void visit(const CastExpression castExpression) { castExpression.accept(this); }
189     /** */ void visit(const CastQualifier castQualifier) { castQualifier.accept(this); }
190     /** */ void visit(const Catch catch_) { catch_.accept(this); }
191     /** */ void visit(const Catches catches) { catches.accept(this); }
192     /** */ void visit(const ClassDeclaration classDeclaration) { classDeclaration.accept(this); }
193     /** */ void visit(const CmpExpression cmpExpression) { cmpExpression.accept(this); }
194     /** */ void visit(const CompileCondition compileCondition) { compileCondition.accept(this); }
195     /** */ void visit(const ConditionalDeclaration conditionalDeclaration) { conditionalDeclaration.accept(this); }
196     /** */ void visit(const ConditionalStatement conditionalStatement) { conditionalStatement.accept(this); }
197     /** */ void visit(const Constraint constraint) { constraint.accept(this); }
198     /** */ void visit(const Constructor constructor) { constructor.accept(this); }
199     /** */ void visit(const ContinueStatement continueStatement) { continueStatement.accept(this); }
200     /** */ void visit(const DebugCondition debugCondition) { debugCondition.accept(this); }
201     /** */ void visit(const DebugSpecification debugSpecification) { debugSpecification.accept(this); }
202     /** */ void visit(const Declaration declaration) { declaration.accept(this); }
203     /** */ void visit(const DeclarationOrStatement declarationsOrStatement) { declarationsOrStatement.accept(this); }
204     /** */ void visit(const DeclarationsAndStatements declarationsAndStatements) { declarationsAndStatements.accept(this); }
205     /** */ void visit(const Declarator declarator) { declarator.accept(this); }
206     /** */ void visit(const DefaultStatement defaultStatement) { defaultStatement.accept(this); }
207     /** */ void visit(const DeleteExpression deleteExpression) { deleteExpression.accept(this); }
208     /** */ void visit(const DeleteStatement deleteStatement) { deleteStatement.accept(this); }
209     /** */ void visit(const Deprecated deprecated_) { deprecated_.accept(this); }
210     /** */ void visit(const Destructor destructor) { destructor.accept(this); }
211     /** */ void visit(const DoStatement doStatement) { doStatement.accept(this); }
212     /** */ void visit(const EnumBody enumBody) { enumBody.accept(this); }
213     /** */ void visit(const EnumDeclaration enumDeclaration) { enumDeclaration.accept(this); }
214     /** */ void visit(const EnumMember enumMember) { enumMember.accept(this); }
215     /** */ void visit(const EponymousTemplateDeclaration eponymousTemplateDeclaration) { eponymousTemplateDeclaration.accept(this); }
216     /** */ void visit(const EqualExpression equalExpression) { equalExpression.accept(this); }
217     /** */ void visit(const Expression expression) { expression.accept(this); }
218     /** */ void visit(const ExpressionStatement expressionStatement) { expressionStatement.accept(this); }
219     /** */ void visit(const FinalSwitchStatement finalSwitchStatement) { finalSwitchStatement.accept(this); }
220     /** */ void visit(const Finally finally_) { finally_.accept(this); }
221     /** */ void visit(const ForStatement forStatement) { forStatement.accept(this); }
222     /** */ void visit(const ForeachStatement foreachStatement) { foreachStatement.accept(this); }
223     /** */ void visit(const ForeachType foreachType) { foreachType.accept(this); }
224     /** */ void visit(const ForeachTypeList foreachTypeList) { foreachTypeList.accept(this); }
225     /** */ void visit(const FunctionAttribute functionAttribute) { functionAttribute.accept(this); }
226     /** */ void visit(const FunctionBody functionBody) { functionBody.accept(this); }
227     /** */ void visit(const FunctionCallExpression functionCallExpression) { functionCallExpression.accept(this); }
228     /** */ void visit(const FunctionDeclaration functionDeclaration) { functionDeclaration.accept(this); }
229     /** */ void visit(const FunctionLiteralExpression functionLiteralExpression) { functionLiteralExpression.accept(this); }
230     /** */ void visit(const GotoStatement gotoStatement) { gotoStatement.accept(this); }
231     /** */ void visit(const IdentifierChain identifierChain) { identifierChain.accept(this); }
232     /** */ void visit(const IdentifierList identifierList) { identifierList.accept(this); }
233     /** */ void visit(const IdentifierOrTemplateChain identifierOrTemplateChain) { identifierOrTemplateChain.accept(this); }
234     /** */ void visit(const IdentifierOrTemplateInstance identifierOrTemplateInstance) { identifierOrTemplateInstance.accept(this); }
235     /** */ void visit(const IdentityExpression identityExpression) { identityExpression.accept(this); }
236     /** */ void visit(const IfStatement ifStatement) { ifStatement.accept(this); }
237     /** */ void visit(const ImportBind importBind) { importBind.accept(this); }
238     /** */ void visit(const ImportBindings importBindings) { importBindings.accept(this); }
239     /** */ void visit(const ImportDeclaration importDeclaration) { importDeclaration.accept(this); }
240     /** */ void visit(const ImportExpression importExpression) { importExpression.accept(this); }
241     /** */ void visit(const IndexExpression indexExpression) { indexExpression.accept(this); }
242     /** */ void visit(const InExpression inExpression) { inExpression.accept(this); }
243     /** */ void visit(const InStatement inStatement) { inStatement.accept(this); }
244     /** */ void visit(const Initialize initialize) { initialize.accept(this); }
245     /** */ void visit(const Initializer initializer) { initializer.accept(this); }
246     /** */ void visit(const InterfaceDeclaration interfaceDeclaration) { interfaceDeclaration.accept(this); }
247     /** */ void visit(const Invariant invariant_) { invariant_.accept(this); }
248     /** */ void visit(const IsExpression isExpression) { isExpression.accept(this); }
249     /** */ void visit(const KeyValuePair keyValuePair) { keyValuePair.accept(this); }
250     /** */ void visit(const KeyValuePairs keyValuePairs) { keyValuePairs.accept(this); }
251     /** */ void visit(const LabeledStatement labeledStatement) { labeledStatement.accept(this); }
252     /** */ void visit(const LastCatch lastCatch) { lastCatch.accept(this); }
253     /** */ void visit(const LinkageAttribute linkageAttribute) { linkageAttribute.accept(this); }
254     /** */ void visit(const MemberFunctionAttribute memberFunctionAttribute) { memberFunctionAttribute.accept(this); }
255     /** */ void visit(const MixinDeclaration mixinDeclaration) { mixinDeclaration.accept(this); }
256     /** */ void visit(const MixinExpression mixinExpression) { mixinExpression.accept(this); }
257     /** */ void visit(const MixinTemplateDeclaration mixinTemplateDeclaration) { mixinTemplateDeclaration.accept(this); }
258     /** */ void visit(const MixinTemplateName mixinTemplateName) { mixinTemplateName.accept(this); }
259     /** */ void visit(const Module module_) { module_.accept(this); }
260     /** */ void visit(const ModuleDeclaration moduleDeclaration) { moduleDeclaration.accept(this); }
261     /** */ void visit(const MulExpression mulExpression) { mulExpression.accept(this); }
262     /** */ void visit(const NewAnonClassExpression newAnonClassExpression) { newAnonClassExpression.accept(this); }
263     /** */ void visit(const NewExpression newExpression) { newExpression.accept(this); }
264     /** */ void visit(const NonVoidInitializer nonVoidInitializer) { nonVoidInitializer.accept(this); }
265     /** */ void visit(const Operands operands) { operands.accept(this); }
266     /** */ void visit(const OrExpression orExpression) { orExpression.accept(this); }
267     /** */ void visit(const OrOrExpression orOrExpression) { orOrExpression.accept(this); }
268     /** */ void visit(const OutStatement outStatement) { outStatement.accept(this); }
269     /** */ void visit(const Parameter parameter) { parameter.accept(this); }
270     /** */ void visit(const Parameters parameters) { parameters.accept(this); }
271     /** */ void visit(const Postblit postblit) { postblit.accept(this); }
272     /** */ void visit(const PowExpression powExpression) { powExpression.accept(this); }
273     /** */ void visit(const PragmaDeclaration pragmaDeclaration) { pragmaDeclaration.accept(this); }
274     /** */ void visit(const PragmaExpression pragmaExpression) { pragmaExpression.accept(this); }
275     /** */ void visit(const PrimaryExpression primaryExpression) { primaryExpression.accept(this); }
276     /** */ void visit(const Register register) { register.accept(this); }
277     /** */ void visit(const RelExpression relExpression) { relExpression.accept(this); }
278     /** */ void visit(const ReturnStatement returnStatement) { returnStatement.accept(this); }
279     /** */ void visit(const ScopeGuardStatement scopeGuardStatement) { scopeGuardStatement.accept(this); }
280     /** */ void visit(const SharedStaticConstructor sharedStaticConstructor) { sharedStaticConstructor.accept(this); }
281     /** */ void visit(const SharedStaticDestructor sharedStaticDestructor) { sharedStaticDestructor.accept(this); }
282     /** */ void visit(const ShiftExpression shiftExpression) { shiftExpression.accept(this); }
283     /** */ void visit(const SingleImport singleImport) { singleImport.accept(this); }
284     /** */ void visit(const Index index) { index.accept(this); }
285     /** */ void visit(const Statement statement) { statement.accept(this); }
286     /** */ void visit(const StatementNoCaseNoDefault statementNoCaseNoDefault) { statementNoCaseNoDefault.accept(this); }
287     /** */ void visit(const StaticAssertDeclaration staticAssertDeclaration) { staticAssertDeclaration.accept(this); }
288     /** */ void visit(const StaticAssertStatement staticAssertStatement) { staticAssertStatement.accept(this); }
289     /** */ void visit(const StaticConstructor staticConstructor) { staticConstructor.accept(this); }
290     /** */ void visit(const StaticDestructor staticDestructor) { staticDestructor.accept(this); }
291     /** */ void visit(const StaticIfCondition staticIfCondition) { staticIfCondition.accept(this); }
292     /** */ void visit(const StorageClass storageClass) { storageClass.accept(this); }
293     /** */ void visit(const StructBody structBody) { structBody.accept(this); }
294     /** */ void visit(const StructDeclaration structDeclaration) { structDeclaration.accept(this); }
295     /** */ void visit(const StructInitializer structInitializer) { structInitializer.accept(this); }
296     /** */ void visit(const StructMemberInitializer structMemberInitializer) { structMemberInitializer.accept(this); }
297     /** */ void visit(const StructMemberInitializers structMemberInitializers) { structMemberInitializers.accept(this); }
298     /** */ void visit(const SwitchStatement switchStatement) { switchStatement.accept(this); }
299     /** */ void visit(const Symbol symbol) { symbol.accept(this); }
300     /** */ void visit(const SynchronizedStatement synchronizedStatement) { synchronizedStatement.accept(this); }
301     /** */ void visit(const TemplateAliasParameter templateAliasParameter) { templateAliasParameter.accept(this); }
302     /** */ void visit(const TemplateArgument templateArgument) { templateArgument.accept(this); }
303     /** */ void visit(const TemplateArgumentList templateArgumentList) { templateArgumentList.accept(this); }
304     /** */ void visit(const TemplateArguments templateArguments) { templateArguments.accept(this); }
305     /** */ void visit(const TemplateDeclaration templateDeclaration) { templateDeclaration.accept(this); }
306     /** */ void visit(const TemplateInstance templateInstance) { templateInstance.accept(this); }
307     /** */ void visit(const TemplateMixinExpression templateMixinExpression) { templateMixinExpression.accept(this); }
308     /** */ void visit(const TemplateParameter templateParameter) { templateParameter.accept(this); }
309     /** */ void visit(const TemplateParameterList templateParameterList) { templateParameterList.accept(this); }
310     /** */ void visit(const TemplateParameters templateParameters) { templateParameters.accept(this); }
311     /** */ void visit(const TemplateSingleArgument templateSingleArgument) { templateSingleArgument.accept(this); }
312     /** */ void visit(const TemplateThisParameter templateThisParameter) { templateThisParameter.accept(this); }
313     /** */ void visit(const TemplateTupleParameter templateTupleParameter) { templateTupleParameter.accept(this); }
314     /** */ void visit(const TemplateTypeParameter templateTypeParameter) { templateTypeParameter.accept(this); }
315     /** */ void visit(const TemplateValueParameter templateValueParameter) { templateValueParameter.accept(this); }
316     /** */ void visit(const TemplateValueParameterDefault templateValueParameterDefault) { templateValueParameterDefault.accept(this); }
317     /** */ void visit(const TernaryExpression ternaryExpression) { ternaryExpression.accept(this); }
318     /** */ void visit(const ThrowStatement throwStatement) { throwStatement.accept(this); }
319     /** */ void visit(const Token) { }
320     /** */ void visit(const TraitsExpression traitsExpression) { traitsExpression.accept(this); }
321     /** */ void visit(const TryStatement tryStatement) { tryStatement.accept(this); }
322     /** */ void visit(const Type type) { type.accept(this); }
323     /** */ void visit(const Type2 type2) { type2.accept(this); }
324     /** */ void visit(const TypeSpecialization typeSpecialization) { typeSpecialization.accept(this); }
325     /** */ void visit(const TypeSuffix typeSuffix) { typeSuffix.accept(this); }
326     /** */ void visit(const TypeidExpression typeidExpression) { typeidExpression.accept(this); }
327     /** */ void visit(const TypeofExpression typeofExpression) { typeofExpression.accept(this); }
328     /** */ void visit(const UnaryExpression unaryExpression) { unaryExpression.accept(this); }
329     /** */ void visit(const UnionDeclaration unionDeclaration) { unionDeclaration.accept(this); }
330     /** */ void visit(const Unittest unittest_) { unittest_.accept(this); }
331     /** */ void visit(const VariableDeclaration variableDeclaration) { variableDeclaration.accept(this); }
332     /** */ void visit(const Vector vector) { vector.accept(this); }
333     /** */ void visit(const VersionCondition versionCondition) { versionCondition.accept(this); }
334     /** */ void visit(const VersionSpecification versionSpecification) { versionSpecification.accept(this); }
335     /** */ void visit(const WhileStatement whileStatement) { whileStatement.accept(this); }
336     /** */ void visit(const WithStatement withStatement) { withStatement.accept(this); }
337     /** */ void visit(const XorExpression xorExpression) { xorExpression.accept(this); }
338 }
339 
340 interface ASTNode
341 {
342 public:
343     /** */ void accept(ASTVisitor visitor) const;
344 }
345 
346 template visitIfNotNull(fields ...)
347 {
348     static if (fields.length > 1)
349         immutable visitIfNotNull = visitIfNotNull!(fields[0]) ~ visitIfNotNull!(fields[1..$]);
350     else
351     {
352         static if (typeof(fields[0]).stringof[$ - 2 .. $] == "[]")
353         {
354             static if (__traits(hasMember, typeof(fields[0][0]), "classinfo"))
355                 immutable visitIfNotNull = "foreach (i; " ~ fields[0].stringof ~ ") if (i !is null) visitor.visit(i);\n";
356             else
357                 immutable visitIfNotNull = "foreach (i; " ~ fields[0].stringof ~ ") visitor.visit(i);\n";
358         }
359         else static if (__traits(hasMember, typeof(fields[0]), "classinfo"))
360             immutable visitIfNotNull = "if (" ~ fields[0].stringof ~ " !is null) visitor.visit(" ~ fields[0].stringof ~ ");\n";
361         else
362             immutable visitIfNotNull = "visitor.visit(" ~ fields[0].stringof ~ ");\n";
363     }
364 }
365 
366 mixin template OpEquals(bool print = false)
367 {
368     override bool opEquals(Object other) const
369     {
370         static if (print)
371             pragma(msg, generateOpEquals!(typeof(this)));
372         mixin (generateOpEquals!(typeof(this)));
373     }
374 }
375 
376 template generateOpEquals(T)
377 {
378     template opEqualsPart(p ...)
379     {
380         import std.traits;
381         static if (p.length == 0)
382             enum opEqualsPart = "";
383         else static if (!isSomeFunction!(__traits(getMember, T, p[0]))
384             && p[0] != "line" && p[0] != "column" && p[0] != "startLocation"
385             && p[0] != "endLocation" && p[0] != "index")
386         {
387             static if (typeof(__traits(getMember, T, p[0])).stringof[$ - 2 .. $] == "[]")
388             {
389                 enum opEqualsPart = "\nif (obj." ~ p[0] ~ ".length != this." ~ p[0] ~ ".length) return false;\n"
390                     ~ "foreach (i; 0 .. this." ~ p[0] ~ ".length)\n"
391                     ~ "\tif (this." ~ p[0] ~ "[i] != obj." ~ p[0] ~ "[i]) return false;" ~ opEqualsPart!(p[1 .. $]);
392             }
393             else
394                 enum opEqualsPart = "\nif (obj." ~ p[0] ~ " != this." ~ p[0] ~ ") return false;" ~ opEqualsPart!(p[1 .. $]);
395         }
396         else
397             enum opEqualsPart = opEqualsPart!(p[1 .. $]);
398     }
399     enum generateOpEquals = T.stringof ~ " obj = cast(" ~ T.stringof ~ ") other;\n"
400         ~ "if (obj is null) return false;"
401         ~ opEqualsPart!(__traits(derivedMembers, T)) ~ "\n"
402         ~ "return true;";
403 }
404 
405 abstract class ExpressionNode : ASTNode
406 {
407 public:
408     override void accept(ASTVisitor visitor) const
409     {
410         assert (false);
411     }
412 }
413 
414 mixin template BinaryExpressionBody()
415 {
416     ExpressionNode left;
417     ExpressionNode right;
418     size_t line;
419     size_t column;
420 }
421 
422 ///
423 final class AddExpression : ExpressionNode
424 {
425 public:
426     override void accept(ASTVisitor visitor) const
427     {
428         mixin (visitIfNotNull!(left, right));
429     }
430     mixin OpEquals;
431     /** */ IdType operator;
432     mixin BinaryExpressionBody;
433 }
434 
435 ///
436 final class AliasDeclaration : ASTNode
437 {
438 public:
439     override void accept(ASTVisitor visitor) const
440     {
441         mixin (visitIfNotNull!(storageClasses, type, identifierList, initializers));
442     }
443     mixin OpEquals;
444     /** */ StorageClass[] storageClasses;
445     /** */ Type type;
446     /** */ IdentifierList identifierList;
447     /** */ AliasInitializer[] initializers;
448     /** */ string comment;
449 }
450 
451 ///
452 final class AliasInitializer : ASTNode
453 {
454 public:
455     override void accept(ASTVisitor visitor) const
456     {
457         mixin (visitIfNotNull!(name, templateParameters, storageClasses, type,
458                 functionLiteralExpression));
459     }
460     mixin OpEquals;
461     /** */ Token name;
462     /** */ StorageClass[] storageClasses;
463     /** */ TemplateParameters templateParameters;
464     /** */ Type type;
465     /** */ FunctionLiteralExpression functionLiteralExpression;
466 }
467 
468 ///
469 final class AliasThisDeclaration : ASTNode
470 {
471 public:
472     override void accept(ASTVisitor visitor) const
473     {
474         mixin (visitIfNotNull!(identifier));
475     }
476     mixin OpEquals;
477     /** */ Token identifier;
478     /** */ string comment;
479 }
480 
481 ///
482 final class AlignAttribute : ASTNode
483 {
484 public:
485     override void accept(ASTVisitor visitor) const
486     {
487         mixin (visitIfNotNull!(intLiteral));
488     }
489     mixin OpEquals;
490     /** */ Token intLiteral;
491 }
492 
493 ///
494 final class AndAndExpression : ExpressionNode
495 {
496 public:
497     override void accept(ASTVisitor visitor) const
498     {
499         mixin (visitIfNotNull!(left, right));
500     }
501     mixin OpEquals;
502     mixin BinaryExpressionBody;
503 }
504 
505 ///
506 final class AndExpression : ExpressionNode
507 {
508 public:
509     override void accept(ASTVisitor visitor) const
510     {
511         mixin (visitIfNotNull!(left, right));
512     }
513     mixin OpEquals;
514     mixin BinaryExpressionBody;
515 }
516 
517 ///
518 final class AnonymousEnumDeclaration : ASTNode
519 {
520     override void accept(ASTVisitor visitor) const
521     {
522         mixin (visitIfNotNull!(baseType, members));
523     }
524     mixin OpEquals;
525     /** */ Type baseType;
526     /** */ AnonymousEnumMember[] members;
527 }
528 
529 ///
530 final class AnonymousEnumMember : ASTNode
531 {
532     override void accept(ASTVisitor visitor) const
533     {
534         mixin (visitIfNotNull!(type, name, assignExpression));
535     }
536     /** */ Type type;
537     /** */ Token name;
538     /** */ ExpressionNode assignExpression;
539     /** */ string comment;
540 }
541 
542 ///
543 final class ArgumentList : ASTNode
544 {
545 public:
546     override void accept(ASTVisitor visitor) const
547     {
548         mixin (visitIfNotNull!(items));
549     }
550     mixin OpEquals;
551     /** */ ExpressionNode[] items;
552     /** */ size_t startLocation;
553     /** */ size_t endLocation;
554 }
555 
556 ///
557 final class Arguments : ASTNode
558 {
559 public:
560     override void accept(ASTVisitor visitor) const
561     {
562         mixin (visitIfNotNull!(argumentList));
563     }
564     mixin OpEquals;
565     /** */ ArgumentList argumentList;
566 }
567 
568 ///
569 final class ArrayInitializer : ASTNode
570 {
571 public:
572     override void accept(ASTVisitor visitor) const
573     {
574         mixin (visitIfNotNull!(arrayMemberInitializations));
575     }
576     mixin OpEquals;
577     /** */ size_t startLocation;
578     /** */ size_t endLocation;
579     /** */ ArrayMemberInitialization[] arrayMemberInitializations;
580 }
581 
582 ///
583 final class ArrayLiteral : ASTNode
584 {
585 public:
586     override void accept(ASTVisitor visitor) const
587     {
588         mixin (visitIfNotNull!(argumentList));
589     }
590     mixin OpEquals;
591     /** */ ArgumentList argumentList;
592 }
593 
594 ///
595 final class ArrayMemberInitialization : ASTNode
596 {
597 public:
598     override void accept(ASTVisitor visitor) const
599     {
600         mixin (visitIfNotNull!(assignExpression, nonVoidInitializer));
601     }
602     mixin OpEquals;
603     /** */ ExpressionNode assignExpression;
604     /** */ NonVoidInitializer nonVoidInitializer;
605 }
606 
607 ///
608 final class AsmAddExp : ExpressionNode
609 {
610 public:
611     override void accept(ASTVisitor visitor) const
612     {
613         mixin (visitIfNotNull!(left, right));
614     }
615     mixin OpEquals;
616     /** */ IdType operator;
617     mixin BinaryExpressionBody;
618 }
619 
620 ///
621 final class AsmAndExp : ExpressionNode
622 {
623 public:
624     override void accept(ASTVisitor visitor) const
625     {
626         mixin (visitIfNotNull!(left, right));
627     }
628     mixin OpEquals;
629     mixin BinaryExpressionBody;
630 }
631 
632 ///
633 final class AsmBrExp : ExpressionNode
634 {
635 public:
636     override void accept(ASTVisitor visitor) const
637     {
638         mixin (visitIfNotNull!(asmBrExp, asmExp, asmUnaExp));
639     }
640     mixin OpEquals;
641     size_t line;
642     size_t column;
643     /** */ AsmBrExp asmBrExp;
644     /** */ ExpressionNode asmExp;
645     /** */ AsmUnaExp asmUnaExp;
646 }
647 
648 ///
649 final class AsmEqualExp : ExpressionNode
650 {
651 public:
652     override void accept(ASTVisitor visitor) const
653     {
654         mixin (visitIfNotNull!(left, right));
655     }
656     mixin BinaryExpressionBody;
657     mixin OpEquals;
658     /** */ IdType operator;
659 }
660 
661 ///
662 final class AsmExp : ExpressionNode
663 {
664 public:
665     override void accept(ASTVisitor visitor) const
666     {
667         mixin (visitIfNotNull!(left, middle, right));
668     }
669     mixin OpEquals;
670     /** */ ExpressionNode left;
671     /** */ ExpressionNode middle;
672     /** */ ExpressionNode right;
673 }
674 
675 ///
676 final class AsmInstruction : ASTNode
677 {
678 public:
679     override void accept(ASTVisitor visitor) const
680     {
681         mixin (visitIfNotNull!(identifierOrIntegerOrOpcode, asmInstruction, operands));
682     }
683     mixin OpEquals;
684     /** */ Token identifierOrIntegerOrOpcode;
685     /** */ bool hasAlign;
686     /** */ AsmInstruction asmInstruction;
687     /** */ Operands operands;
688 }
689 
690 ///
691 final class AsmLogAndExp : ExpressionNode
692 {
693 public:
694     override void accept(ASTVisitor visitor) const
695     {
696         mixin (visitIfNotNull!(left, right));
697     }
698     mixin BinaryExpressionBody;
699     mixin OpEquals;
700 }
701 
702 ///
703 final class AsmLogOrExp : ExpressionNode
704 {
705 public:
706     override void accept(ASTVisitor visitor) const
707     {
708         mixin (visitIfNotNull!(left, right));
709     }
710     mixin BinaryExpressionBody;
711     mixin OpEquals;
712 }
713 
714 ///
715 final class AsmMulExp : ExpressionNode
716 {
717 public:
718     override void accept(ASTVisitor visitor) const
719     {
720         mixin (visitIfNotNull!(left, right));
721     }
722     /** */ IdType operator;
723     mixin BinaryExpressionBody;
724     mixin OpEquals;
725 
726 }
727 
728 ///
729 final class AsmOrExp : ExpressionNode
730 {
731 public:
732     override void accept(ASTVisitor visitor) const
733     {
734         mixin (visitIfNotNull!(left, right));
735     }
736     mixin BinaryExpressionBody;
737     mixin OpEquals;
738 }
739 
740 ///
741 final class AsmPrimaryExp : ASTNode
742 {
743 public:
744     override void accept(ASTVisitor visitor) const
745     {
746         mixin (visitIfNotNull!(token, register, asmExp, identifierChain));
747     }
748     /** */ ExpressionNode asmExp;
749     /** */ IdentifierChain identifierChain;
750     /** */ Register register;
751     /** */ Token token;
752     mixin OpEquals;
753 }
754 
755 ///
756 final class AsmRelExp : ExpressionNode
757 {
758 public:
759     override void accept(ASTVisitor visitor) const
760     {
761         mixin (visitIfNotNull!(left, right));
762     }
763     mixin BinaryExpressionBody;
764     /** */ IdType operator;
765     mixin OpEquals;
766 }
767 
768 ///
769 final class AsmShiftExp : ExpressionNode
770 {
771 public:
772     override void accept(ASTVisitor visitor) const
773     {
774         mixin (visitIfNotNull!(left, right));
775     }
776     mixin BinaryExpressionBody;
777     /** */ IdType operator;
778     mixin OpEquals;
779 }
780 
781 ///
782 final class AsmStatement : ASTNode
783 {
784 public:
785     override void accept(ASTVisitor visitor) const
786     {
787         mixin (visitIfNotNull!asmInstructions);
788     }
789     /** */ AsmInstruction[] asmInstructions;
790     /** */ FunctionAttribute[] functionAttributes;
791     mixin OpEquals;
792 }
793 
794 ///
795 final class AsmTypePrefix : ASTNode
796 {
797 public:
798     override void accept(ASTVisitor visitor) const
799     {
800         mixin (visitIfNotNull!(left, right));
801     }
802     /** */ Token left;
803     /** */ Token right;
804     mixin OpEquals;
805 }
806 
807 ///
808 final class AsmUnaExp : ASTNode
809 {
810 public:
811     override void accept(ASTVisitor visitor) const
812     {
813         mixin (visitIfNotNull!(prefix, asmTypePrefix, asmExp, asmPrimaryExp, asmUnaExp));
814     }
815     /** */ AsmTypePrefix asmTypePrefix;
816     /** */ ExpressionNode asmExp;
817     /** */ Token prefix;
818     /** */ AsmPrimaryExp asmPrimaryExp;
819     /** */ AsmUnaExp asmUnaExp;
820     mixin OpEquals;
821 }
822 
823 ///
824 final class AsmXorExp : ExpressionNode
825 {
826 public:
827     override void accept(ASTVisitor visitor) const
828     {
829         mixin (visitIfNotNull!(left, right));
830     }
831     mixin BinaryExpressionBody;
832     mixin OpEquals;
833 }
834 
835 ///
836 final class AssertExpression : ExpressionNode
837 {
838 public:
839     override void accept(ASTVisitor visitor) const
840     {
841         mixin (visitIfNotNull!(assertion, message));
842     }
843     /** */ size_t line;
844     /** */ size_t column;
845     /** */ ExpressionNode assertion;
846     /** */ ExpressionNode message;
847     mixin OpEquals;
848 }
849 
850 ///
851 final class AssignExpression : ExpressionNode
852 {
853 public:
854     override void accept(ASTVisitor visitor) const
855     {
856         mixin (visitIfNotNull!(ternaryExpression, expression));
857     }
858     /** */ ExpressionNode ternaryExpression;
859     /** */ ExpressionNode expression;
860     /** */ IdType operator;
861     /** */ size_t line;
862     /** */ size_t column;
863     mixin OpEquals;
864 }
865 
866 ///
867 final class AssocArrayLiteral : ASTNode
868 {
869 public:
870     override void accept(ASTVisitor visitor) const
871     {
872         mixin (visitIfNotNull!(keyValuePairs));
873     }
874     /** */ KeyValuePairs keyValuePairs;
875     mixin OpEquals;
876 }
877 
878 ///
879 final class AtAttribute : ASTNode
880 {
881 public:
882     override void accept(ASTVisitor visitor) const
883     {
884         mixin (visitIfNotNull!(templateInstance, argumentList));
885     }
886     /** */ ArgumentList argumentList;
887     /** */ TemplateInstance templateInstance;
888     /** */ Token identifier;
889     /** */ size_t startLocation;
890     /** */ size_t endLocation;
891     mixin OpEquals;
892 }
893 
894 ///
895 final class Attribute : ASTNode
896 {
897 public:
898     override void accept(ASTVisitor visitor) const
899     {
900         mixin (visitIfNotNull!(pragmaExpression, deprecated_, atAttribute,
901             alignAttribute, identifierChain));
902     }
903     /** */ PragmaExpression pragmaExpression;
904     /** */ Deprecated deprecated_;
905     /** */ AtAttribute atAttribute;
906     /** */ AlignAttribute alignAttribute;
907     /** */ LinkageAttribute linkageAttribute;
908     /** */ Token attribute;
909     /** */ IdentifierChain identifierChain;
910     mixin OpEquals;
911 }
912 
913 ///
914 final class AttributeDeclaration : ASTNode
915 {
916     override void accept(ASTVisitor visitor) const
917     {
918         mixin (visitIfNotNull!(attribute));
919     }
920     /** */ Attribute attribute;
921     /** */ size_t line;
922     mixin OpEquals;
923 }
924 
925 ///
926 final class AutoDeclaration : ASTNode
927 {
928 public:
929     override void accept(ASTVisitor visitor) const
930     {
931         foreach (sc; storageClasses)
932             visitor.visit(sc);
933         foreach (i; 0 .. initializers.length)
934         {
935             visitor.visit(initializers[i]);
936         }
937     }
938     /** */ Token[] identifiers;
939     /** */ Initializer[] initializers;
940     /** */ StorageClass[] storageClasses;
941     /** */ string comment;
942     mixin OpEquals;
943 }
944 
945 ///
946 final class BlockStatement : ASTNode
947 {
948 public:
949     override void accept(ASTVisitor visitor) const
950     {
951         mixin (visitIfNotNull!(declarationsAndStatements));
952     }
953 
954     /**
955      * Byte position of the opening brace
956      */
957     size_t startLocation;
958 
959     /**
960      * Byte position of the closing brace
961      */
962     size_t endLocation;
963 
964     /** */ DeclarationsAndStatements declarationsAndStatements;
965     mixin OpEquals;
966 }
967 
968 ///
969 final class BodyStatement : ASTNode
970 {
971 public:
972     override void accept(ASTVisitor visitor) const
973     {
974         mixin (visitIfNotNull!(blockStatement));
975     }
976     /** */ BlockStatement blockStatement;
977     mixin OpEquals;
978 }
979 
980 ///
981 final class BreakStatement : ASTNode
982 {
983 public:
984     override void accept(ASTVisitor visitor) const
985     {
986         mixin (visitIfNotNull!(label));
987     }
988     /** */ Token label;
989     mixin OpEquals;
990 }
991 
992 ///
993 final class BaseClass : ASTNode
994 {
995 public:
996     override void accept(ASTVisitor visitor) const
997     {
998         mixin (visitIfNotNull!(type2));
999     }
1000     /** */ Type2 type2;
1001     mixin OpEquals;
1002 }
1003 
1004 ///
1005 final class BaseClassList : ASTNode
1006 {
1007 public:
1008     override void accept(ASTVisitor visitor) const
1009     {
1010         mixin (visitIfNotNull!(items));
1011     }
1012     /** */ BaseClass[] items;
1013     mixin OpEquals;
1014 }
1015 
1016 ///
1017 final class CaseRangeStatement : ASTNode
1018 {
1019 public:
1020     override void accept(ASTVisitor visitor) const
1021     {
1022         mixin (visitIfNotNull!(low, high, declarationsAndStatements));
1023     }
1024     /** */ ExpressionNode low;
1025     /** */ ExpressionNode high;
1026     /** */ DeclarationsAndStatements declarationsAndStatements;
1027 	/** */ size_t colonLocation;
1028     mixin OpEquals;
1029 }
1030 
1031 ///
1032 final class CaseStatement: ASTNode
1033 {
1034 public:
1035     override void accept(ASTVisitor visitor) const
1036     {
1037         mixin (visitIfNotNull!(argumentList, declarationsAndStatements));
1038     }
1039     /** */ ArgumentList argumentList;
1040     /** */ DeclarationsAndStatements declarationsAndStatements;
1041 	/** */ size_t colonLocation;
1042     mixin OpEquals;
1043 }
1044 
1045 ///
1046 final class CastExpression: ASTNode
1047 {
1048 public:
1049     override void accept(ASTVisitor visitor) const
1050     {
1051         mixin (visitIfNotNull!(type, castQualifier, unaryExpression));
1052     }
1053     /** */ Type type;
1054     /** */ CastQualifier castQualifier;
1055     /** */ UnaryExpression unaryExpression;
1056     mixin OpEquals;
1057 }
1058 
1059 ///
1060 final class CastQualifier: ASTNode
1061 {
1062 public:
1063     override void accept(ASTVisitor visitor) const
1064     {
1065         mixin (visitIfNotNull!(first, second));
1066     }
1067     /** */ Token first;
1068     /** */ Token second;
1069     mixin OpEquals;
1070 }
1071 
1072 ///
1073 final class Catches: ASTNode
1074 {
1075 public:
1076     override void accept(ASTVisitor visitor) const
1077     {
1078         mixin (visitIfNotNull!(catches, lastCatch));
1079     }
1080     /** */ Catch[] catches;
1081     /** */ LastCatch lastCatch;
1082     mixin OpEquals;
1083 }
1084 
1085 ///
1086 final class Catch: ASTNode
1087 {
1088 public:
1089     override void accept(ASTVisitor visitor) const
1090     {
1091         mixin (visitIfNotNull!(type, identifier, declarationOrStatement));
1092     }
1093     /** */ Type type;
1094     /** */ Token identifier;
1095     /** */ DeclarationOrStatement declarationOrStatement;
1096     mixin OpEquals;
1097 }
1098 
1099 ///
1100 final class ClassDeclaration: ASTNode
1101 {
1102 public:
1103     override void accept(ASTVisitor visitor) const
1104     {
1105         mixin (visitIfNotNull!(templateParameters, constraint, baseClassList,
1106             structBody));
1107     }
1108 
1109     /** */ Token name;
1110     /** */ TemplateParameters templateParameters;
1111     /** */ Constraint constraint;
1112     /** */ BaseClassList baseClassList;
1113     /** */ StructBody structBody;
1114     /** */ string comment;
1115     mixin OpEquals;
1116 }
1117 
1118 ///
1119 final class CmpExpression : ExpressionNode
1120 {
1121 public:
1122     override void accept(ASTVisitor visitor) const
1123     {
1124         mixin (visitIfNotNull!(shiftExpression, equalExpression,
1125             identityExpression, relExpression, inExpression));
1126     }
1127     /** */ ExpressionNode shiftExpression;
1128     /** */ ExpressionNode equalExpression;
1129     /** */ ExpressionNode identityExpression;
1130     /** */ ExpressionNode relExpression;
1131     /** */ ExpressionNode inExpression;
1132     mixin OpEquals;
1133 }
1134 
1135 ///
1136 final class CompileCondition : ASTNode
1137 {
1138 public:
1139     override void accept(ASTVisitor visitor) const
1140     {
1141         mixin (visitIfNotNull!(versionCondition, debugCondition, staticIfCondition));
1142     }
1143     /** */ VersionCondition versionCondition;
1144     /** */ DebugCondition debugCondition;
1145     /** */ StaticIfCondition staticIfCondition;
1146     mixin OpEquals;
1147 }
1148 
1149 ///
1150 final class ConditionalDeclaration : ASTNode
1151 {
1152 public:
1153     override void accept(ASTVisitor visitor) const
1154     {
1155         mixin (visitIfNotNull!(compileCondition, trueDeclarations, falseDeclarations));
1156     }
1157     /** */ CompileCondition compileCondition;
1158     /** */ Declaration[] trueDeclarations;
1159     /** */ Declaration[] falseDeclarations;
1160     /** */ bool hasElse;
1161     mixin OpEquals;
1162 }
1163 
1164 ///
1165 final class ConditionalStatement : ASTNode
1166 {
1167 public:
1168     override void accept(ASTVisitor visitor) const
1169     {
1170         mixin (visitIfNotNull!(compileCondition, trueStatement, falseStatement));
1171     }
1172     /** */ CompileCondition compileCondition;
1173     /** */ DeclarationOrStatement trueStatement;
1174     /** */ DeclarationOrStatement falseStatement;
1175     mixin OpEquals;
1176 }
1177 
1178 ///
1179 final class Constraint : ASTNode
1180 {
1181 public:
1182     override void accept(ASTVisitor visitor) const
1183     {
1184         mixin (visitIfNotNull!(expression));
1185     }
1186     /** */ Expression expression;
1187     /** */ size_t location;
1188     mixin OpEquals;
1189 }
1190 
1191 ///
1192 final class Constructor : ASTNode
1193 {
1194 public:
1195     override void accept(ASTVisitor visitor) const
1196     {
1197         mixin (visitIfNotNull!(parameters, templateParameters, constraint,
1198             memberFunctionAttributes, functionBody));
1199     }
1200     /** */ Parameters parameters;
1201     /** */ FunctionBody functionBody;
1202     /** */ Constraint constraint;
1203     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
1204     /** */ TemplateParameters templateParameters;
1205     /** */ size_t location;
1206     /** */ size_t line;
1207     /** */ size_t column;
1208     /** */ string comment;
1209     mixin OpEquals;
1210 }
1211 
1212 ///
1213 final class ContinueStatement : ASTNode
1214 {
1215 public:
1216     override void accept(ASTVisitor visitor) const
1217     {
1218         mixin (visitIfNotNull!(label));
1219     }
1220     /** */ Token label;
1221     mixin OpEquals;
1222 }
1223 
1224 ///
1225 final class DebugCondition : ASTNode
1226 {
1227 public:
1228     override void accept(ASTVisitor visitor) const
1229     {
1230         mixin (visitIfNotNull!(identifierOrInteger));
1231     }
1232     /** */ size_t debugIndex;
1233     /** */ Token identifierOrInteger;
1234     mixin OpEquals;
1235 }
1236 
1237 ///
1238 final class DebugSpecification : ASTNode
1239 {
1240 public:
1241     override void accept(ASTVisitor visitor) const
1242     {
1243         mixin (visitIfNotNull!(identifierOrInteger));
1244     }
1245     /** */ Token identifierOrInteger;
1246     mixin OpEquals;
1247 }
1248 
1249 ///
1250 final class Declaration : ASTNode
1251 {
1252 public:
1253 
1254     override void accept(ASTVisitor visitor) const
1255     {
1256 
1257         foreach (attr; attributes)
1258             visitor.visit(attr);
1259         foreach (dec; declarations)
1260             visitor.visit(dec);
1261         foreach (Type; DeclarationTypes)
1262         {
1263             const(Type)* value = storage.peek!Type;
1264             if (value !is null)
1265             {
1266                 static if (isArray!Type)
1267                     foreach (item; *(cast(Type*) value))
1268                         visitor.visit(item);
1269                 else if (*value !is null)
1270                     visitor.visit(*(cast(Type*) value));
1271             }
1272         }
1273     }
1274 
1275     private import std.variant:Algebraic;
1276     private import std.typetuple:TypeTuple;
1277 
1278     alias DeclarationTypes = TypeTuple!(AliasDeclaration, AliasThisDeclaration,
1279         AnonymousEnumDeclaration, AttributeDeclaration,
1280         ClassDeclaration, ConditionalDeclaration, Constructor, DebugSpecification,
1281         Destructor, EnumDeclaration, EponymousTemplateDeclaration,
1282         FunctionDeclaration, ImportDeclaration, InterfaceDeclaration, Invariant,
1283         MixinDeclaration, MixinTemplateDeclaration, Postblit, PragmaDeclaration,
1284         SharedStaticConstructor, SharedStaticDestructor, StaticAssertDeclaration,
1285         StaticConstructor, StaticDestructor, StructDeclaration,
1286         TemplateDeclaration, UnionDeclaration, Unittest, VariableDeclaration,
1287         VersionSpecification);
1288 
1289     private Algebraic!(DeclarationTypes) storage;
1290 
1291     private static string generateProperty(string type, string name)
1292     {
1293         return "const(" ~ type ~ ") " ~ name ~ "() const @property { auto p = storage.peek!" ~ type ~ "; return p is null? null : *p;}\n"
1294             ~ "const(" ~ type ~ ") " ~ name ~ "(" ~ type ~ " node) @property { storage = node; return node; }";
1295     }
1296 
1297     /** */ Attribute[] attributes;
1298     /** */ Declaration[] declarations;
1299 
1300     mixin(generateProperty("AliasDeclaration", "aliasDeclaration"));
1301     mixin(generateProperty("AliasThisDeclaration", "aliasThisDeclaration"));
1302     mixin(generateProperty("AnonymousEnumDeclaration", "anonymousEnumDeclaration"));
1303     mixin(generateProperty("AttributeDeclaration", "attributeDeclaration"));
1304     mixin(generateProperty("ClassDeclaration", "classDeclaration"));
1305     mixin(generateProperty("ConditionalDeclaration", "conditionalDeclaration"));
1306     mixin(generateProperty("Constructor", "constructor"));
1307     mixin(generateProperty("DebugSpecification", "debugSpecification"));
1308     mixin(generateProperty("Destructor", "destructor"));
1309     mixin(generateProperty("EnumDeclaration", "enumDeclaration"));
1310     mixin(generateProperty("EponymousTemplateDeclaration", "eponymousTemplateDeclaration"));
1311     mixin(generateProperty("FunctionDeclaration", "functionDeclaration"));
1312     mixin(generateProperty("ImportDeclaration", "importDeclaration"));
1313     mixin(generateProperty("InterfaceDeclaration", "interfaceDeclaration"));
1314     mixin(generateProperty("Invariant", "invariant_"));
1315     mixin(generateProperty("MixinDeclaration", "mixinDeclaration"));
1316     mixin(generateProperty("MixinTemplateDeclaration", "mixinTemplateDeclaration"));
1317     mixin(generateProperty("Postblit", "postblit"));
1318     mixin(generateProperty("PragmaDeclaration", "pragmaDeclaration"));
1319     mixin(generateProperty("SharedStaticConstructor", "sharedStaticConstructor"));
1320     mixin(generateProperty("SharedStaticDestructor", "sharedStaticDestructor"));
1321     mixin(generateProperty("StaticAssertDeclaration", "staticAssertDeclaration"));
1322     mixin(generateProperty("StaticConstructor", "staticConstructor"));
1323     mixin(generateProperty("StaticDestructor", "staticDestructor"));
1324     mixin(generateProperty("StructDeclaration", "structDeclaration"));
1325     mixin(generateProperty("TemplateDeclaration", "templateDeclaration"));
1326     mixin(generateProperty("UnionDeclaration", "unionDeclaration"));
1327     mixin(generateProperty("Unittest", "unittest_"));
1328     mixin(generateProperty("VariableDeclaration", "variableDeclaration"));
1329     mixin(generateProperty("VersionSpecification", "versionSpecification"));
1330 
1331 
1332     bool opEquals(const Object other) const
1333     {
1334         auto otherDeclaration = cast(Declaration) other;
1335         if (otherDeclaration is null)
1336             return false;
1337         return attributes == otherDeclaration.attributes
1338             && declarations == otherDeclaration.declarations
1339             && storage == otherDeclaration.storage;
1340     }
1341 }
1342 
1343 ///
1344 final class DeclarationsAndStatements : ASTNode
1345 {
1346     override void accept(ASTVisitor visitor) const
1347     {
1348         mixin (visitIfNotNull!(declarationsAndStatements));
1349     }
1350 
1351     /** */ DeclarationOrStatement[] declarationsAndStatements;
1352     mixin OpEquals;
1353 }
1354 
1355 ///
1356 final class DeclarationOrStatement : ASTNode
1357 {
1358 public:
1359     override void accept(ASTVisitor visitor) const
1360     {
1361         mixin (visitIfNotNull!(declaration, statement));
1362     }
1363 
1364     /** */ Declaration declaration;
1365     /** */ Statement statement;
1366     mixin OpEquals;
1367 }
1368 
1369 ///
1370 final class Declarator : ASTNode
1371 {
1372 public:
1373     override void accept(ASTVisitor visitor) const
1374     {
1375         mixin (visitIfNotNull!(templateParameters, initializer));
1376     }
1377     /** */ Token name;
1378     /** */ TemplateParameters templateParameters;
1379     /** */ Initializer initializer;
1380     /** */ TypeSuffix[] cstyle;
1381     /** */ string comment;
1382     mixin OpEquals;
1383 }
1384 
1385 ///
1386 final class DefaultStatement : ASTNode
1387 {
1388 public:
1389     override void accept(ASTVisitor visitor) const
1390     {
1391         mixin (visitIfNotNull!(declarationsAndStatements));
1392     }
1393     /** */ DeclarationsAndStatements declarationsAndStatements;
1394 	/** */ size_t colonLocation;
1395     mixin OpEquals;
1396 }
1397 
1398 ///
1399 final class DeleteExpression : ExpressionNode
1400 {
1401 public:
1402     override void accept(ASTVisitor visitor) const
1403     {
1404         mixin (visitIfNotNull!(unaryExpression));
1405     }
1406     /** */ UnaryExpression unaryExpression;
1407     /** */ size_t line;
1408     /** */ size_t column;
1409     mixin OpEquals;
1410 }
1411 
1412 ///
1413 final class DeleteStatement : ASTNode
1414 {
1415 public:
1416     override void accept(ASTVisitor visitor) const
1417     {
1418         mixin (visitIfNotNull!(deleteExpression));
1419     }
1420     /** */ DeleteExpression deleteExpression;
1421     mixin OpEquals;
1422 }
1423 
1424 ///
1425 final class Deprecated : ASTNode
1426 {
1427 public:
1428     override void accept(ASTVisitor visitor) const
1429     {
1430         mixin (visitIfNotNull!(assignExpression));
1431     }
1432     /** */ ExpressionNode assignExpression;
1433     mixin OpEquals;
1434 }
1435 
1436 ///
1437 final class Destructor : ASTNode
1438 {
1439 public:
1440     override void accept(ASTVisitor visitor) const
1441     {
1442         mixin (visitIfNotNull!(memberFunctionAttributes, functionBody));
1443     }
1444     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
1445     /** */ FunctionBody functionBody;
1446     /** */ size_t line;
1447     /** */ size_t column;
1448     /** */ size_t index;
1449     /** */ string comment;
1450     mixin OpEquals;
1451 }
1452 
1453 ///
1454 final class DoStatement : ASTNode
1455 {
1456 public:
1457     override void accept(ASTVisitor visitor) const
1458     {
1459         mixin (visitIfNotNull!(expression, statementNoCaseNoDefault));
1460     }
1461     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
1462     /** */ Expression expression;
1463     mixin OpEquals;
1464 }
1465 
1466 ///
1467 final class EnumBody : ASTNode
1468 {
1469 public:
1470     override void accept(ASTVisitor visitor) const
1471     {
1472         mixin (visitIfNotNull!(enumMembers));
1473     }
1474     /** */ EnumMember[] enumMembers;
1475 
1476     /**
1477      * Byte position of the opening brace
1478      */
1479     size_t startLocation;
1480 
1481     /**
1482      * Byte position of the closing brace
1483      */
1484     size_t endLocation;
1485     mixin OpEquals;
1486 }
1487 
1488 ///
1489 final class EnumDeclaration : ASTNode
1490 {
1491 public:
1492     override void accept(ASTVisitor visitor) const
1493     {
1494         mixin (visitIfNotNull!(type, enumBody));
1495     }
1496     /** */ Token name;
1497     /** */ Type type;
1498     /** */ EnumBody enumBody;
1499     /** */ string comment;
1500     mixin OpEquals;
1501 }
1502 
1503 ///
1504 final class EnumMember : ASTNode
1505 {
1506 public:
1507     override void accept(ASTVisitor visitor) const
1508     {
1509         mixin (visitIfNotNull!(name, type, assignExpression));
1510     }
1511     /** */ Token name;
1512     /** */ Type type;
1513     /** */ ExpressionNode assignExpression;
1514     /** */ string comment;
1515     mixin OpEquals;
1516 }
1517 
1518 ///
1519 final class EponymousTemplateDeclaration : ASTNode
1520 {
1521 public:
1522     override void accept(ASTVisitor visitor) const
1523     {
1524         mixin (visitIfNotNull!(name, templateParameters, assignExpression));
1525     }
1526     /** */ Token name;
1527     /** */ TemplateParameters templateParameters;
1528     /** */ ExpressionNode assignExpression;
1529     /** */ Type type;
1530     mixin OpEquals;
1531 }
1532 
1533 ///
1534 final class EqualExpression : ExpressionNode
1535 {
1536 public:
1537     override void accept(ASTVisitor visitor) const
1538     {
1539         mixin (visitIfNotNull!(left, right));
1540     }
1541     /** */ IdType operator;
1542     mixin BinaryExpressionBody;
1543     mixin OpEquals;
1544 }
1545 
1546 ///
1547 final class Expression : ExpressionNode
1548 {
1549 public:
1550     override void accept(ASTVisitor visitor) const
1551     {
1552         mixin (visitIfNotNull!(items));
1553     }
1554     /** */ ExpressionNode[] items;
1555     /** */ size_t line;
1556     /** */ size_t column;
1557     mixin OpEquals;
1558 }
1559 
1560 ///
1561 final class ExpressionStatement : ASTNode
1562 {
1563 public:
1564     override void accept(ASTVisitor visitor) const
1565     {
1566         mixin (visitIfNotNull!(expression));
1567     }
1568     /** */ Expression expression;
1569     mixin OpEquals;
1570 }
1571 
1572 ///
1573 final class FinalSwitchStatement : ASTNode
1574 {
1575 public:
1576     override void accept(ASTVisitor visitor) const
1577     {
1578         mixin (visitIfNotNull!(switchStatement));
1579     }
1580     /** */ SwitchStatement switchStatement;
1581     mixin OpEquals;
1582 }
1583 
1584 ///
1585 final class Finally : ASTNode
1586 {
1587 public:
1588     override void accept(ASTVisitor visitor) const
1589     {
1590         mixin (visitIfNotNull!(declarationOrStatement));
1591     }
1592     /** */ DeclarationOrStatement declarationOrStatement;
1593     mixin OpEquals;
1594 }
1595 
1596 ///
1597 final class ForStatement : ASTNode
1598 {
1599 public:
1600     override void accept(ASTVisitor visitor) const
1601     {
1602         mixin (visitIfNotNull!(initialization, test, increment,
1603             declarationOrStatement));
1604     }
1605     /** */ DeclarationOrStatement initialization;
1606     /** */ Expression test;
1607     /** */ Expression increment;
1608     /** */ DeclarationOrStatement declarationOrStatement;
1609     /** */ size_t startIndex;
1610     mixin OpEquals;
1611 }
1612 
1613 ///
1614 final class ForeachStatement : ASTNode
1615 {
1616 public:
1617     override void accept(ASTVisitor visitor) const
1618     {
1619         mixin (visitIfNotNull!(foreachType, foreachTypeList, low, high,
1620             declarationOrStatement));
1621     }
1622     /** */ IdType type;
1623     /** */ ForeachTypeList foreachTypeList;
1624     /** */ ForeachType foreachType;
1625     /** */ Expression low;
1626     /** */ Expression high;
1627     /** */ DeclarationOrStatement declarationOrStatement;
1628     /** */ size_t startIndex;
1629     mixin OpEquals;
1630 }
1631 
1632 ///
1633 final class ForeachType : ASTNode
1634 {
1635 public:
1636     override void accept(ASTVisitor visitor) const
1637     {
1638         mixin (visitIfNotNull!(type, identifier));
1639     }
1640     /** */ bool isRef;
1641     /** */ IdType[] typeConstructors;
1642     /** */ Type type;
1643     /** */ Token identifier;
1644     mixin OpEquals;
1645 }
1646 
1647 ///
1648 final class ForeachTypeList : ASTNode
1649 {
1650 public:
1651     override void accept(ASTVisitor visitor) const
1652     {
1653         mixin (visitIfNotNull!(items));
1654     }
1655     /** */ ForeachType[] items;
1656     mixin OpEquals;
1657 }
1658 
1659 ///
1660 final class FunctionAttribute : ASTNode
1661 {
1662 public:
1663     override void accept(ASTVisitor visitor) const
1664     {
1665         mixin (visitIfNotNull!(token, atAttribute));
1666     }
1667     /** */ Token token;
1668     /** */ AtAttribute atAttribute;
1669     mixin OpEquals;
1670 }
1671 
1672 ///
1673 final class FunctionBody : ASTNode
1674 {
1675 public:
1676     override void accept(ASTVisitor visitor) const
1677     {
1678         mixin (visitIfNotNull!(inStatement, outStatement, bodyStatement,
1679             blockStatement));
1680     }
1681 
1682     /** */ BlockStatement blockStatement;
1683     /** */ BodyStatement bodyStatement;
1684     /** */ OutStatement outStatement;
1685     /** */ InStatement inStatement;
1686     mixin OpEquals;
1687 }
1688 
1689 ///
1690 final class FunctionCallExpression : ExpressionNode
1691 {
1692 public:
1693     override void accept(ASTVisitor visitor) const
1694     {
1695         mixin (visitIfNotNull!(type, unaryExpression, templateArguments, arguments));
1696     }
1697     /** */ Type type;
1698     /** */ UnaryExpression unaryExpression;
1699     /** */ TemplateArguments templateArguments;
1700     /** */ Arguments arguments;
1701     mixin OpEquals;
1702 }
1703 
1704 ///
1705 final class FunctionDeclaration : ASTNode
1706 {
1707 public:
1708     override void accept(ASTVisitor visitor) const
1709     {
1710         mixin (visitIfNotNull!(attributes, storageClasses, returnType, parameters,
1711             templateParameters, constraint, memberFunctionAttributes,
1712             functionBody));
1713     }
1714     /** */ bool hasAuto;
1715     /** */ bool hasRef;
1716     /** */ Type returnType;
1717     /** */ Token name;
1718     /** */ TemplateParameters templateParameters;
1719     /** */ Parameters parameters;
1720     /** */ Constraint constraint;
1721     /** */ FunctionBody functionBody;
1722     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
1723     /** */ string comment;
1724     /** */ Attribute[] attributes;
1725     /** */ StorageClass[] storageClasses;
1726     mixin OpEquals;
1727 }
1728 
1729 ///
1730 final class FunctionLiteralExpression : ExpressionNode
1731 {
1732 public:
1733     override void accept(ASTVisitor visitor) const
1734     {
1735         mixin (visitIfNotNull!(returnType, parameters, functionAttributes,
1736                 memberFunctionAttributes, functionBody, assignExpression));
1737     }
1738     /** */ ExpressionNode assignExpression;
1739     /** */ FunctionAttribute[] functionAttributes;
1740     /** */ FunctionBody functionBody;
1741     /** */ IdType functionOrDelegate;
1742     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
1743     /** */ Parameters parameters;
1744     /** */ Token identifier;
1745     /** */ Type returnType;
1746     mixin OpEquals;
1747 }
1748 
1749 ///
1750 final class GotoStatement : ASTNode
1751 {
1752 public:
1753     override void accept(ASTVisitor visitor) const
1754     {
1755         mixin (visitIfNotNull!(label, expression));
1756     }
1757     /** */ Expression expression;
1758     /** */ Token label;
1759     mixin OpEquals;
1760 }
1761 
1762 ///
1763 final class IdentifierChain : ASTNode
1764 {
1765 public:
1766     override void accept(ASTVisitor visitor) const
1767     {
1768         mixin (visitIfNotNull!(identifiers));
1769     }
1770     /** */ Token[] identifiers;
1771     mixin OpEquals;
1772 }
1773 
1774 ///
1775 final class IdentifierList : ASTNode
1776 {
1777 public:
1778     override void accept(ASTVisitor visitor) const
1779     {
1780         mixin (visitIfNotNull!(identifiers));
1781     }
1782     /** */ Token[] identifiers;
1783     mixin OpEquals;
1784 }
1785 
1786 ///
1787 final class IdentifierOrTemplateChain : ASTNode
1788 {
1789 public:
1790     override void accept(ASTVisitor visitor) const
1791     {
1792         mixin (visitIfNotNull!(identifiersOrTemplateInstances));
1793     }
1794 
1795     /** */ IdentifierOrTemplateInstance[] identifiersOrTemplateInstances;
1796     mixin OpEquals;
1797 }
1798 
1799 ///
1800 final class IdentifierOrTemplateInstance : ASTNode
1801 {
1802 public:
1803     override void accept(ASTVisitor visitor) const
1804     {
1805         mixin (visitIfNotNull!(identifier, templateInstance));
1806     }
1807 
1808     /** */ Token identifier;
1809     /** */ TemplateInstance templateInstance;
1810     mixin OpEquals;
1811 }
1812 
1813 ///
1814 final class IdentityExpression : ExpressionNode
1815 {
1816 public:
1817     override void accept(ASTVisitor visitor) const
1818     {
1819         mixin (visitIfNotNull!(left, right));
1820     }
1821     /** */ bool negated;
1822     mixin BinaryExpressionBody;
1823     mixin OpEquals;
1824 }
1825 
1826 ///
1827 final class IfStatement : ASTNode
1828 {
1829 public:
1830     override void accept(ASTVisitor visitor) const
1831     {
1832         mixin (visitIfNotNull!(identifier, type, expression, thenStatement,
1833             elseStatement));
1834     }
1835     /** */ Token identifier;
1836     /** */ Type type;
1837     /** */ Expression expression;
1838     /** */ DeclarationOrStatement thenStatement;
1839     /** */ DeclarationOrStatement elseStatement;
1840     /** */ size_t startIndex;
1841     /** */ size_t line;
1842     /** */ size_t column;
1843     mixin OpEquals;
1844 }
1845 
1846 ///
1847 final class ImportBind : ASTNode
1848 {
1849 public:
1850     override void accept(ASTVisitor visitor) const
1851     {
1852         mixin (visitIfNotNull!(left, right));
1853     }
1854     /** */ Token left;
1855     /** */ Token right;
1856     mixin OpEquals;
1857 }
1858 
1859 ///
1860 final class ImportBindings : ASTNode
1861 {
1862 public:
1863     override void accept(ASTVisitor visitor) const
1864     {
1865         mixin (visitIfNotNull!(singleImport, importBinds));
1866     }
1867     /** */ SingleImport singleImport;
1868     /** */ ImportBind[] importBinds;
1869     mixin OpEquals;
1870 }
1871 
1872 ///
1873 final class ImportDeclaration : ASTNode
1874 {
1875 public:
1876     override void accept(ASTVisitor visitor) const
1877     {
1878         mixin (visitIfNotNull!(singleImports, importBindings));
1879     }
1880     /** */ SingleImport[] singleImports;
1881     /** */ ImportBindings importBindings;
1882     mixin OpEquals;
1883 }
1884 
1885 ///
1886 final class ImportExpression : ExpressionNode
1887 {
1888 public:
1889     override void accept(ASTVisitor visitor) const
1890     {
1891         mixin (visitIfNotNull!(assignExpression));
1892     }
1893     /** */ ExpressionNode assignExpression;
1894     mixin OpEquals;
1895 }
1896 
1897 ///
1898 final class Index : ASTNode
1899 {
1900 public:
1901     override void accept(ASTVisitor visitor) const
1902     {
1903         mixin (visitIfNotNull!(low, high));
1904     }
1905     /** */ ExpressionNode low;
1906     /** */ ExpressionNode high;
1907     mixin OpEquals;
1908 }
1909 
1910 ///
1911 final class IndexExpression : ExpressionNode
1912 {
1913 public:
1914     override void accept(ASTVisitor visitor) const
1915     {
1916         mixin (visitIfNotNull!(unaryExpression, indexes));
1917     }
1918     /** */ UnaryExpression unaryExpression;
1919     /** */ Index[] indexes;
1920     mixin OpEquals;
1921 }
1922 
1923 ///
1924 final class InExpression : ExpressionNode
1925 {
1926 public:
1927     override void accept(ASTVisitor visitor) const
1928     {
1929         mixin (visitIfNotNull!(left, right));
1930     }
1931     mixin BinaryExpressionBody;
1932     bool negated;
1933     mixin OpEquals;
1934 }
1935 
1936 ///
1937 final class InStatement : ASTNode
1938 {
1939 public:
1940     override void accept(ASTVisitor visitor) const
1941     {
1942         mixin (visitIfNotNull!(blockStatement));
1943     }
1944     /** */ size_t inTokenLocation;
1945     /** */ BlockStatement blockStatement;
1946     mixin OpEquals;
1947 }
1948 
1949 ///
1950 final class Initialize : ASTNode
1951 {
1952 public:
1953     override void accept(ASTVisitor visitor) const
1954     {
1955         mixin (visitIfNotNull!(statementNoCaseNoDefault));
1956     }
1957     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
1958     mixin OpEquals;
1959 }
1960 
1961 ///
1962 final class Initializer : ASTNode
1963 {
1964 public:
1965     override void accept(ASTVisitor visitor) const
1966     {
1967         mixin (visitIfNotNull!(nonVoidInitializer));
1968     }
1969     /** */ NonVoidInitializer nonVoidInitializer;
1970     mixin OpEquals;
1971 }
1972 
1973 ///
1974 final class InterfaceDeclaration : ASTNode
1975 {
1976 public:
1977     override void accept(ASTVisitor visitor) const
1978     {
1979         mixin (visitIfNotNull!(templateParameters, constraint, baseClassList,
1980             structBody));
1981     }
1982     /** */ Token name;
1983     /** */ TemplateParameters templateParameters;
1984     /** */ Constraint constraint;
1985     /** */ BaseClassList baseClassList;
1986     /** */ StructBody structBody;
1987     /** */ string comment;
1988     mixin OpEquals;
1989 }
1990 
1991 ///
1992 final class Invariant : ASTNode
1993 {
1994 public:
1995     override void accept(ASTVisitor visitor) const
1996     {
1997         mixin (visitIfNotNull!(blockStatement));
1998     }
1999     /** */ BlockStatement blockStatement;
2000     /** */ string comment;
2001     size_t line;
2002     size_t index;
2003     mixin OpEquals;
2004 }
2005 
2006 ///
2007 final class IsExpression : ExpressionNode
2008 {
2009 public:
2010     override void accept(ASTVisitor visitor) const
2011     {
2012         mixin (visitIfNotNull!(type, identifier, typeSpecialization,
2013             templateParameterList));
2014     }
2015     /** */ Type type;
2016     /** */ Token identifier;
2017     /** */ TypeSpecialization typeSpecialization;
2018     /** */ TemplateParameterList templateParameterList;
2019     /** */ IdType equalsOrColon;
2020     mixin OpEquals;
2021 }
2022 
2023 ///
2024 final class KeyValuePair : ASTNode
2025 {
2026 public:
2027     override void accept(ASTVisitor visitor) const
2028     {
2029         mixin (visitIfNotNull!(key, value));
2030     }
2031     /** */ ExpressionNode key;
2032     /** */ ExpressionNode value;
2033     mixin OpEquals;
2034 }
2035 
2036 ///
2037 final class KeyValuePairs : ASTNode
2038 {
2039 public:
2040     override void accept(ASTVisitor visitor) const
2041     {
2042         mixin (visitIfNotNull!(keyValuePairs));
2043     }
2044     /** */ KeyValuePair[] keyValuePairs;
2045     mixin OpEquals;
2046 }
2047 
2048 ///
2049 final class LabeledStatement : ASTNode
2050 {
2051 public:
2052     override void accept(ASTVisitor visitor) const
2053     {
2054         mixin (visitIfNotNull!(identifier, declarationOrStatement));
2055     }
2056     Token identifier;
2057     /** */ DeclarationOrStatement declarationOrStatement;
2058     mixin OpEquals;
2059 }
2060 
2061 ///
2062 final class LastCatch : ASTNode
2063 {
2064 public:
2065     override void accept(ASTVisitor visitor) const
2066     {
2067         mixin (visitIfNotNull!(statementNoCaseNoDefault));
2068     }
2069     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
2070     size_t line;
2071     size_t column;
2072     mixin OpEquals;
2073 }
2074 
2075 ///
2076 final class LinkageAttribute : ASTNode
2077 {
2078 public:
2079     override void accept(ASTVisitor visitor) const
2080     {
2081         mixin (visitIfNotNull!(identifier, identifierChain));
2082     }
2083     /** */ Token identifier;
2084     /** */ bool hasPlusPlus;
2085     /** */ IdentifierChain identifierChain;
2086     mixin OpEquals;
2087 }
2088 
2089 ///
2090 final class MemberFunctionAttribute : ASTNode
2091 {
2092 public:
2093     override void accept(ASTVisitor visitor) const
2094     {
2095         mixin (visitIfNotNull!(atAttribute));
2096     }
2097     /** */ IdType tokenType;
2098     /** */ AtAttribute atAttribute;
2099     mixin OpEquals;
2100 }
2101 
2102 ///
2103 final class MixinDeclaration : ASTNode
2104 {
2105 public:
2106     override void accept(ASTVisitor visitor) const
2107     {
2108         mixin (visitIfNotNull!(mixinExpression, templateMixinExpression));
2109     }
2110     /** */ MixinExpression mixinExpression;
2111     /** */ TemplateMixinExpression templateMixinExpression;
2112     mixin OpEquals;
2113 }
2114 
2115 ///
2116 final class MixinExpression : ExpressionNode
2117 {
2118 public:
2119     override void accept(ASTVisitor visitor) const
2120     {
2121         mixin (visitIfNotNull!(assignExpression));
2122     }
2123     /** */ ExpressionNode assignExpression;
2124     mixin OpEquals;
2125 }
2126 
2127 ///
2128 final class MixinTemplateDeclaration : ASTNode
2129 {
2130 public:
2131     override void accept(ASTVisitor visitor) const
2132     {
2133         mixin (visitIfNotNull!(templateDeclaration));
2134     }
2135     /** */ TemplateDeclaration templateDeclaration;
2136     mixin OpEquals;
2137 }
2138 
2139 ///
2140 final class MixinTemplateName : ASTNode
2141 {
2142 public:
2143     override void accept(ASTVisitor visitor) const
2144     {
2145         mixin (visitIfNotNull!(symbol, typeofExpression, identifierOrTemplateChain));
2146     }
2147     /** */ Symbol symbol;
2148     /** */ IdentifierOrTemplateChain identifierOrTemplateChain;
2149     /** */ TypeofExpression typeofExpression;
2150     mixin OpEquals;
2151 }
2152 
2153 ///
2154 final class Module : ASTNode
2155 {
2156 public:
2157     override void accept(ASTVisitor visitor) const
2158     {
2159         mixin (visitIfNotNull!(scriptLine, moduleDeclaration, declarations));
2160     }
2161     /** */ Token scriptLine;
2162     /** */ ModuleDeclaration moduleDeclaration;
2163     /** */ Declaration[] declarations;
2164     mixin OpEquals;
2165 }
2166 
2167 ///
2168 final class ModuleDeclaration : ASTNode
2169 {
2170 public:
2171     override void accept(ASTVisitor visitor) const
2172     {
2173         mixin (visitIfNotNull!(moduleName, deprecated_));
2174     }
2175     /** */ Deprecated deprecated_;
2176     /** */ IdentifierChain moduleName;
2177     /** */ size_t startLocation;
2178     /** */ size_t endLocation;
2179     /** */ string comment;
2180     mixin OpEquals;
2181 }
2182 
2183 
2184 ///
2185 final class MulExpression : ExpressionNode
2186 {
2187 public:
2188     override void accept(ASTVisitor visitor) const
2189     {
2190         mixin (visitIfNotNull!(left, right));
2191     }
2192     /** */ IdType operator;
2193     mixin BinaryExpressionBody;
2194     mixin OpEquals;
2195 }
2196 
2197 ///
2198 final class NewAnonClassExpression : ExpressionNode
2199 {
2200 public:
2201     override void accept(ASTVisitor visitor) const
2202     {
2203         mixin (visitIfNotNull!(allocatorArguments, constructorArguments,
2204             baseClassList, structBody));
2205     }
2206     /** */ Arguments allocatorArguments;
2207     /** */ Arguments constructorArguments;
2208     /** */ BaseClassList baseClassList;
2209     /** */ StructBody structBody;
2210     mixin OpEquals;
2211 }
2212 
2213 ///
2214 final class NewExpression : ExpressionNode
2215 {
2216 public:
2217     override void accept(ASTVisitor visitor) const
2218     {
2219         mixin (visitIfNotNull!(newAnonClassExpression, type, arguments,
2220             assignExpression));
2221     }
2222     /** */ Type type;
2223     /** */ NewAnonClassExpression newAnonClassExpression;
2224     /** */ Arguments arguments;
2225     /** */ ExpressionNode assignExpression;
2226     mixin OpEquals;
2227 }
2228 
2229 
2230 ///
2231 final class StatementNoCaseNoDefault : ASTNode
2232 {
2233 public:
2234     override void accept(ASTVisitor visitor) const
2235     {
2236         mixin (visitIfNotNull!(labeledStatement, blockStatement, ifStatement,
2237             whileStatement, doStatement, forStatement, foreachStatement,
2238             switchStatement, finalSwitchStatement, continueStatement,
2239             breakStatement, returnStatement, gotoStatement, withStatement,
2240             synchronizedStatement, tryStatement, throwStatement,
2241             scopeGuardStatement, asmStatement, conditionalStatement,
2242             staticAssertStatement, versionSpecification, debugSpecification,
2243             expressionStatement));
2244     }
2245     /** */ LabeledStatement labeledStatement;
2246     /** */ BlockStatement blockStatement;
2247     /** */ IfStatement ifStatement;
2248     /** */ WhileStatement whileStatement;
2249     /** */ DoStatement doStatement;
2250     /** */ ForStatement forStatement;
2251     /** */ ForeachStatement foreachStatement;
2252     /** */ SwitchStatement switchStatement;
2253     /** */ FinalSwitchStatement finalSwitchStatement;
2254     /** */ ContinueStatement continueStatement;
2255     /** */ BreakStatement breakStatement;
2256     /** */ ReturnStatement returnStatement;
2257     /** */ GotoStatement gotoStatement;
2258     /** */ WithStatement withStatement;
2259     /** */ SynchronizedStatement synchronizedStatement;
2260     /** */ TryStatement tryStatement;
2261     /** */ ThrowStatement throwStatement;
2262     /** */ ScopeGuardStatement scopeGuardStatement;
2263     /** */ AsmStatement asmStatement;
2264     /** */ ConditionalStatement conditionalStatement;
2265     /** */ StaticAssertStatement staticAssertStatement;
2266     /** */ VersionSpecification versionSpecification;
2267     /** */ DebugSpecification debugSpecification;
2268     /** */ ExpressionStatement expressionStatement;
2269     /** */ size_t startLocation;
2270     /** */ size_t endLocation;
2271     mixin OpEquals;
2272 }
2273 
2274 ///
2275 final class NonVoidInitializer : ASTNode
2276 {
2277 public:
2278     override void accept(ASTVisitor visitor) const
2279     {
2280         mixin (visitIfNotNull!(assignExpression, arrayInitializer,
2281             structInitializer));
2282     }
2283     /** */ ExpressionNode assignExpression;
2284     /** */ ArrayInitializer arrayInitializer;
2285     /** */ StructInitializer structInitializer;
2286 
2287     mixin OpEquals;
2288 }
2289 
2290 ///
2291 final class Operands : ASTNode
2292 {
2293 public:
2294     override void accept(ASTVisitor visitor) const
2295     {
2296         mixin (visitIfNotNull!(operands));
2297     }
2298     /** */ ExpressionNode[] operands;
2299     mixin OpEquals;
2300 }
2301 
2302 ///
2303 final class OrExpression : ExpressionNode
2304 {
2305 public:
2306     override void accept(ASTVisitor visitor) const
2307     {
2308         mixin (visitIfNotNull!(left, right));
2309     }
2310     mixin BinaryExpressionBody;
2311     mixin OpEquals;
2312 }
2313 
2314 ///
2315 final class OrOrExpression : ExpressionNode
2316 {
2317 public:
2318     override void accept(ASTVisitor visitor) const
2319     {
2320         mixin (visitIfNotNull!(left, right));
2321     }
2322     mixin BinaryExpressionBody;
2323     mixin OpEquals;
2324 }
2325 
2326 ///
2327 final class OutStatement : ASTNode
2328 {
2329 public:
2330     override void accept(ASTVisitor visitor) const
2331     {
2332         mixin (visitIfNotNull!(parameter, blockStatement));
2333     }
2334     /** */ size_t outTokenLocation;
2335     /** */ Token parameter;
2336     /** */ BlockStatement blockStatement;
2337     mixin OpEquals;
2338 }
2339 
2340 ///
2341 final class Parameter : ASTNode
2342 {
2343 public:
2344     override void accept(ASTVisitor visitor) const
2345     {
2346         mixin (visitIfNotNull!(type, name, default_));
2347     }
2348 
2349     /** */ IdType[] parameterAttributes;
2350     /** */ Type type;
2351     /** */ Token name;
2352     /** */ bool vararg;
2353     /** */ ExpressionNode default_;
2354     /** */ TypeSuffix[] cstyle;
2355 
2356     mixin OpEquals;
2357 }
2358 
2359 ///
2360 final class Parameters : ASTNode
2361 {
2362 public:
2363     override void accept(ASTVisitor visitor) const
2364     {
2365         mixin (visitIfNotNull!(parameters));
2366     }
2367 
2368     /** */ Parameter[] parameters;
2369     /** */ bool hasVarargs;
2370     mixin OpEquals;
2371 }
2372 
2373 ///
2374 final class Postblit : ASTNode
2375 {
2376 public:
2377     override void accept(ASTVisitor visitor) const
2378     {
2379         mixin (visitIfNotNull!(functionBody));
2380     }
2381     /** */ FunctionBody functionBody;
2382     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
2383     mixin OpEquals;
2384 }
2385 
2386 ///
2387 final class PowExpression : ExpressionNode
2388 {
2389 public:
2390     override void accept(ASTVisitor visitor) const
2391     {
2392         mixin (visitIfNotNull!(left, right));
2393     }
2394     mixin BinaryExpressionBody;
2395     mixin OpEquals;
2396 }
2397 
2398 ///
2399 final class PragmaDeclaration : ASTNode
2400 {
2401 public:
2402     override void accept(ASTVisitor visitor) const
2403     {
2404         mixin (visitIfNotNull!(pragmaExpression));
2405     }
2406     /** */ PragmaExpression pragmaExpression;
2407     mixin OpEquals;
2408 }
2409 
2410 ///
2411 final class PragmaExpression : ExpressionNode
2412 {
2413 public:
2414     override void accept(ASTVisitor visitor) const
2415     {
2416         mixin (visitIfNotNull!(identifier, argumentList));
2417     }
2418     /** */ Token identifier;
2419     /** */ ArgumentList argumentList;
2420     mixin OpEquals;
2421 }
2422 
2423 ///
2424 final class PrimaryExpression : ExpressionNode
2425 {
2426 public:
2427     override void accept(ASTVisitor visitor) const
2428     {
2429         mixin(visitIfNotNull!(basicType, typeConstructor, type, primary,
2430                 typeofExpression, typeidExpression, arrayLiteral, assocArrayLiteral,
2431                 expression, dot, identifierOrTemplateInstance, isExpression,
2432                 functionLiteralExpression,traitsExpression, mixinExpression,
2433                 importExpression, vector, arguments));
2434     }
2435     /** */ Token dot;
2436     /** */ Token primary;
2437     /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance;
2438     /** */ Token basicType;
2439     /** */ TypeofExpression typeofExpression;
2440     /** */ TypeidExpression typeidExpression;
2441     /** */ ArrayLiteral arrayLiteral;
2442     /** */ AssocArrayLiteral assocArrayLiteral;
2443     /** */ Expression expression;
2444     /** */ IsExpression isExpression;
2445     /** */ FunctionLiteralExpression functionLiteralExpression;
2446     /** */ TraitsExpression traitsExpression;
2447     /** */ MixinExpression mixinExpression;
2448     /** */ ImportExpression importExpression;
2449     /** */ Vector vector;
2450     /** */ Type type;
2451     /** */ Token typeConstructor;
2452     /** */ Arguments arguments;
2453     mixin OpEquals;
2454 }
2455 
2456 ///
2457 final class Register : ASTNode
2458 {
2459 public:
2460     override void accept(ASTVisitor visitor) const
2461     {
2462         mixin (visitIfNotNull!(identifier, intLiteral));
2463     }
2464     /** */ Token identifier;
2465     /** */ Token intLiteral;
2466     /** */ bool hasIntegerLiteral;
2467     mixin OpEquals;
2468 }
2469 
2470 ///
2471 final class RelExpression : ExpressionNode
2472 {
2473 public:
2474     override void accept(ASTVisitor visitor) const
2475     {
2476         mixin (visitIfNotNull!(left, right));
2477     }
2478     /** */ IdType operator;
2479     mixin BinaryExpressionBody;
2480     mixin OpEquals;
2481 }
2482 
2483 ///
2484 final class ReturnStatement : ASTNode
2485 {
2486 public:
2487     override void accept(ASTVisitor visitor) const
2488     {
2489         mixin (visitIfNotNull!(expression));
2490     }
2491     /** */ Expression expression;
2492     /** */ size_t startLocation;
2493     /** */ size_t endLocation;
2494     mixin OpEquals;
2495 }
2496 
2497 ///
2498 final class ScopeGuardStatement : ASTNode
2499 {
2500 public:
2501     override void accept(ASTVisitor visitor) const
2502     {
2503         mixin (visitIfNotNull!(identifier, statementNoCaseNoDefault));
2504     }
2505     /** */ Token identifier;
2506     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
2507     mixin OpEquals;
2508 }
2509 
2510 ///
2511 final class SharedStaticConstructor : ASTNode
2512 {
2513 public:
2514     override void accept(ASTVisitor visitor) const
2515     {
2516         mixin (visitIfNotNull!(memberFunctionAttributes, functionBody));
2517     }
2518     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
2519     /** */ FunctionBody functionBody;
2520     /** */ size_t location;
2521     /** */ size_t line;
2522     /** */ size_t column;
2523     /** */ string comment;
2524     mixin OpEquals;
2525 }
2526 
2527 ///
2528 final class SharedStaticDestructor : ASTNode
2529 {
2530 public:
2531     override void accept(ASTVisitor visitor) const
2532     {
2533         mixin (visitIfNotNull!(memberFunctionAttributes, functionBody));
2534     }
2535     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
2536     /** */ FunctionBody functionBody;
2537     /** */ size_t location;
2538     /** */ size_t line;
2539     /** */ size_t column;
2540     /** */ string comment;
2541     mixin OpEquals;
2542 }
2543 
2544 ///
2545 final class ShiftExpression : ExpressionNode
2546 {
2547 public:
2548     override void accept(ASTVisitor visitor) const
2549     {
2550         mixin (visitIfNotNull!(left, right));
2551     }
2552     /** */ IdType operator;
2553     mixin BinaryExpressionBody;
2554     mixin OpEquals;
2555 }
2556 
2557 ///
2558 final class SingleImport : ASTNode
2559 {
2560 public:
2561     override void accept(ASTVisitor visitor) const
2562     {
2563         mixin (visitIfNotNull!(rename, identifierChain));
2564     }
2565     /** */ Token rename;
2566     /** */ IdentifierChain identifierChain;
2567     mixin OpEquals;
2568 }
2569 
2570 ///
2571 final class Statement : ASTNode
2572 {
2573 public:
2574     override void accept(ASTVisitor visitor) const
2575     {
2576         mixin (visitIfNotNull!(statementNoCaseNoDefault, caseStatement,
2577             caseRangeStatement, defaultStatement));
2578     }
2579     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
2580     /** */ CaseStatement caseStatement;
2581     /** */ CaseRangeStatement caseRangeStatement;
2582     /** */ DefaultStatement defaultStatement;
2583     mixin OpEquals;
2584 }
2585 
2586 ///
2587 final class StaticAssertDeclaration : ASTNode
2588 {
2589 public:
2590     override void accept(ASTVisitor visitor) const
2591     {
2592         mixin (visitIfNotNull!(staticAssertStatement));
2593     }
2594     /** */ StaticAssertStatement staticAssertStatement;
2595     mixin OpEquals;
2596 }
2597 
2598 ///
2599 final class StaticAssertStatement : ASTNode
2600 {
2601 public:
2602     override void accept(ASTVisitor visitor) const
2603     {
2604         mixin (visitIfNotNull!(assertExpression));
2605     }
2606     /** */ AssertExpression assertExpression;
2607     mixin OpEquals;
2608 }
2609 
2610 ///
2611 final class StaticConstructor : ASTNode
2612 {
2613 public:
2614     override void accept(ASTVisitor visitor) const
2615     {
2616         mixin (visitIfNotNull!(memberFunctionAttributes, functionBody));
2617     }
2618     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
2619     /** */ FunctionBody functionBody;
2620     /** */ size_t location;
2621     /** */ size_t line;
2622     /** */ size_t column;
2623     /** */ string comment;
2624     mixin OpEquals;
2625 }
2626 
2627 ///
2628 final class StaticDestructor : ASTNode
2629 {
2630 public:
2631     override void accept(ASTVisitor visitor) const
2632     {
2633         mixin (visitIfNotNull!(memberFunctionAttributes, functionBody));
2634     }
2635     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
2636     /** */ FunctionBody functionBody;
2637     /** */ size_t location;
2638     /** */ size_t line;
2639     /** */ size_t column;
2640     /** */ string comment;
2641     mixin OpEquals;
2642 }
2643 
2644 ///
2645 final class StaticIfCondition : ASTNode
2646 {
2647 public:
2648     override void accept(ASTVisitor visitor) const
2649     {
2650         mixin (visitIfNotNull!(assignExpression));
2651     }
2652     /** */ ExpressionNode assignExpression;
2653     mixin OpEquals;
2654 }
2655 
2656 ///
2657 final class StorageClass : ASTNode
2658 {
2659 public:
2660     override void accept(ASTVisitor visitor) const
2661     {
2662         mixin (visitIfNotNull!(token, alignAttribute, linkageAttribute,
2663             atAttribute, deprecated_));
2664     }
2665     /** */ AlignAttribute alignAttribute;
2666     /** */ LinkageAttribute linkageAttribute;
2667     /** */ AtAttribute atAttribute;
2668     /** */ Deprecated deprecated_;
2669     /** */ Token token;
2670     mixin OpEquals;
2671 }
2672 
2673 ///
2674 final class StructBody : ASTNode
2675 {
2676 public:
2677     override void accept(ASTVisitor visitor) const
2678     {
2679         mixin (visitIfNotNull!(declarations));
2680     }
2681 
2682     /**
2683      * Byte position of the opening brace
2684      */
2685     size_t startLocation;
2686 
2687     /**
2688      * Byte position of the closing brace
2689      */
2690     size_t endLocation;
2691     /** */ Declaration[] declarations;
2692     mixin OpEquals;
2693 }
2694 
2695 ///
2696 final class StructDeclaration : ASTNode
2697 {
2698 public:
2699     override void accept(ASTVisitor visitor) const
2700     {
2701         mixin (visitIfNotNull!(templateParameters, constraint, structBody));
2702     }
2703     /** */ Token name;
2704     /** */ TemplateParameters templateParameters;
2705     /** */ Constraint constraint;
2706     /** */ StructBody structBody;
2707     /** */ string comment;
2708     mixin OpEquals;
2709 }
2710 
2711 ///
2712 final class StructInitializer : ASTNode
2713 {
2714 public:
2715     override void accept(ASTVisitor visitor) const
2716     {
2717         mixin (visitIfNotNull!(structMemberInitializers));
2718     }
2719     /** */ StructMemberInitializers structMemberInitializers;
2720     /** */ size_t startLocation;
2721     /** */ size_t endLocation;
2722     mixin OpEquals;
2723 }
2724 
2725 ///
2726 final class StructMemberInitializer : ASTNode
2727 {
2728 public:
2729     override void accept(ASTVisitor visitor) const
2730     {
2731         mixin (visitIfNotNull!(identifier, nonVoidInitializer));
2732     }
2733     /** */ Token identifier;
2734     /** */ NonVoidInitializer nonVoidInitializer;
2735     mixin OpEquals;
2736 }
2737 
2738 ///
2739 final class StructMemberInitializers : ASTNode
2740 {
2741 public:
2742     override void accept(ASTVisitor visitor) const
2743     {
2744         mixin (visitIfNotNull!(structMemberInitializers));
2745     }
2746     /** */ StructMemberInitializer[] structMemberInitializers;
2747     mixin OpEquals;
2748 }
2749 
2750 ///
2751 final class SwitchStatement : ASTNode
2752 {
2753 public:
2754     override void accept(ASTVisitor visitor) const
2755     {
2756         mixin (visitIfNotNull!(expression, statement));
2757     }
2758     /** */ Expression expression;
2759     /** */ Statement statement;
2760     mixin OpEquals;
2761 }
2762 
2763 ///
2764 final class Symbol : ASTNode
2765 {
2766 public:
2767     override void accept(ASTVisitor visitor) const
2768     {
2769         mixin (visitIfNotNull!(identifierOrTemplateChain));
2770     }
2771 
2772     /** */ IdentifierOrTemplateChain identifierOrTemplateChain;
2773     /** */ bool dot;
2774     mixin OpEquals;
2775 }
2776 
2777 ///
2778 final class SynchronizedStatement : ASTNode
2779 {
2780 public:
2781     override void accept(ASTVisitor visitor) const
2782     {
2783         mixin (visitIfNotNull!(expression, statementNoCaseNoDefault));
2784     }
2785     /** */ Expression expression;
2786     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
2787     mixin OpEquals;
2788 }
2789 
2790 ///
2791 final class TemplateAliasParameter : ASTNode
2792 {
2793 public:
2794     override void accept(ASTVisitor visitor) const
2795     {
2796         mixin (visitIfNotNull!(type, identifier, colonType, colonExpression,
2797             assignType, assignExpression));
2798     }
2799     /** */ Type type;
2800     /** */ Token identifier;
2801     /** */ Type colonType;
2802     /** */ ExpressionNode colonExpression;
2803     /** */ Type assignType;
2804     /** */ ExpressionNode assignExpression;
2805     mixin OpEquals;
2806 }
2807 
2808 ///
2809 final class TemplateArgument : ASTNode
2810 {
2811 public:
2812     override void accept(ASTVisitor visitor) const
2813     {
2814         mixin (visitIfNotNull!(type, assignExpression));
2815     }
2816     /** */ Type type;
2817     /** */ ExpressionNode assignExpression;
2818     mixin OpEquals;
2819 }
2820 
2821 ///
2822 final class TemplateArgumentList : ASTNode
2823 {
2824 public:
2825     override void accept(ASTVisitor visitor) const
2826     {
2827         mixin (visitIfNotNull!(items));
2828     }
2829     /** */ TemplateArgument[] items;
2830     mixin OpEquals;
2831 }
2832 
2833 ///
2834 final class TemplateArguments : ASTNode
2835 {
2836 public:
2837     override void accept(ASTVisitor visitor) const
2838     {
2839         mixin (visitIfNotNull!(templateArgumentList, templateSingleArgument));
2840     }
2841     /** */ TemplateArgumentList templateArgumentList;
2842     /** */ TemplateSingleArgument templateSingleArgument;
2843     mixin OpEquals;
2844 }
2845 
2846 ///
2847 final class TemplateDeclaration : ASTNode
2848 {
2849 public:
2850     override void accept(ASTVisitor visitor) const
2851     {
2852         mixin (visitIfNotNull!(name, templateParameters, constraint,
2853             declarations));
2854     }
2855     /** */ Token name;
2856     /** */ TemplateParameters templateParameters;
2857     /** */ Constraint constraint;
2858     /** */ Declaration[] declarations;
2859     /** */ string comment;
2860     /**
2861      * Byte position of the opening brace
2862      */
2863     size_t startLocation;
2864 
2865     /**
2866      * Byte position of the closing brace
2867      */
2868     size_t endLocation;
2869     mixin OpEquals;
2870 }
2871 
2872 ///
2873 final class TemplateInstance : ASTNode
2874 {
2875 public:
2876     override void accept(ASTVisitor visitor) const
2877     {
2878         mixin (visitIfNotNull!(identifier, templateArguments));
2879     }
2880     /** */ Token identifier;
2881     /** */ TemplateArguments templateArguments;
2882     mixin OpEquals;
2883 }
2884 
2885 ///
2886 final class TemplateMixinExpression : ExpressionNode
2887 {
2888 public:
2889     override void accept(ASTVisitor visitor) const
2890     {
2891         mixin (visitIfNotNull!(identifier, templateArguments, mixinTemplateName));
2892     }
2893     /** */ Token identifier;
2894     /** */ TemplateArguments templateArguments;
2895     /** */ MixinTemplateName mixinTemplateName;
2896     mixin OpEquals;
2897 }
2898 
2899 ///
2900 final class TemplateParameter : ASTNode
2901 {
2902 public:
2903     override void accept(ASTVisitor visitor) const
2904     {
2905         mixin (visitIfNotNull!(templateTypeParameter, templateValueParameter,
2906             templateAliasParameter, templateTupleParameter,
2907             templateThisParameter));
2908     }
2909     /** */ TemplateTypeParameter templateTypeParameter;
2910     /** */ TemplateValueParameter templateValueParameter;
2911     /** */ TemplateAliasParameter templateAliasParameter;
2912     /** */ TemplateTupleParameter templateTupleParameter;
2913     /** */ TemplateThisParameter templateThisParameter;
2914     mixin OpEquals;
2915 }
2916 
2917 ///
2918 final class TemplateParameterList : ASTNode
2919 {
2920 public:
2921     override void accept(ASTVisitor visitor) const
2922     {
2923         mixin (visitIfNotNull!(items));
2924     }
2925     /** */ TemplateParameter[] items;
2926     mixin OpEquals;
2927 }
2928 
2929 ///
2930 final class TemplateParameters : ASTNode
2931 {
2932 public:
2933     override void accept(ASTVisitor visitor) const
2934     {
2935         mixin (visitIfNotNull!(templateParameterList));
2936     }
2937     /** */ TemplateParameterList templateParameterList;
2938     mixin OpEquals;
2939 }
2940 
2941 ///
2942 final class TemplateSingleArgument : ASTNode
2943 {
2944 public:
2945     override void accept(ASTVisitor visitor) const
2946     {
2947         mixin (visitIfNotNull!(token));
2948     }
2949     /** */ Token token;
2950     mixin OpEquals;
2951 }
2952 
2953 ///
2954 final class TemplateThisParameter : ASTNode
2955 {
2956 public:
2957     override void accept(ASTVisitor visitor) const
2958     {
2959         mixin (visitIfNotNull!(templateTypeParameter));
2960     }
2961     /** */ TemplateTypeParameter templateTypeParameter;
2962     mixin OpEquals;
2963 }
2964 
2965 ///
2966 final class TemplateTupleParameter : ASTNode
2967 {
2968 public:
2969     override void accept(ASTVisitor visitor) const
2970     {
2971         mixin (visitIfNotNull!(identifier));
2972     }
2973     /** */ Token identifier;
2974     mixin OpEquals;
2975 }
2976 
2977 ///
2978 final class TemplateTypeParameter : ASTNode
2979 {
2980 public:
2981     override void accept(ASTVisitor visitor) const
2982     {
2983         mixin (visitIfNotNull!(identifier, colonType, assignType));
2984     }
2985     /** */ Token identifier;
2986     /** */ Type colonType;
2987     /** */ Type assignType;
2988     mixin OpEquals;
2989 }
2990 
2991 ///
2992 final class TemplateValueParameter : ASTNode
2993 {
2994 public:
2995     override void accept(ASTVisitor visitor) const
2996     {
2997         mixin (visitIfNotNull!(type, identifier, assignExpression,
2998             templateValueParameterDefault));
2999     }
3000     /** */ Type type;
3001     /** */ Token identifier;
3002     /** */ ExpressionNode assignExpression;
3003     /** */ TemplateValueParameterDefault templateValueParameterDefault;
3004     mixin OpEquals;
3005 }
3006 
3007 ///
3008 final class TemplateValueParameterDefault : ASTNode
3009 {
3010 public:
3011     override void accept(ASTVisitor visitor) const
3012     {
3013         mixin (visitIfNotNull!(token, assignExpression));
3014     }
3015     /** */ ExpressionNode assignExpression;
3016     /** */ Token token;
3017     mixin OpEquals;
3018 }
3019 
3020 ///
3021 final class TernaryExpression : ExpressionNode
3022 {
3023 public:
3024     override void accept(ASTVisitor visitor) const
3025     {
3026         mixin (visitIfNotNull!(orOrExpression, expression, ternaryExpression));
3027     }
3028     /** */ ExpressionNode orOrExpression;
3029     /** */ ExpressionNode expression;
3030     /** */ ExpressionNode ternaryExpression;
3031     /// Store this so that we know where the ':' is
3032     Token colon;
3033     mixin OpEquals;
3034 }
3035 
3036 ///
3037 final class ThrowStatement : ASTNode
3038 {
3039 public:
3040     override void accept(ASTVisitor visitor) const
3041     {
3042         mixin (visitIfNotNull!(expression));
3043     }
3044     /** */ Expression expression;
3045     mixin OpEquals;
3046 }
3047 
3048 ///
3049 final class TraitsExpression : ExpressionNode
3050 {
3051 public:
3052     override void accept(ASTVisitor visitor) const
3053     {
3054         mixin (visitIfNotNull!(identifier, templateArgumentList));
3055     }
3056     /** */ Token identifier;
3057     /** */ TemplateArgumentList templateArgumentList;
3058     mixin OpEquals;
3059 }
3060 
3061 ///
3062 final class TryStatement : ASTNode
3063 {
3064 public:
3065     override void accept(ASTVisitor visitor) const
3066     {
3067         mixin (visitIfNotNull!(declarationOrStatement, catches, finally_));
3068     }
3069     /** */ DeclarationOrStatement declarationOrStatement;
3070     /** */ Catches catches;
3071     /** */ Finally finally_;
3072     mixin OpEquals;
3073 }
3074 
3075 ///
3076 final class Type : ASTNode
3077 {
3078 public:
3079     override void accept(ASTVisitor visitor) const
3080     {
3081         mixin (visitIfNotNull!(type2, typeSuffixes));
3082     }
3083 
3084     /** */ IdType[] typeConstructors;
3085     /** */ TypeSuffix[] typeSuffixes;
3086     /** */ Type2 type2;
3087     mixin OpEquals;
3088 }
3089 
3090 ///
3091 final class Type2 : ASTNode
3092 {
3093 public:
3094     override void accept(ASTVisitor visitor) const
3095     {
3096         mixin (visitIfNotNull!(symbol, typeofExpression,
3097             identifierOrTemplateChain, type, vector));
3098     }
3099 
3100     /** */ IdType builtinType;
3101     /** */ alias superOrThis = builtinType;
3102     /** */ Symbol symbol;
3103     /** */ TypeofExpression typeofExpression;
3104     /** */ IdentifierOrTemplateChain identifierOrTemplateChain;
3105     /** */ IdType typeConstructor;
3106     /** */ Type type;
3107     /** */ Vector vector;
3108     mixin OpEquals;
3109 }
3110 
3111 ///
3112 final class TypeSpecialization : ASTNode
3113 {
3114 public:
3115     override void accept(ASTVisitor visitor) const
3116     {
3117         mixin (visitIfNotNull!(token, type));
3118     }
3119     /** */ Token token;
3120     /** */ Type type;
3121     mixin OpEquals;
3122 }
3123 
3124 ///
3125 final class TypeSuffix : ASTNode
3126 {
3127 public:
3128     override void accept(ASTVisitor visitor) const
3129     {
3130         mixin (visitIfNotNull!(type, low, high, delegateOrFunction, parameters,
3131             memberFunctionAttributes));
3132     }
3133 
3134     /** */ Token delegateOrFunction;
3135     /** */ Token star;
3136     /** */ bool array;
3137     /** */ Type type;
3138     /** */ ExpressionNode low;
3139     /** */ ExpressionNode high;
3140     /** */ Parameters parameters;
3141     /** */ MemberFunctionAttribute[] memberFunctionAttributes;
3142     mixin OpEquals;
3143 }
3144 
3145 ///
3146 final class TypeidExpression : ExpressionNode
3147 {
3148 public:
3149     override void accept(ASTVisitor visitor) const
3150     {
3151         mixin (visitIfNotNull!(type, expression));
3152     }
3153     /** */ Type type;
3154     /** */ Expression expression;
3155     mixin OpEquals;
3156 }
3157 
3158 ///
3159 final class TypeofExpression : ExpressionNode
3160 {
3161 public:
3162     override void accept(ASTVisitor visitor) const
3163     {
3164         mixin (visitIfNotNull!(expression, return_));
3165     }
3166     /** */ Expression expression;
3167     /** */ Token return_;
3168     mixin OpEquals;
3169 }
3170 
3171 ///
3172 final class UnaryExpression : ExpressionNode
3173 {
3174 public:
3175     override void accept(ASTVisitor visitor) const
3176     {
3177         // TODO prefix, postfix, unary
3178         mixin (visitIfNotNull!(primaryExpression, newExpression, deleteExpression,
3179             castExpression, functionCallExpression, argumentList, unaryExpression,
3180             type, identifierOrTemplateInstance, assertExpression, indexExpression));
3181     }
3182 
3183     /** */ Type type;
3184     /** */ PrimaryExpression primaryExpression;
3185     /** */ Token prefix;
3186     /** */ Token suffix;
3187     /** */ UnaryExpression unaryExpression;
3188     /** */ NewExpression newExpression;
3189     /** */ DeleteExpression deleteExpression;
3190     /** */ CastExpression castExpression;
3191     /** */ FunctionCallExpression functionCallExpression;
3192     /** */ ArgumentList argumentList;
3193     /** */ IdentifierOrTemplateInstance identifierOrTemplateInstance;
3194     /** */ AssertExpression assertExpression;
3195     /** */ IndexExpression indexExpression;
3196     mixin OpEquals;
3197 }
3198 
3199 ///
3200 final class UnionDeclaration : ASTNode
3201 {
3202 public:
3203     override void accept(ASTVisitor visitor) const
3204     {
3205         mixin (visitIfNotNull!(name, templateParameters, constraint, structBody));
3206     }
3207 
3208     /** */ Token name;
3209     /** */ TemplateParameters templateParameters;
3210     /** */ Constraint constraint;
3211     /** */ StructBody structBody;
3212     /** */ string comment;
3213     mixin OpEquals;
3214 }
3215 
3216 ///
3217 final class Unittest : ASTNode
3218 {
3219 public:
3220     override void accept(ASTVisitor visitor) const
3221     {
3222         mixin (visitIfNotNull!(blockStatement));
3223     }
3224     /** */ BlockStatement blockStatement;
3225     /** */ string comment;
3226     mixin OpEquals;
3227 }
3228 
3229 ///
3230 final class VariableDeclaration : ASTNode
3231 {
3232 public:
3233     override void accept(ASTVisitor visitor) const
3234     {
3235         mixin (visitIfNotNull!(storageClasses, type, declarators, autoDeclaration));
3236     }
3237     /** */ Type type;
3238     /** */ Declarator[] declarators;
3239     /** */ StorageClass[] storageClasses;
3240     /** */ AutoDeclaration autoDeclaration;
3241     /** */ string comment;
3242     mixin OpEquals;
3243 }
3244 
3245 ///
3246 final class Vector : ASTNode
3247 {
3248 public:
3249     override void accept(ASTVisitor visitor) const
3250     {
3251         mixin (visitIfNotNull!(type));
3252     }
3253     /** */ Type type;
3254     mixin OpEquals;
3255 }
3256 
3257 ///
3258 final class VersionCondition : ASTNode
3259 {
3260 public:
3261     override void accept(ASTVisitor visitor) const
3262     {
3263         mixin (visitIfNotNull!(token));
3264     }
3265     /** */ size_t versionIndex;
3266     /** */ Token token;
3267     mixin OpEquals;
3268 }
3269 
3270 ///
3271 final class VersionSpecification : ASTNode
3272 {
3273 public:
3274     override void accept(ASTVisitor visitor) const
3275     {
3276         mixin (visitIfNotNull!(token));
3277     }
3278     /** */ Token token;
3279     mixin OpEquals;
3280 }
3281 
3282 ///
3283 final class WhileStatement : ASTNode
3284 {
3285 public:
3286     override void accept(ASTVisitor visitor) const
3287     {
3288         mixin (visitIfNotNull!(expression, declarationOrStatement));
3289     }
3290 
3291     /** */ Expression expression;
3292     /** */ DeclarationOrStatement declarationOrStatement;
3293     /** */ size_t startIndex;
3294     mixin OpEquals;
3295 }
3296 
3297 ///
3298 final class WithStatement : ASTNode
3299 {
3300 public:
3301     override void accept(ASTVisitor visitor) const
3302     {
3303         mixin (visitIfNotNull!(expression, statementNoCaseNoDefault));
3304     }
3305 
3306     /** */ Expression expression;
3307     /** */ StatementNoCaseNoDefault statementNoCaseNoDefault;
3308     mixin OpEquals;
3309 }
3310 
3311 ///
3312 final class XorExpression : ExpressionNode
3313 {
3314 public:
3315     override void accept(ASTVisitor visitor) const
3316     {
3317         mixin (visitIfNotNull!(left, right));
3318     }
3319     mixin BinaryExpressionBody;
3320     mixin OpEquals;
3321 }