Mercurial > projects > dil
annotate trunk/src/Declarations.d @ 192:5c898f80b436
- Started implementation of parseDeclaration().
- Added classes FunctionDeclaration and FunctionBody.
- Implemented parseFunctionBody().
- Simplified parseDeclaratorSuffix().
author | aziz |
---|---|
date | Sun, 15 Jul 2007 18:04:03 +0000 |
parents | 3ce110cefbc5 |
children | b3604b237292 |
rev | line source |
---|---|
102 | 1 /++ |
2 Author: Aziz Köksal | |
3 License: GPL2 | |
4 +/ | |
5 module Declarations; | |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
6 import Expressions; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
7 import Types; |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
8 import Statements; |
148 | 9 import Token; |
102 | 10 |
11 class Declaration | |
12 { | |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
13 bool hasBody; |
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
14 this(bool hasBody) |
116 | 15 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
16 this.hasBody = hasBody; |
116 | 17 } |
102 | 18 } |
19 | |
129 | 20 class EmptyDeclaration : Declaration |
21 { | |
22 this() | |
23 { | |
24 super(false); | |
25 } | |
26 } | |
27 | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
28 alias string[] ModuleName; // Identifier(.Identifier)* |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
29 |
102 | 30 class ModuleDeclaration : Declaration |
31 { | |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
32 ModuleName moduleName; // module name sits at end of array |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
33 this(ModuleName moduleName) |
102 | 34 { |
116 | 35 super(false); |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
36 this.moduleName = moduleName; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
37 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
38 } |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
39 |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
40 class ImportDeclaration : Declaration |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
41 { |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
42 ModuleName[] moduleNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
43 string[] moduleAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
44 string[] bindNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
45 string[] bindAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
46 this(ModuleName[] moduleNames, string[] moduleAliases, string[] bindNames, string[] bindAliases) |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
47 { |
116 | 48 super(false); |
114
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
49 this.moduleNames = moduleNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
50 this.moduleAliases = moduleAliases; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
51 this.bindNames = bindNames; |
83bb5190c0fc
- Completed implementation of parseImportDeclaration().
aziz
parents:
113
diff
changeset
|
52 this.bindAliases = bindAliases; |
102 | 53 } |
54 } | |
55 | |
191
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
56 class AliasDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
57 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
58 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
59 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
60 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
61 super(false); |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
62 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
63 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
64 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
65 |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
66 class TypedefDeclaration : Declaration |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
67 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
68 Declaration decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
69 this(Declaration decl) |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
70 { |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
71 super(false); |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
72 this.decl = decl; |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
73 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
74 } |
3ce110cefbc5
- Added code for parsing AliasDeclaration and TypedefDeclaration.
aziz
parents:
161
diff
changeset
|
75 |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
76 class EnumDeclaration : Declaration |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
77 { |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
78 string name; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
79 Type baseType; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
80 string[] members; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
81 Expression[] values; |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
82 this(string name, Type baseType, string[] members, Expression[] values, bool hasBody) |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
83 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
84 super(hasBody); |
107
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
85 this.name = name; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
86 this.baseType = baseType; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
87 this.members = members; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
88 this.values = values; |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
89 } |
722c05bbd5eb
- Implemented parseEnumDeclaration() and added class EnumDeclaration.
aziz
parents:
102
diff
changeset
|
90 } |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
91 |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
92 class ClassDeclaration : Declaration |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
93 { |
112 | 94 string name; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
95 BaseClass[] bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
96 Declaration[] decls; |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
97 this(string name, BaseClass[] bases, Declaration[] decls, bool hasBody) |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
98 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
99 super(hasBody); |
112 | 100 this.name = name; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
101 this.bases = bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
102 this.decls = decls; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
103 } |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
104 } |
112 | 105 |
106 class InterfaceDeclaration : Declaration | |
107 { | |
108 string name; | |
109 BaseClass[] bases; | |
110 Declaration[] decls; | |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
111 this(string name, BaseClass[] bases, Declaration[] decls, bool hasBody) |
112 | 112 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
113 super(hasBody); |
112 | 114 this.name = name; |
115 this.bases = bases; | |
116 this.decls = decls; | |
117 } | |
118 } | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
119 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
120 class StructDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
121 { |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
122 string name; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
123 Declaration[] decls; |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
124 this(string name, Declaration[] decls, bool hasBody) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
125 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
126 super(hasBody); |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
127 this.name = name; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
128 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
129 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
130 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
131 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
132 class UnionDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
133 { |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
134 string name; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
135 Declaration[] decls; |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
136 this(string name, Declaration[] decls, bool hasBody) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
137 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
138 super(hasBody); |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
139 this.name = name; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
140 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
141 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
142 } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
143 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
144 class ConstructorDeclaration : Declaration |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
145 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
146 Parameters parameters; |
161 | 147 Statements statements; |
148 this(Parameters parameters, Statements statements) | |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
149 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
150 super(true); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
151 this.parameters = parameters; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
152 this.statements = statements; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
153 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
154 } |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
155 |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
156 class StaticConstructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
157 { |
161 | 158 Statements statements; |
159 this(Statements statements) | |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
160 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
161 super(true); |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
162 this.statements = statements; |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
163 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
164 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
165 |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
166 class DestructorDeclaration : Declaration |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
167 { |
161 | 168 Statements statements; |
169 this(Statements statements) | |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
170 { |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
171 super(true); |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
172 this.statements = statements; |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
173 } |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
174 } |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
175 |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
176 class StaticDestructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
177 { |
161 | 178 Statements statements; |
179 this(Statements statements) | |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
180 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
181 super(true); |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
182 this.statements = statements; |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
183 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
184 } |
120 | 185 |
192 | 186 class FunctionDeclaration : Declaration |
187 { | |
188 string funcName; | |
189 Type funcType; | |
190 TemplateParameter[] tparams; | |
191 FunctionBody funcBody; | |
192 this(string funcName, Type funcType, TemplateParameter[] tparams, FunctionBody funcBody) | |
193 { | |
194 super(hasBody); | |
195 this.funcName = funcName; | |
196 this.funcType = funcType; | |
197 this.funcBody = funcBody; | |
198 } | |
199 } | |
200 | |
120 | 201 class InvariantDeclaration : Declaration |
202 { | |
161 | 203 Statements statements; |
204 this(Statements statements) | |
120 | 205 { |
206 super(true); | |
207 this.statements = statements; | |
208 } | |
209 } | |
121 | 210 |
211 class UnittestDeclaration : Declaration | |
212 { | |
161 | 213 Statements statements; |
214 this(Statements statements) | |
121 | 215 { |
216 super(true); | |
217 this.statements = statements; | |
218 } | |
219 } | |
122 | 220 |
221 class DebugDeclaration : Declaration | |
222 { | |
223 int levelSpec; | |
224 string identSpec; | |
225 int levelCond; | |
226 string identCond; | |
227 Declaration[] decls, elseDecls; | |
228 | |
229 this(int levelSpec, string identSpec, int levelCond, string identCond, Declaration[] decls, Declaration[] elseDecls) | |
230 { | |
231 super(decls.length != 0); | |
232 this.levelSpec = levelSpec; | |
233 this.identSpec = identSpec; | |
234 this.levelCond = levelCond; | |
235 this.identCond = identCond; | |
236 this.decls = decls; | |
237 this.elseDecls = elseDecls; | |
238 } | |
239 } | |
123 | 240 |
241 class VersionDeclaration : Declaration | |
242 { | |
243 int levelSpec; | |
244 string identSpec; | |
245 int levelCond; | |
246 string identCond; | |
247 Declaration[] decls, elseDecls; | |
248 | |
249 this(int levelSpec, string identSpec, int levelCond, string identCond, Declaration[] decls, Declaration[] elseDecls) | |
250 { | |
251 super(decls.length != 0); | |
252 this.levelSpec = levelSpec; | |
253 this.identSpec = identSpec; | |
254 this.levelCond = levelCond; | |
255 this.identCond = identCond; | |
256 this.decls = decls; | |
257 this.elseDecls = elseDecls; | |
258 } | |
259 } | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
260 |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
261 class StaticIfDeclaration : Declaration |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
262 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
263 Expression condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
264 Declaration[] ifDecls, elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
265 this(Expression condition, Declaration[] ifDecls, Declaration[] elseDecls) |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
266 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
267 super(true); |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
268 this.condition = condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
269 this.ifDecls = ifDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
270 this.elseDecls = elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
271 } |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
272 } |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
273 |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
274 class StaticAssertDeclaration : Declaration |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
275 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
276 Expression condition, message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
277 this(Expression condition, Expression message) |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
278 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
279 super(true); |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
280 this.condition = condition; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
281 this.message = message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
282 } |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
283 } |
140 | 284 |
285 class TemplateDeclaration : Declaration | |
286 { | |
287 string templateName; | |
288 TemplateParameter[] templateParams; | |
289 Declaration[] decls; | |
290 this(string templateName, TemplateParameter[] templateParams, Declaration[] decls) | |
291 { | |
292 super(true); | |
293 this.templateName = templateName; | |
294 this.templateParams = templateParams; | |
295 this.decls = decls; | |
296 } | |
297 } | |
141 | 298 |
299 class NewDeclaration : Declaration | |
300 { | |
301 Parameters parameters; | |
302 Declaration[] decls; | |
303 this(Parameters parameters, Declaration[] decls) | |
304 { | |
305 super(true); | |
306 this.parameters = parameters; | |
307 this.decls = decls; | |
308 } | |
309 } | |
310 | |
311 class DeleteDeclaration : Declaration | |
312 { | |
313 Parameters parameters; | |
314 Declaration[] decls; | |
315 this(Parameters parameters, Declaration[] decls) | |
316 { | |
317 super(true); | |
318 this.parameters = parameters; | |
319 this.decls = decls; | |
320 } | |
321 } | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
322 |
149 | 323 class AttributeDeclaration : Declaration |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
324 { |
149 | 325 TOK attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
326 Declaration[] decls; |
149 | 327 this(TOK attribute, Declaration[] decls) |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
328 { |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
329 super(true); |
149 | 330 this.attribute = attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
331 this.decls = decls; |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
332 } |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
333 } |
147 | 334 |
149 | 335 class ExternDeclaration : AttributeDeclaration |
336 { | |
159 | 337 Linkage linkage; |
338 this(Linkage linkage, Declaration[] decls) | |
149 | 339 { |
340 super(TOK.Extern, decls); | |
341 this.linkage = linkage; | |
342 } | |
343 } | |
344 | |
345 class AlignDeclaration : AttributeDeclaration | |
346 { | |
347 int size; | |
348 this(int size, Declaration[] decls) | |
349 { | |
350 super(TOK.Align, decls); | |
351 this.size = size; | |
352 } | |
353 } | |
354 | |
355 class PragmaDeclaration : AttributeDeclaration | |
147 | 356 { |
357 string ident; | |
358 Expression[] args; | |
359 this(string ident, Expression[] args, Declaration[] decls) | |
360 { | |
149 | 361 super(TOK.Pragma, decls); |
147 | 362 this.ident = ident; |
363 this.args = args; | |
364 } | |
365 } | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
366 |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
367 class MixinDeclaration : Declaration |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
368 { |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
369 Expression[] templateIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
370 string mixinIdent; |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
371 Expression assignExpr; // mixin ( AssignExpression ) |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
372 this(Expression[] templateIdent, string mixinIdent) |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
373 { |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
374 super(false); |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
375 this.templateIdent = templateIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
376 this.mixinIdent = mixinIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
377 } |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
378 this(Expression assignExpr) |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
379 { |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
380 super(false); |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
381 this.assignExpr = assignExpr; |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
382 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
383 } |