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