annotate trunk/src/dil/SyntaxTree.d @ 374:6d22f0b6a674

- Added class AsmAlignStatement. - Added code and made several fixes to asm statements parsing methods.
author aziz
date Fri, 07 Sep 2007 11:36:01 +0000
parents 511c14950cac
children 33b566df6af4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
1 /++
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
2 Author: Aziz Köksal
249
32d354584b28 - Upgraded license notices to GPL3.
aziz
parents: 242
diff changeset
3 License: GPL3
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
4 +/
326
4a7359b88c11 - Added package 'dil' to module declarations.
aziz
parents: 325
diff changeset
5 module dil.SyntaxTree;
327
a48a987f7515 - Added package dil to import declarations.
aziz
parents: 326
diff changeset
6 import dil.Token;
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
7
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 249
diff changeset
8 enum NodeCategory
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
9 {
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
10 Declaration,
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
11 Statement,
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
12 Expression,
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 189
diff changeset
13 Type,
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 189
diff changeset
14 Other
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
15 }
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
16
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
17 enum NodeKind
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
18 {
278
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
19 // Declarations:
305
df237b3b5f09 - Added class Declarations.
aziz
parents: 292
diff changeset
20 Declarations,
278
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
21 EmptyDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
22 IllegalDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
23 ModuleDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
24 ImportDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
25 AliasDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
26 TypedefDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
27 EnumDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
28 ClassDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
29 InterfaceDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
30 StructDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
31 UnionDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
32 ConstructorDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
33 StaticConstructorDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
34 DestructorDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
35 StaticDestructorDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
36 FunctionDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
37 VariableDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
38 InvariantDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
39 UnittestDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
40 DebugDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
41 VersionDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
42 StaticIfDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
43 StaticAssertDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
44 TemplateDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
45 NewDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
46 DeleteDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
47 AttributeDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
48 ExternDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
49 AlignDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
50 PragmaDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
51 MixinDeclaration,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
52
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
53 // Statements:
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
54 Statements,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
55 IllegalStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
56 EmptyStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
57 ScopeStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
58 LabeledStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
59 ExpressionStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
60 DeclarationStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
61 IfStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
62 ConditionalStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
63 WhileStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
64 DoWhileStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
65 ForStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
66 ForeachStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
67 ForeachRangeStatement, // D2.0
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
68 SwitchStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
69 CaseStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
70 DefaultStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
71 ContinueStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
72 BreakStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
73 ReturnStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
74 GotoStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
75 WithStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
76 SynchronizedStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
77 TryStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
78 CatchBody,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
79 FinallyBody,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
80 ScopeGuardStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
81 ThrowStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
82 VolatileStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
83 AsmStatement,
285
104343e0f097 - Started implementation of asm statements parser.
aziz
parents: 281
diff changeset
84 AsmInstruction,
374
6d22f0b6a674 - Added class AsmAlignStatement.
aziz
parents: 359
diff changeset
85 AsmAlignStatement,
285
104343e0f097 - Started implementation of asm statements parser.
aziz
parents: 281
diff changeset
86 IllegalAsmInstruction,
278
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
87 PragmaStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
88 MixinStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
89 StaticIfStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
90 StaticAssertStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
91 DebugStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
92 VersionStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
93 AttributeStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
94 ExternStatement,
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
95
277
38a68e534a3b - Made classes Declaration, Expression and Statement abstract.
aziz
parents: 276
diff changeset
96 // Expressions:
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
97 EmptyExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
98 BinaryExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
99 CondExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
100 CommaExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
101 OrOrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
102 AndAndExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
103 OrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
104 XorExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
105 AndExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
106 CmpExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
107 EqualExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
108 IdentityExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
109 RelExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
110 InExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
111 LShiftExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
112 RShiftExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
113 URShiftExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
114 PlusExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
115 MinusExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
116 CatExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
117 MulExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
118 DivExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
119 ModExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
120 AssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
121 LShiftAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
122 RShiftAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
123 URShiftAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
124 OrAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
125 AndAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
126 PlusAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
127 MinusAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
128 DivAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
129 MulAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
130 ModAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
131 XorAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
132 CatAssignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
133 UnaryExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
134 AddressExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
135 PreIncrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
136 PreDecrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
137 PostIncrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
138 PostDecrExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
139 DerefExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
140 SignExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
141 NotExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
142 CompExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
143 PostDotListExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
144 CallExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
145 NewExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
146 NewAnonClassExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
147 DeleteExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
148 CastExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
149 IndexExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
150 SliceExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
151 PrimaryExpressio,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
152 IdentifierExpression,
312
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
153 SpecialTokenExpression,
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
154 DotListExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
155 TemplateInstanceExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
156 ThisExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
157 SuperExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
158 NullExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
159 DollarExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
160 BoolExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
161 IntNumberExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
162 RealNumberExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
163 CharLiteralExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
164 StringLiteralsExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
165 ArrayLiteralExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
166 AssocArrayLiteralExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
167 AssertExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
168 MixinExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
169 ImportExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
170 TypeofExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
171 TypeDotIdExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
172 TypeidExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
173 IsExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
174 FunctionLiteralExpression,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
175 TraitsExpression, // D2.0
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
176 VoidInitializer,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
177 ArrayInitializer,
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
178 StructInitializer,
287
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 285
diff changeset
179 AsmTypeExpression,
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 285
diff changeset
180 AsmOffsetExpression,
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 285
diff changeset
181 AsmSegExpression,
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 285
diff changeset
182 AsmPostBracketExpression,
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 285
diff changeset
183 AsmBracketExpression,
288
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
184 AsmLocalSizeExpression,
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
185 AsmRegisterExpression,
277
38a68e534a3b - Made classes Declaration, Expression and Statement abstract.
aziz
parents: 276
diff changeset
186
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
187 // Types:
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
188 IntegralType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
189 UndefinedType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
190 DotListType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
191 IdentifierType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
192 TypeofType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
193 TemplateInstanceType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
194 PointerType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
195 ArrayType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
196 FunctionType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
197 DelegateType,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
198 ConstType, // D2.0
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
199 InvariantType, // D2.0
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
200
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
201 // Other:
278
e5a6b56c7716 - Moved declarations in enum NodeKind to the top.
aziz
parents: 277
diff changeset
202 FunctionBody,
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
203 Parameter,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
204 Parameters,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
205 BaseClass,
340
1accb3013bd2 - Changed class TemplateParameter to an abstract class.
aziz
parents: 327
diff changeset
206 TemplateAliasParameter,
1accb3013bd2 - Changed class TemplateParameter to an abstract class.
aziz
parents: 327
diff changeset
207 TemplateTypeParameter,
1accb3013bd2 - Changed class TemplateParameter to an abstract class.
aziz
parents: 327
diff changeset
208 TemplateValueParameter,
1accb3013bd2 - Changed class TemplateParameter to an abstract class.
aziz
parents: 327
diff changeset
209 TemplateTupleParameter,
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
210 TemplateParameters,
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
211 TemplateArguments,
359
511c14950cac - Added messages MissingLinkageType and UnrecognizedLinkageType.
aziz
parents: 340
diff changeset
212 Linkage,
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
213 }
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
214
281
c1fcfbce9499 - BaseClass inherits from Node now.
aziz
parents: 278
diff changeset
215 /// This string is mixed into the constructor of a class that inherits from Node.
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
216 const string set_kind = `this.kind = mixin("NodeKind." ~ typeof(this).stringof);`;
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
217
309
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
218 Class Cast(Class)(Node n)
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
219 {
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
220 assert(n !is null);
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
221 if (n.kind == mixin("NodeKind." ~ typeof(Class).stringof))
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
222 return cast(Class)cast(void*)n;
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
223 return null;
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
224 }
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
225
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
226 class Node
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
227 {
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 249
diff changeset
228 NodeCategory category;
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
229 NodeKind kind;
292
076152e945e0 - Added member Node[] children to class Node.
aziz
parents: 288
diff changeset
230 Node[] children;
189
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
231 Token* begin, end;
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
232
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 249
diff changeset
233 this(NodeCategory category)
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
234 {
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 249
diff changeset
235 this.category = category;
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
236 }
189
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
237
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
238 void setTokens(Token* begin, Token* end)
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
239 {
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
240 this.begin = begin;
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
241 this.end = end;
b1060d432e5e - Added some members to class Node.
aziz
parents: 142
diff changeset
242 }
142
50251b408965 - Added module SyntaxTree.
aziz
parents:
diff changeset
243 }