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