Mercurial > projects > dil
annotate trunk/src/Declarations.d @ 195:37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
author | aziz |
---|---|
date | Sun, 15 Jul 2007 19:00:05 +0000 |
parents | b3604b237292 |
children | ff32eb87300e |
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; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
95 TemplateParameter[] tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
96 BaseClass[] bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
97 Declaration[] decls; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
98 this(string name, TemplateParameter[] tparams, BaseClass[] bases, Declaration[] decls, bool hasBody) |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
99 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
100 super(hasBody); |
112 | 101 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
102 this.tparams = tparams; |
109
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
103 this.bases = bases; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
104 this.decls = decls; |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
105 } |
d0cc281cacbd
- Added methods parseClassDeclaration() and parseBaseClasses().
aziz
parents:
107
diff
changeset
|
106 } |
112 | 107 |
108 class InterfaceDeclaration : Declaration | |
109 { | |
110 string name; | |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
111 TemplateParameter[] tparams; |
112 | 112 BaseClass[] bases; |
113 Declaration[] decls; | |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
114 this(string name, TemplateParameter[] tparams, BaseClass[] bases, Declaration[] decls, bool hasBody) |
112 | 115 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
116 super(hasBody); |
112 | 117 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
118 this.tparams = tparams; |
112 | 119 this.bases = bases; |
120 this.decls = decls; | |
121 } | |
122 } | |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
123 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
124 class StructDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
125 { |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
126 string name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
127 TemplateParameter[] tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
128 Declaration[] decls; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
129 this(string name, TemplateParameter[] tparams, Declaration[] decls, bool hasBody) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
130 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
131 super(hasBody); |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
132 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
133 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
134 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
135 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
136 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
137 |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
138 class UnionDeclaration : Declaration |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
139 { |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
140 string name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
141 TemplateParameter[] tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
142 Declaration[] decls; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
143 this(string name, TemplateParameter[] tparams, Declaration[] decls, bool hasBody) |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
144 { |
126
0f0e7352e91d
- Renamed member hasDefinition of class Declaration to hasBody.
aziz
parents:
125
diff
changeset
|
145 super(hasBody); |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
146 this.name = name; |
195
37c2ffd649c4
- Parsing template parameter list for class, interface, struct and union declarations.
aziz
parents:
194
diff
changeset
|
147 this.tparams = tparams; |
113
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
148 this.decls = decls; |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
149 } |
20d8ae8a3fd9
- Implemented parseAggregateDeclaration for Struct- and UnionDeclarations.
aziz
parents:
112
diff
changeset
|
150 } |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
151 |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
152 class ConstructorDeclaration : Declaration |
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 Parameters parameters; |
161 | 155 Statements statements; |
156 this(Parameters parameters, Statements statements) | |
117
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
157 { |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
158 super(true); |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
159 this.parameters = parameters; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
160 this.statements = statements; |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
161 } |
79857de26e86
- Moved class Parameter to module Types. Added struct Parameters.
aziz
parents:
116
diff
changeset
|
162 } |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
163 |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
164 class StaticConstructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
165 { |
161 | 166 Statements statements; |
167 this(Statements statements) | |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
168 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
169 super(true); |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
170 this.statements = statements; |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
171 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
172 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
173 |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
174 class DestructorDeclaration : Declaration |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
175 { |
161 | 176 Statements statements; |
177 this(Statements statements) | |
118
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
178 { |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
179 super(true); |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
180 this.statements = statements; |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
181 } |
379f33cbd521
- Added parseDestructorDeclaration() and DestructorDeclaration class.
aziz
parents:
117
diff
changeset
|
182 } |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
183 |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
184 class StaticDestructorDeclaration : Declaration |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
185 { |
161 | 186 Statements statements; |
187 this(Statements statements) | |
119
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
188 { |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
189 super(true); |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
190 this.statements = statements; |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
191 } |
363cd39022f9
- Added parseStaticConstructor- and DestructorDeclaration().
aziz
parents:
118
diff
changeset
|
192 } |
120 | 193 |
192 | 194 class FunctionDeclaration : Declaration |
195 { | |
196 string funcName; | |
197 Type funcType; | |
198 TemplateParameter[] tparams; | |
199 FunctionBody funcBody; | |
200 this(string funcName, Type funcType, TemplateParameter[] tparams, FunctionBody funcBody) | |
201 { | |
194 | 202 super(funcBody.funcBody !is null); |
192 | 203 this.funcName = funcName; |
204 this.funcType = funcType; | |
205 this.funcBody = funcBody; | |
206 } | |
207 } | |
208 | |
194 | 209 class VariableDeclaration : Declaration |
210 { | |
211 string[] idents; | |
212 Expression[] values; | |
213 this(string[] idents, Expression[] values) | |
214 { | |
215 super(false); | |
216 this.idents = idents; | |
217 this.values = values; | |
218 } | |
219 } | |
220 | |
120 | 221 class InvariantDeclaration : Declaration |
222 { | |
161 | 223 Statements statements; |
224 this(Statements statements) | |
120 | 225 { |
226 super(true); | |
227 this.statements = statements; | |
228 } | |
229 } | |
121 | 230 |
231 class UnittestDeclaration : Declaration | |
232 { | |
161 | 233 Statements statements; |
234 this(Statements statements) | |
121 | 235 { |
236 super(true); | |
237 this.statements = statements; | |
238 } | |
239 } | |
122 | 240 |
241 class DebugDeclaration : 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 } | |
123 | 260 |
261 class VersionDeclaration : Declaration | |
262 { | |
263 int levelSpec; | |
264 string identSpec; | |
265 int levelCond; | |
266 string identCond; | |
267 Declaration[] decls, elseDecls; | |
268 | |
269 this(int levelSpec, string identSpec, int levelCond, string identCond, Declaration[] decls, Declaration[] elseDecls) | |
270 { | |
271 super(decls.length != 0); | |
272 this.levelSpec = levelSpec; | |
273 this.identSpec = identSpec; | |
274 this.levelCond = levelCond; | |
275 this.identCond = identCond; | |
276 this.decls = decls; | |
277 this.elseDecls = elseDecls; | |
278 } | |
279 } | |
125
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
280 |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
281 class StaticIfDeclaration : Declaration |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
282 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
283 Expression condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
284 Declaration[] ifDecls, elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
285 this(Expression condition, Declaration[] ifDecls, Declaration[] elseDecls) |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
286 { |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
287 super(true); |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
288 this.condition = condition; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
289 this.ifDecls = ifDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
290 this.elseDecls = elseDecls; |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
291 } |
240a8b053803
- Added method parseStaticIfDeclaration and added class StaticIfDeclaration.
aziz
parents:
123
diff
changeset
|
292 } |
127
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
293 |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
294 class StaticAssertDeclaration : Declaration |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
295 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
296 Expression condition, message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
297 this(Expression condition, Expression message) |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
298 { |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
299 super(true); |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
300 this.condition = condition; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
301 this.message = message; |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
302 } |
cb9a97ebb570
- Added method parseStaticAssertDeclaration and added class StaticAssertDeclaration.
aziz
parents:
126
diff
changeset
|
303 } |
140 | 304 |
305 class TemplateDeclaration : Declaration | |
306 { | |
307 string templateName; | |
308 TemplateParameter[] templateParams; | |
309 Declaration[] decls; | |
310 this(string templateName, TemplateParameter[] templateParams, Declaration[] decls) | |
311 { | |
312 super(true); | |
313 this.templateName = templateName; | |
314 this.templateParams = templateParams; | |
315 this.decls = decls; | |
316 } | |
317 } | |
141 | 318 |
319 class NewDeclaration : Declaration | |
320 { | |
321 Parameters parameters; | |
322 Declaration[] decls; | |
323 this(Parameters parameters, Declaration[] decls) | |
324 { | |
325 super(true); | |
326 this.parameters = parameters; | |
327 this.decls = decls; | |
328 } | |
329 } | |
330 | |
331 class DeleteDeclaration : Declaration | |
332 { | |
333 Parameters parameters; | |
334 Declaration[] decls; | |
335 this(Parameters parameters, Declaration[] decls) | |
336 { | |
337 super(true); | |
338 this.parameters = parameters; | |
339 this.decls = decls; | |
340 } | |
341 } | |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
342 |
149 | 343 class AttributeDeclaration : Declaration |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
344 { |
149 | 345 TOK attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
346 Declaration[] decls; |
149 | 347 this(TOK attribute, Declaration[] decls) |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
348 { |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
349 super(true); |
149 | 350 this.attribute = attribute; |
146
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
351 this.decls = decls; |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
352 } |
8180eb84e69c
- Started implementation of parseAttributeSpecifier().
aziz
parents:
141
diff
changeset
|
353 } |
147 | 354 |
149 | 355 class ExternDeclaration : AttributeDeclaration |
356 { | |
159 | 357 Linkage linkage; |
358 this(Linkage linkage, Declaration[] decls) | |
149 | 359 { |
360 super(TOK.Extern, decls); | |
361 this.linkage = linkage; | |
362 } | |
363 } | |
364 | |
365 class AlignDeclaration : AttributeDeclaration | |
366 { | |
367 int size; | |
368 this(int size, Declaration[] decls) | |
369 { | |
370 super(TOK.Align, decls); | |
371 this.size = size; | |
372 } | |
373 } | |
374 | |
375 class PragmaDeclaration : AttributeDeclaration | |
147 | 376 { |
377 string ident; | |
378 Expression[] args; | |
379 this(string ident, Expression[] args, Declaration[] decls) | |
380 { | |
149 | 381 super(TOK.Pragma, decls); |
147 | 382 this.ident = ident; |
383 this.args = args; | |
384 } | |
385 } | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
386 |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
387 class MixinDeclaration : Declaration |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
388 { |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
389 Expression[] templateIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
390 string mixinIdent; |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
391 Expression assignExpr; // mixin ( AssignExpression ) |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
392 this(Expression[] templateIdent, string mixinIdent) |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
393 { |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
394 super(false); |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
395 this.templateIdent = templateIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
396 this.mixinIdent = mixinIdent; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
397 } |
151
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
398 this(Expression assignExpr) |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
399 { |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
400 super(false); |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
401 this.assignExpr = assignExpr; |
2e959f67000b
- Added code for parsing mixin expression declarations.
aziz
parents:
150
diff
changeset
|
402 } |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
149
diff
changeset
|
403 } |