Mercurial > projects > dil
annotate trunk/src/dil/Declarations.d @ 494:9a7ca8c56e59
Refactored a few things in the Parser.
Removed unnecessary 'bool hasBody' parameter from some declarations.
Added shebang to list of tokens in Lexer unittest.
Added some semantic methods.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 07 Dec 2007 18:22:35 +0100 |
parents | 9c208925a3d4 |
children | b60450804b6e |
rev | line source |
---|---|
102 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
102 | 4 +/ |
326 | 5 module dil.Declarations; |
327 | 6 import dil.SyntaxTree; |
7 import dil.Expressions; | |
8 import dil.Types; | |
9 import dil.Statements; | |
10 import dil.Token; | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
11 import dil.Enums; |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
12 import dil.Scope; |
102 | 13 |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
14 abstract class Declaration : Node |
102 | 15 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
16 bool hasBody; |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
17 this() |
116 | 18 { |
275 | 19 super(NodeCategory.Declaration); |
116 | 20 } |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
21 |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
22 // Members relevant to semantic phase. |
490
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
23 StorageClass stc; /// The storage class of this declaration. |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
24 Protection prot; /// The protection attribute of this declaration. |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
25 |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
26 void semantic(Scope sc) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
27 { |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
28 // foreach (node; this.children) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
29 // if (node.category == NodeCategory.Declaration) |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
30 // (cast(Declaration)cast(void*)node).semantic(sc); |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
31 } |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
32 |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
33 final bool isStatic() |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
34 { |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
35 return !!(stc & StorageClass.Static); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
36 } |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
37 |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
38 final bool isPublic() |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
39 { |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
40 return !!(prot & Protection.Public); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
41 } |
102 | 42 } |
43 | |
305 | 44 class Declarations : Declaration |
45 { | |
46 this() | |
47 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
48 hasBody = true; |
305 | 49 mixin(set_kind); |
50 } | |
51 | |
52 void opCatAssign(Declaration d) | |
53 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
54 addChild(d); |
486
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
55 } |
bd176bc73e43
Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
461
diff
changeset
|
56 |
305 | 57 void opCatAssign(Declarations ds) |
58 { | |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
59 addChildren(ds.children); |
305 | 60 } |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
61 |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
62 void semantic(Scope scop) |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
63 { |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
64 foreach (node; this.children) |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
65 { |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
66 assert(node.category == NodeCategory.Declaration); |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
67 (cast(Declaration)cast(void*)node).semantic(scop); |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
68 } |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
69 } |
305 | 70 } |
71 | |
129 | 72 class EmptyDeclaration : Declaration |
73 { | |
74 this() | |
75 { | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
76 mixin(set_kind); |
129 | 77 } |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
78 |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
79 void semantic(Scope) |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
80 {} |
129 | 81 } |
82 | |
211 | 83 class IllegalDeclaration : Declaration |
84 { | |
292 | 85 Token* token; |
86 this(Token* token) | |
211 | 87 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
88 mixin(set_kind); |
292 | 89 this.token = token; |
211 | 90 } |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
91 |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
92 void semantic(Scope) |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
93 {} |
211 | 94 } |
95 | |
364 | 96 /// FQN = fully qualified name |
97 alias Token*[] ModuleFQN; // Identifier(.Identifier)* | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
98 |
102 | 99 class ModuleDeclaration : Declaration |
100 { | |
364 | 101 Token* moduleName; |
102 Token*[] packages; | |
103 this(ModuleFQN moduleFQN) | |
102 | 104 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
105 mixin(set_kind); |
365 | 106 assert(moduleFQN.length != 0); |
107 this.moduleName = moduleFQN[$-1]; | |
108 this.packages = moduleFQN[0..$-1]; | |
109 } | |
110 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
111 char[] getFQN() |
370 | 112 { |
113 auto pname = getPackageName('.'); | |
114 if (pname.length) | |
115 return pname ~ "." ~ getName(); | |
116 else | |
117 return getName(); | |
118 } | |
119 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
120 char[] getName() |
365 | 121 { |
122 if (moduleName) | |
123 return moduleName.identifier; | |
124 return null; | |
125 } | |
126 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
127 char[] getPackageName(char separator) |
365 | 128 { |
129 char[] pname; | |
130 foreach (pckg; packages) | |
131 if (pckg) | |
132 pname ~= pckg.identifier ~ separator; | |
367
dda55fae37de
- ImportGraph.execute() can parse all modules depending on the imports of the root module.
aziz
parents:
366
diff
changeset
|
133 if (pname.length) |
dda55fae37de
- ImportGraph.execute() can parse all modules depending on the imports of the root module.
aziz
parents:
366
diff
changeset
|
134 pname = pname[0..$-1]; // Remove last separator |
365 | 135 return pname; |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
136 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
137 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
138 |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
139 class ImportDeclaration : Declaration |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
140 { |
364 | 141 ModuleFQN[] moduleFQNs; |
263 | 142 Token*[] moduleAliases; |
143 Token*[] bindNames; | |
144 Token*[] bindAliases; | |
461
c78a54b2617c
Added isStatic() and isPublic() to ImportDeclaration.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
406
diff
changeset
|
145 |
366 | 146 this(ModuleFQN[] moduleFQNs, Token*[] moduleAliases, Token*[] bindNames, Token*[] bindAliases, bool isStatic) |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
147 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
148 mixin(set_kind); |
364 | 149 this.moduleFQNs = moduleFQNs; |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
150 this.moduleAliases = moduleAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
151 this.bindNames = bindNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
152 this.bindAliases = bindAliases; |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
153 if (isStatic) |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
154 this.stc |= StorageClass.Static; |
366 | 155 } |
156 | |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
157 char[][] getModuleFQNs(char separator) |
366 | 158 { |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
159 char[][] FQNs; |
366 | 160 foreach (moduleFQN; moduleFQNs) |
161 { | |
162 char[] FQN; | |
163 foreach (ident; moduleFQN) | |
164 if (ident) | |
165 FQN ~= ident.identifier ~ separator; | |
166 FQNs ~= FQN[0..$-1]; // Remove last separator | |
167 } | |
168 return FQNs; | |
102 | 169 } |
170 } | |
171 | |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
172 class AliasDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
173 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
174 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
175 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
176 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
177 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
178 addChild(decl); |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
179 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
180 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
181 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
182 |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
183 class TypedefDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
184 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
185 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
186 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
187 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
188 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
189 addChild(decl); |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
190 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
191 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
192 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
193 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
194 class EnumDeclaration : Declaration |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
195 { |
264 | 196 Token* name; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
197 Type baseType; |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
198 EnumMember[] members; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
199 this(Token* name, Type baseType, EnumMember[] members, bool hasBody) |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
200 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
201 super.hasBody = hasBody; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
202 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
203 addOptChild(baseType); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
204 addOptChildren(members); |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
205 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
206 this.name = name; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
207 this.baseType = baseType; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
208 this.members = members; |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
209 } |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
210 } |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
211 |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
212 class EnumMember : Node |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
213 { |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
214 Token* name; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
215 Expression value; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
216 this(Token* name, Expression value) |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
217 { |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
218 super(NodeCategory.Other); |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
219 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
220 addOptChild(value); |
406
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
221 |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
222 this.name = name; |
e242f0ee2d27
Added class EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
223 this.value = value; |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
224 } |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
225 } |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
226 |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
227 class ClassDeclaration : Declaration |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
228 { |
264 | 229 Token* name; |
258 | 230 TemplateParameters tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
231 BaseClass[] bases; |
305 | 232 Declarations decls; |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
233 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls) |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
234 { |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
235 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
236 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
237 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
238 addOptChildren(bases); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
239 addOptChild(decls); |
305 | 240 |
112 | 241 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
242 this.tparams = tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
243 this.bases = bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
244 this.decls = decls; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
245 } |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
246 } |
112 | 247 |
248 class InterfaceDeclaration : Declaration | |
249 { | |
264 | 250 Token* name; |
258 | 251 TemplateParameters tparams; |
112 | 252 BaseClass[] bases; |
305 | 253 Declarations decls; |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
254 this(Token* name, TemplateParameters tparams, BaseClass[] bases, Declarations decls) |
112 | 255 { |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
256 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
257 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
258 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
259 addOptChildren(bases); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
260 addOptChild(decls); |
305 | 261 |
112 | 262 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
263 this.tparams = tparams; |
112 | 264 this.bases = bases; |
265 this.decls = decls; | |
266 } | |
267 } | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
268 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
269 class StructDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
270 { |
264 | 271 Token* name; |
258 | 272 TemplateParameters tparams; |
305 | 273 Declarations decls; |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
274 this(Token* name, TemplateParameters tparams, Declarations decls) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
275 { |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
276 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
277 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
278 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
279 addOptChild(decls); |
305 | 280 |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
281 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
282 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
283 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
284 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
285 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
286 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
287 class UnionDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
288 { |
264 | 289 Token* name; |
258 | 290 TemplateParameters tparams; |
305 | 291 Declarations decls; |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
292 this(Token* name, TemplateParameters tparams, Declarations decls) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
293 { |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
294 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
295 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
296 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
297 addOptChild(decls); |
305 | 298 |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
299 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
300 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
301 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
302 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
303 } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
304 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
305 class ConstructorDeclaration : Declaration |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
306 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
307 Parameters parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
308 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
309 this(Parameters parameters, FunctionBody funcBody) |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
310 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
311 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
312 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
313 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
314 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
315 |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
316 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
317 this.funcBody = funcBody; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
318 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
319 } |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
320 |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
321 class StaticConstructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
322 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
323 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
324 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
325 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
326 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
327 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
328 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
329 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
330 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
331 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
332 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
333 |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
334 class DestructorDeclaration : Declaration |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
335 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
336 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
337 this(FunctionBody funcBody) |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
338 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
339 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
340 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
341 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
342 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
343 this.funcBody = funcBody; |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
344 } |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
345 } |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
346 |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
347 class StaticDestructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
348 { |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
349 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
350 this(FunctionBody funcBody) |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
351 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
352 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
353 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
354 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
355 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
356 this.funcBody = funcBody; |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
357 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
358 } |
120 | 359 |
192 | 360 class FunctionDeclaration : Declaration |
361 { | |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
362 Type returnType; |
262 | 363 Token* funcName; |
258 | 364 TemplateParameters tparams; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
365 Parameters params; |
192 | 366 FunctionBody funcBody; |
492
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
367 this(Type returnType, Token* funcName, TemplateParameters tparams, |
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
368 Parameters params, FunctionBody funcBody, StorageClass stc) |
192 | 369 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
370 super.hasBody = funcBody.funcBody !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
371 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
372 addChild(returnType); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
373 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
374 addChild(params); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
375 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
376 |
492
9c208925a3d4
Added module ImportParser and new stuff from DMD2.008.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
377 this.stc = stc; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
378 this.returnType = returnType; |
192 | 379 this.funcName = funcName; |
290
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
380 this.tparams = tparams; |
7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
aziz
parents:
283
diff
changeset
|
381 this.params = params; |
192 | 382 this.funcBody = funcBody; |
383 } | |
384 } | |
385 | |
194 | 386 class VariableDeclaration : Declaration |
387 { | |
283 | 388 Type type; |
262 | 389 Token*[] idents; |
194 | 390 Expression[] values; |
283 | 391 this(Type type, Token*[] idents, Expression[] values) |
194 | 392 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
393 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
394 addOptChild(type); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
292
diff
changeset
|
395 foreach(value; values) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
396 addOptChild(value); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
397 |
283 | 398 this.type = type; |
194 | 399 this.idents = idents; |
400 this.values = values; | |
401 } | |
402 } | |
403 | |
120 | 404 class InvariantDeclaration : Declaration |
405 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
406 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
407 this(FunctionBody funcBody) |
120 | 408 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
409 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
410 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
411 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
412 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
413 this.funcBody = funcBody; |
120 | 414 } |
415 } | |
121 | 416 |
417 class UnittestDeclaration : Declaration | |
418 { | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
419 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
420 this(FunctionBody funcBody) |
121 | 421 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
422 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
423 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
424 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
425 |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
426 this.funcBody = funcBody; |
121 | 427 } |
428 } | |
122 | 429 |
430 class DebugDeclaration : Declaration | |
431 { | |
264 | 432 Token* spec; |
433 Token* cond; | |
305 | 434 Declaration decls, elseDecls; |
122 | 435 |
305 | 436 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
122 | 437 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
438 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
439 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
440 addOptChild(decls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
441 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
442 |
264 | 443 this.spec = spec; |
444 this.cond = cond; | |
122 | 445 this.decls = decls; |
446 this.elseDecls = elseDecls; | |
447 } | |
448 } | |
123 | 449 |
450 class VersionDeclaration : Declaration | |
451 { | |
264 | 452 Token* spec; |
453 Token* cond; | |
305 | 454 Declaration decls, elseDecls; |
123 | 455 |
305 | 456 this(Token* spec, Token* cond, Declaration decls, Declaration elseDecls) |
123 | 457 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
458 super.hasBody = decls !is null; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
459 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
460 addOptChild(decls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
461 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
462 |
264 | 463 this.spec = spec; |
464 this.cond = cond; | |
123 | 465 this.decls = decls; |
466 this.elseDecls = elseDecls; | |
467 } | |
468 } | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
469 |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
470 class StaticIfDeclaration : Declaration |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
471 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
472 Expression condition; |
305 | 473 Declaration ifDecls, elseDecls; |
474 this(Expression condition, Declaration ifDecls, Declaration elseDecls) | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
475 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
476 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
477 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
478 addChild(condition); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
479 addOptChild(ifDecls); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
480 addOptChild(elseDecls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
481 |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
482 this.condition = condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
483 this.ifDecls = ifDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
484 this.elseDecls = elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
485 } |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
486 } |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
487 |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
488 class StaticAssertDeclaration : Declaration |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
489 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
490 Expression condition, message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
491 this(Expression condition, Expression message) |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
492 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
493 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
494 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
495 addChild(condition); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
496 addOptChild(message); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
497 |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
498 this.condition = condition; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
499 this.message = message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
500 } |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
501 } |
140 | 502 |
503 class TemplateDeclaration : Declaration | |
504 { | |
292 | 505 Token* name; |
506 TemplateParameters tparams; | |
305 | 507 Declarations decls; |
508 this(Token* name, TemplateParameters tparams, Declarations decls) | |
140 | 509 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
510 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
511 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
512 addOptChild(tparams); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
513 addChild(decls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
514 |
292 | 515 this.name = name; |
516 this.tparams = tparams; | |
140 | 517 this.decls = decls; |
518 } | |
519 } | |
141 | 520 |
521 class NewDeclaration : Declaration | |
522 { | |
523 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
524 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
525 this(Parameters parameters, FunctionBody funcBody) |
141 | 526 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
527 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
528 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
529 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
530 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
531 |
141 | 532 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
533 this.funcBody = funcBody; |
141 | 534 } |
535 } | |
536 | |
537 class DeleteDeclaration : Declaration | |
538 { | |
539 Parameters parameters; | |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
540 FunctionBody funcBody; |
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
541 this(Parameters parameters, FunctionBody funcBody) |
141 | 542 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
543 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
544 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
545 addChild(parameters); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
546 addChild(funcBody); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
547 |
141 | 548 this.parameters = parameters; |
197
ff32eb87300e
- Using parseFunctionBody() for Constructor-,Destructor-,StaticConstructor-,StaticDestructor-,Invariant-,Unittest-,New- and DeleteDeclaration.
aziz
parents:
195
diff
changeset
|
549 this.funcBody = funcBody; |
141 | 550 } |
551 } | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
552 |
149 | 553 class AttributeDeclaration : Declaration |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
554 { |
149 | 555 TOK attribute; |
305 | 556 Declaration decls; |
557 this(TOK attribute, Declaration decls) | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
558 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
559 super.hasBody = true; |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
560 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
561 addChild(decls); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
562 |
149 | 563 this.attribute = attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
564 this.decls = decls; |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
565 } |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
566 } |
147 | 567 |
490
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
568 class ProtectionDeclaration : AttributeDeclaration |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
569 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
570 this(Protection prot, Declaration decls) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
571 { |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
572 super(cast(TOK)0, decls); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
573 mixin(set_kind); |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
574 super.prot = prot; |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
575 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
576 |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
577 void semantic(Scope scop) |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
578 { |
494
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
579 // auto saved_prot = scop.protection; |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
580 // scop.protection = this.prot; |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
581 // decls.semantic(scop); |
9a7ca8c56e59
Refactored a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
492
diff
changeset
|
582 // scop.protection = saved_prot; |
490
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
583 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
584 } |
47be6bfe39cd
Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
489
diff
changeset
|
585 |
149 | 586 class ExternDeclaration : AttributeDeclaration |
587 { | |
159 | 588 Linkage linkage; |
305 | 589 this(Linkage linkage, Declaration decls) |
149 | 590 { |
591 super(TOK.Extern, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
592 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
593 addOptChild(linkage); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
594 |
149 | 595 this.linkage = linkage; |
596 } | |
597 } | |
598 | |
599 class AlignDeclaration : AttributeDeclaration | |
600 { | |
601 int size; | |
305 | 602 this(int size, Declaration decls) |
149 | 603 { |
604 super(TOK.Align, decls); | |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
605 mixin(set_kind); |
149 | 606 this.size = size; |
607 } | |
608 } | |
609 | |
610 class PragmaDeclaration : AttributeDeclaration | |
147 | 611 { |
245 | 612 Token* ident; |
147 | 613 Expression[] args; |
305 | 614 this(Token* ident, Expression[] args, Declaration decls) |
147 | 615 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
616 addOptChildren(args); // Add args before calling super(). |
149 | 617 super(TOK.Pragma, decls); |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
618 mixin(set_kind); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
619 |
147 | 620 this.ident = ident; |
621 this.args = args; | |
622 } | |
623 } | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
624 |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
625 class MixinDeclaration : Declaration |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
626 { |
292 | 627 Expression[] templateIdents; |
252
788398655d24
- Changed some string types to Token*. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
628 Token* mixinIdent; |
292 | 629 Expression argument; // mixin ( AssignExpression ) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
630 |
292 | 631 this(Expression[] templateIdents, Token* mixinIdent) |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
632 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
633 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
634 addChildren(templateIdents); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
635 |
292 | 636 this.templateIdents = templateIdents; |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
637 this.mixinIdent = mixinIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
638 } |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
639 |
292 | 640 this(Expression argument) |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
641 { |
277
38a68e534a3b
- Made classes Declaration, Expression and Statement abstract.
aziz
parents:
275
diff
changeset
|
642 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
643 addChild(argument); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
486
diff
changeset
|
644 |
292 | 645 this.argument = argument; |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
646 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
647 } |