Mercurial > projects > dil
annotate trunk/src/dil/ast/Expressions.d @ 680:6b3e397229c5
Renamed Statements, Declarations and EnumMember.
Statements -> CompoundStatement.
Declarations -> CompoundDeclaration.
EnumMember -> EnumMemberDeclaration.
author | Aziz K?ksal <aziz.koeksal@gmail.com> |
---|---|
date | Fri, 18 Jan 2008 23:59:41 +0100 |
parents | ff6971637f88 |
children | 7541c64fc423 |
rev | line source |
---|---|
70 | 1 /++ |
2 Author: Aziz Köksal | |
249 | 3 License: GPL3 |
70 | 4 +/ |
586
e25345656d10
Moved dil.Expressions to dil.ast.Expressions.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
585
diff
changeset
|
5 module dil.ast.Expressions; |
580
fa6d3c52757d
Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
563
diff
changeset
|
6 |
621
2ac14bb6b84e
Moved class dil.ast.Expression to its own module.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
618
diff
changeset
|
7 public import dil.ast.Expression; |
580
fa6d3c52757d
Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
563
diff
changeset
|
8 import dil.ast.Node; |
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; |
585
05c375fb2d5c
Moved dil.Declarations to dil.ast.Declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
584
diff
changeset
|
10 import dil.ast.Declarations; |
587
7d0ba0c93e95
Moved dil.Statements to dil.ast.Statements.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
586
diff
changeset
|
11 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
|
12 import dil.ast.Parameters; |
600
041eae272362
Moved dil.Identifier to dil.lexer.Identifier.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
596
diff
changeset
|
13 import dil.lexer.Identifier; |
584
556bfb18dff8
Moved dil.TypeSystem to dil.semantic.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
580
diff
changeset
|
14 import dil.semantic.Types; |
536
0781ac288537
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
522
diff
changeset
|
15 import common; |
70 | 16 |
659
304331ca2f95
Renamed EmptyExpression to IllegalExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
655
diff
changeset
|
17 class IllegalExpression : Expression |
136
96468715ea79
- Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents:
133
diff
changeset
|
18 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
19 this() |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
20 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
21 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
22 } |
136
96468715ea79
- Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents:
133
diff
changeset
|
23 } |
96468715ea79
- Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents:
133
diff
changeset
|
24 |
286
0c1a2eba0c91
- Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents:
277
diff
changeset
|
25 abstract class BinaryExpression : Expression |
70 | 26 { |
71 | 27 Expression left, right; |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
28 Token* tok; |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
29 this(Expression left, Expression right, Token* tok) |
71 | 30 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
31 addChildren([left, right]); |
71 | 32 this.left = left; |
33 this.right = right; | |
34 this.tok = tok; | |
35 } | |
70 | 36 } |
37 | |
72 | 38 class CondExpression : BinaryExpression |
70 | 39 { |
72 | 40 Expression condition; |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
41 this(Expression condition, Expression left, Expression right, Token* tok) |
72 | 42 { |
557
c5a05e70911f
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
547
diff
changeset
|
43 addChild(condition); |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
44 super(left, right, tok); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
45 mixin(set_kind); |
72 | 46 this.condition = condition; |
47 } | |
48 } | |
70 | 49 |
72 | 50 class CommaExpression : BinaryExpression |
51 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
52 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
53 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
54 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
55 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
56 } |
70 | 57 } |
58 | |
59 class OrOrExpression : BinaryExpression | |
60 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
61 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
62 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
63 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
64 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
65 } |
70 | 66 } |
67 | |
68 class AndAndExpression : BinaryExpression | |
69 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
70 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
71 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
72 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
73 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
74 } |
70 | 75 } |
76 | |
77 class OrExpression : BinaryExpression | |
78 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
79 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
80 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
81 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
82 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
83 } |
70 | 84 } |
85 | |
86 class XorExpression : BinaryExpression | |
87 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
88 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
89 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
90 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
91 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
92 } |
70 | 93 } |
94 | |
95 class AndExpression : BinaryExpression | |
96 { | |
251
67a798459532
- Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents:
249
diff
changeset
|
97 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
98 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
99 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
100 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
101 } |
70 | 102 } |
103 | |
286
0c1a2eba0c91
- Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents:
277
diff
changeset
|
104 abstract class CmpExpression : BinaryExpression |
70 | 105 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
106 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
107 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
108 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
109 } |
70 | 110 } |
111 | |
71 | 112 class EqualExpression : CmpExpression |
70 | 113 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
114 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
115 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
116 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
117 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
118 } |
70 | 119 } |
120 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
121 class IdentityExpression : CmpExpression |
70 | 122 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
123 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
124 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
125 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
126 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
127 } |
70 | 128 } |
129 | |
71 | 130 class RelExpression : CmpExpression |
70 | 131 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
132 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
133 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
134 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
135 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
136 } |
70 | 137 } |
138 | |
139 class InExpression : BinaryExpression | |
140 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
141 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
142 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
143 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
144 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
145 } |
70 | 146 } |
147 | |
75 | 148 class LShiftExpression : BinaryExpression |
149 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
150 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
151 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
152 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
153 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
154 } |
75 | 155 } |
156 | |
157 class RShiftExpression : BinaryExpression | |
158 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
159 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
160 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
161 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
162 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
163 } |
75 | 164 } |
165 | |
166 class URShiftExpression : BinaryExpression | |
167 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
168 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
169 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
170 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
171 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
172 } |
75 | 173 } |
174 | |
76 | 175 class PlusExpression : BinaryExpression |
70 | 176 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
177 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
178 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
179 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
180 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
181 } |
76 | 182 } |
183 | |
184 class MinusExpression : BinaryExpression | |
185 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
186 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
187 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
188 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
189 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
190 } |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
191 } |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
192 |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
193 class CatExpression : BinaryExpression |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
194 { |
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
195 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
196 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
197 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
198 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
199 } |
70 | 200 } |
201 | |
202 class MulExpression : BinaryExpression | |
203 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
204 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
205 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
206 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
207 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
208 } |
77 | 209 } |
210 | |
211 class DivExpression : BinaryExpression | |
212 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
213 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
214 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
215 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
216 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
217 } |
77 | 218 } |
219 | |
220 class ModExpression : BinaryExpression | |
221 { | |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
222 this(Expression left, Expression right, Token* tok) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
223 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
224 super(left, right, tok); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
225 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
226 } |
71 | 227 } |
70 | 228 |
71 | 229 class AssignExpression : BinaryExpression |
230 { | |
231 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
232 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
233 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
234 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
235 } |
71 | 236 } |
237 class LShiftAssignExpression : BinaryExpression | |
238 { | |
239 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
240 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
241 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
242 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
243 } |
71 | 244 } |
245 class RShiftAssignExpression : BinaryExpression | |
246 { | |
247 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
248 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
249 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
250 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
251 } |
71 | 252 } |
253 class URShiftAssignExpression : BinaryExpression | |
254 { | |
255 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
256 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
257 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
258 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
259 } |
71 | 260 } |
261 class OrAssignExpression : BinaryExpression | |
262 { | |
263 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
264 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
265 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
266 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
267 } |
71 | 268 } |
269 class AndAssignExpression : BinaryExpression | |
270 { | |
271 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
272 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
273 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
274 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
275 } |
71 | 276 } |
277 class PlusAssignExpression : BinaryExpression | |
278 { | |
279 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
280 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
281 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
282 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
283 } |
71 | 284 } |
285 class MinusAssignExpression : BinaryExpression | |
286 { | |
287 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
288 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
289 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
290 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
291 } |
71 | 292 } |
293 class DivAssignExpression : BinaryExpression | |
294 { | |
295 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
296 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
297 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
298 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
299 } |
71 | 300 } |
301 class MulAssignExpression : BinaryExpression | |
302 { | |
303 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
304 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
305 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
306 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
307 } |
71 | 308 } |
309 class ModAssignExpression : BinaryExpression | |
310 { | |
311 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
312 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
313 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
314 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
315 } |
71 | 316 } |
317 class XorAssignExpression : BinaryExpression | |
318 { | |
319 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
320 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
321 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
322 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
323 } |
71 | 324 } |
325 class CatAssignExpression : BinaryExpression | |
326 { | |
327 this(Expression left, Expression right) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
328 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
329 super(left, right, null); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
330 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
331 } |
70 | 332 } |
333 | |
618
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
334 /// DotExpression := Expression '.' Expression |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
335 class DotExpression : BinaryExpression |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
336 { |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
337 this(Expression left, Expression right) |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
338 { |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
339 super(left, right, null); |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
340 mixin(set_kind); |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
341 } |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
342 } |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
343 |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
344 /*++++++++++++++++++++ |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
345 + Unary Expressions: + |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
346 ++++++++++++++++++++*/ |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
347 |
286
0c1a2eba0c91
- Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents:
277
diff
changeset
|
348 abstract class UnaryExpression : Expression |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
349 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
350 Expression e; |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
351 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
352 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
353 addChild(e); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
354 this.e = e; |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
355 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
356 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
357 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
358 class AddressExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
359 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
360 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
361 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
362 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
363 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
364 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
365 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
366 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
367 class PreIncrExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
368 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
369 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
370 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
371 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
372 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
373 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
374 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
375 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
376 class PreDecrExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
377 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
378 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
379 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
380 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
381 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
382 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
383 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
384 |
79
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
385 class PostIncrExpression : UnaryExpression |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
386 { |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
387 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
388 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
389 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
390 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
391 } |
79
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
392 } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
393 |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
394 class PostDecrExpression : UnaryExpression |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
395 { |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
396 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
397 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
398 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
399 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
400 } |
79
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
401 } |
df4e5c7ad58a
- Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents:
78
diff
changeset
|
402 |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
403 class DerefExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
404 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
405 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
406 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
407 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
408 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
409 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
410 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
411 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
412 class SignExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
413 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
414 this(Expression e) |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
415 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
416 super(e); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
417 mixin(set_kind); |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
418 } |
665
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
419 |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
420 bool isPos() |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
421 { |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
422 assert(begin !is null); |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
423 return begin.kind == TOK.Plus; |
665
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
424 } |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
425 |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
426 bool isNeg() |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
427 { |
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
428 assert(begin !is null); |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
429 return begin.kind == TOK.Minus; |
665
595e902e8624
Added isPos() and isNeg() to SignExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
663
diff
changeset
|
430 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
431 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
432 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
433 class NotExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
434 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
435 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
436 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
437 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
438 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
439 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
440 } |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
441 |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
442 class CompExpression : UnaryExpression |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
443 { |
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
444 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
445 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
446 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
447 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
448 } |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
449 } |
160
c21192e8be2b
- Parsing PostDotListExpression in parsePostExpression().
aziz
parents:
157
diff
changeset
|
450 |
81 | 451 class CallExpression : UnaryExpression |
452 { | |
453 Expression[] args; | |
454 this(Expression e, Expression[] args) | |
455 { | |
456 super(e); | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
457 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
458 addOptChildren(args); |
81 | 459 this.args = args; |
460 } | |
461 } | |
462 | |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
463 class NewExpression : /*Unary*/Expression |
70 | 464 { |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
465 Expression[] newArgs; |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
466 TypeNode type; |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
467 Expression[] ctorArgs; |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
468 this(/*Expression e, */Expression[] newArgs, TypeNode type, Expression[] ctorArgs) |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
469 { |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
470 /*super(e);*/ |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
471 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
472 addOptChildren(newArgs); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
473 addChild(type); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
474 addOptChildren(ctorArgs); |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
475 this.newArgs = newArgs; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
476 this.type = type; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
477 this.ctorArgs = ctorArgs; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
478 } |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
479 } |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
480 |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
481 class NewAnonClassExpression : /*Unary*/Expression |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
482 { |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
483 Expression[] newArgs; |
668
a1f8d8f2db38
Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
665
diff
changeset
|
484 BaseClassType[] bases; |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
485 Expression[] ctorArgs; |
680
6b3e397229c5
Renamed Statements, Declarations and EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
679
diff
changeset
|
486 CompoundDeclaration decls; |
6b3e397229c5
Renamed Statements, Declarations and EnumMember.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
679
diff
changeset
|
487 this(/*Expression e, */Expression[] newArgs, BaseClassType[] bases, Expression[] ctorArgs, CompoundDeclaration decls) |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
488 { |
154
0e7cefb15e43
- Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents:
153
diff
changeset
|
489 /*super(e);*/ |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
490 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
491 addOptChildren(newArgs); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
492 addOptChildren(bases); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
493 addOptChildren(ctorArgs); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
494 addChild(decls); |
305 | 495 |
144
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
496 this.newArgs = newArgs; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
497 this.bases = bases; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
498 this.ctorArgs = ctorArgs; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
499 this.decls = decls; |
cfd890b250e6
- Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents:
136
diff
changeset
|
500 } |
70 | 501 } |
502 | |
503 class DeleteExpression : UnaryExpression | |
504 { | |
78
f043759fb59a
- Added code to parseUnaryExpression(); not fully implemented.
aziz
parents:
77
diff
changeset
|
505 this(Expression e) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
506 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
507 super(e); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
508 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
509 } |
70 | 510 } |
511 | |
512 class CastExpression : UnaryExpression | |
513 { | |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
514 TypeNode type; |
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
515 this(Expression e, TypeNode type) |
99
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
516 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
517 addChild(type); // Add type before super(). |
99
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
518 super(e); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
519 mixin(set_kind); |
99
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
520 this.type = type; |
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
521 } |
70 | 522 } |
523 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
524 class IndexExpression : UnaryExpression |
70 | 525 { |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
526 Expression[] args; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
527 this(Expression e, Expression[] args) |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
528 { |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
529 super(e); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
530 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
531 addChildren(args); |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
532 this.args = args; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
533 } |
70 | 534 } |
535 | |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
536 class SliceExpression : UnaryExpression |
70 | 537 { |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
538 Expression left, right; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
539 this(Expression e, Expression left, Expression right) |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
540 { |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
541 super(e); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
542 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
543 assert(left ? (right !is null) : right is null); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
544 if (left) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
545 addChildren([left, right]); |
396
0a4619735ce9
Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
391
diff
changeset
|
546 |
83
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
547 this.left = left; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
548 this.right = right; |
9e6d66f647c9
- Fix: IsExpression was created instead of IdentityExpression.
aziz
parents:
81
diff
changeset
|
549 } |
70 | 550 } |
551 | |
618
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
552 /// Module scope operator: '.' (IdentifierExpression|TemplateInstanceExpression) |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
553 class ModuleScopeExpression : UnaryExpression |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
554 { |
618
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
555 this(Expression e) |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
556 { |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
557 super(e); |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
558 assert(e.kind == NodeKind.IdentifierExpression || |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
559 e.kind == NodeKind.TemplateInstanceExpression |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
560 ); |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
561 mixin(set_kind); |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
562 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
563 } |
618
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
564 |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
565 /*++++++++++++++++++++++ |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
566 + Primary Expressions: + |
07946b379006
Refactored the way dot expressions are parsed.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
608
diff
changeset
|
567 ++++++++++++++++++++++*/ |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
568 |
89 | 569 class IdentifierExpression : Expression |
570 { | |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
571 Identifier* identifier; |
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
572 this(Identifier* identifier) |
89 | 573 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
574 mixin(set_kind); |
89 | 575 this.identifier = identifier; |
576 } | |
577 } | |
312 | 578 |
579 class SpecialTokenExpression : Expression | |
580 { | |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
581 Token* specialToken; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
582 this(Token* specialToken) |
312 | 583 { |
584 mixin(set_kind); | |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
585 this.specialToken = specialToken; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
586 } |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
587 |
645
89ee7802c978
Moved semantic() methods of expressions to class SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
635
diff
changeset
|
588 Expression value; /// The expression created in the semantic phase. |
312 | 589 } |
590 | |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
144
diff
changeset
|
591 class TemplateInstanceExpression : Expression |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
592 { |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
593 Identifier* ident; |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
144
diff
changeset
|
594 TemplateArguments targs; |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
595 this(Identifier* ident, TemplateArguments targs) |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
596 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
597 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
598 addOptChild(targs); |
150
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
144
diff
changeset
|
599 this.ident = ident; |
753bc07bf3a0
- Forgot to pass ident to constructor of TemplateArgument.
aziz
parents:
144
diff
changeset
|
600 this.targs = targs; |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
601 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
602 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
603 |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
604 class ThisExpression : Expression |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
605 { |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
606 this() |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
607 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
608 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
609 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
610 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
611 |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
612 class SuperExpression : Expression |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
613 { |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
614 this() |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
615 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
616 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
617 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
618 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
619 |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
620 class NullExpression : Expression |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
621 { |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
622 this() |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
623 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
624 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
625 } |
546
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
626 |
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
627 this(Type type) |
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
628 { |
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
629 this(); |
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
630 this.type = type; |
57f5b08b8313
Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
542
diff
changeset
|
631 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
632 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
633 |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
634 class DollarExpression : Expression |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
635 { |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
636 this() |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
637 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
638 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
639 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
640 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
641 |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
642 class BoolExpression : Expression |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
643 { |
242
7ec7ad8df9da
- Changed type of member tok in class BinaryExpression to Token*.
aziz
parents:
240
diff
changeset
|
644 this() |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
645 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
646 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
647 } |
547
a6b43f87ee0c
Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
546
diff
changeset
|
648 |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
649 bool toBool() |
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
650 { |
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
651 assert(begin !is null); |
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
652 return begin.kind == TOK.True ? true : false; |
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
653 } |
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
654 |
645
89ee7802c978
Moved semantic() methods of expressions to class SemanticPass1.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
635
diff
changeset
|
655 Expression value; /// IntExpression of type int. |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
656 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
657 |
399
ff1d11c27061
Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
658 class IntExpression : Expression |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
659 { |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
660 ulong number; |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
661 |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
662 this(ulong number, Type type) |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
663 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
664 mixin(set_kind); |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
665 this.number = number; |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
666 this.type = type; |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
667 } |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
668 |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
669 this(Token* token) |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
670 { |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
671 auto type = Types.Int; // Should be most common case. |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
672 switch (token.kind) |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
673 { |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
674 // case TOK.Int32: |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
675 // type = Types.Int; break; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
676 case TOK.Uint32: |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
677 type = Types.Uint; break; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
678 case TOK.Int64: |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
679 type = Types.Long; break; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
680 case TOK.Uint64: |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
681 type = Types.Ulong; break; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
682 default: |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
683 assert(token.kind == TOK.Int32); |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
684 } |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
685 this(token.ulong_, type); |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
686 } |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
687 } |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
688 |
399
ff1d11c27061
Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
689 class RealExpression : Expression |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
690 { |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
691 real number; |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
692 |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
693 this(real number, Type type) |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
694 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
695 mixin(set_kind); |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
696 this.number = number; |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
697 this.type = type; |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
698 } |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
699 |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
700 this(Token* token) |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
701 { |
540
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
702 auto type = Types.Double; // Most common case? |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
703 switch (token.kind) |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
704 { |
540
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
705 case TOK.Float32: |
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
706 type = Types.Float; break; |
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
707 // case TOK.Float64: |
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
708 // type = Types.Double; break; |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
709 case TOK.Float80: |
540
660684f559a4
Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
539
diff
changeset
|
710 type = Types.Real; break; |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
711 case TOK.Imaginary32: |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
712 type = Types.Ifloat; break; |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
713 case TOK.Imaginary64: |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
714 type = Types.Idouble; break; |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
715 case TOK.Imaginary80: |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
716 type = Types.Ireal; break; |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
717 default: |
679
ff6971637f88
Renamed Token member type to kind.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
668
diff
changeset
|
718 assert(token.kind == TOK.Float64); |
539
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
719 } |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
720 this(token.real_, type); |
3418027c3914
Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
537
diff
changeset
|
721 } |
97
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
722 } |
1a83e5070a84
- Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents:
94
diff
changeset
|
723 |
541
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
724 /++ |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
725 This expression holds a complex number. |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
726 It is only created in the semantic phase. |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
727 +/ |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
728 class ComplexExpression : Expression |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
729 { |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
730 creal number; |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
731 |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
732 this(creal number, Type type) |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
733 { |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
734 mixin(set_kind); |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
735 this.number = number; |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
736 this.type = type; |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
737 } |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
738 } |
c0f5b1f78a55
Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
540
diff
changeset
|
739 |
399
ff1d11c27061
Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
740 class CharExpression : Expression |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
741 { |
536
0781ac288537
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
522
diff
changeset
|
742 dchar character; |
0781ac288537
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
522
diff
changeset
|
743 this(dchar character) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
744 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
745 mixin(set_kind); |
536
0781ac288537
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
522
diff
changeset
|
746 this.character = character; |
0781ac288537
Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
522
diff
changeset
|
747 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
748 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
749 |
399
ff1d11c27061
Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
750 class StringExpression : Expression |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
751 { |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
752 ubyte[] str; /// The string data. |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
753 Type charType; /// The character type of the string. |
653
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
754 |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
755 this(ubyte[] str, Type charType) |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
756 { |
653
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
757 mixin(set_kind); |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
758 this.str = str; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
759 this.charType = charType; |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
760 type = new TypeSArray(charType, str.length); |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
761 } |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
762 |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
763 this(char[] str) |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
764 { |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
765 this(cast(ubyte[])str, Types.Char); |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
766 } |
653
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
767 |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
768 this(wchar[] str) |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
769 { |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
770 this(cast(ubyte[])str, Types.Wchar); |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
771 } |
653
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
772 |
537
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
773 this(dchar[] str) |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
774 { |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
775 this(cast(ubyte[])str, Types.Dchar); |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
776 } |
db7913148b29
Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
536
diff
changeset
|
777 |
391
33b566df6af4
Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
377
diff
changeset
|
778 char[] getString() |
309 | 779 { |
653
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
780 // TODO: convert to char[] if charType !is Types.Char. |
29cc5bf3ce89
Refactored StringExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
647
diff
changeset
|
781 return cast(char[])str; |
309 | 782 } |
84
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
783 } |
ac8d961d10d1
- Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents:
83
diff
changeset
|
784 |
85 | 785 class ArrayLiteralExpression : Expression |
786 { | |
787 Expression[] values; | |
788 this(Expression[] values) | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
789 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
790 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
791 addOptChildren(values); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
792 this.values = values; |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
793 } |
85 | 794 } |
795 | |
399
ff1d11c27061
Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
396
diff
changeset
|
796 class AArrayLiteralExpression : Expression |
85 | 797 { |
798 Expression[] keys, values; | |
799 this(Expression[] keys, Expression[] values) | |
800 { | |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
801 assert(keys.length == values.length); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
802 mixin(set_kind); |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
803 foreach (i, key; keys) |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
804 addChildren([key, values[i]]); |
85 | 805 this.keys = keys; |
806 this.values = values; | |
807 } | |
808 } | |
809 | |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
810 class AssertExpression : Expression |
70 | 811 { |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
812 Expression expr, msg; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
813 this(Expression expr, Expression msg) |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
814 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
815 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
816 addChild(expr); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
817 addOptChild(msg); |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
818 this.expr = expr; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
819 this.msg = msg; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
820 } |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
821 } |
70 | 822 |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
823 class MixinExpression : Expression |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
824 { |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
825 Expression expr; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
826 this(Expression expr) |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
827 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
828 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
829 addChild(expr); |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
830 this.expr = expr; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
831 } |
70 | 832 } |
833 | |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
834 class ImportExpression : Expression |
70 | 835 { |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
836 Expression expr; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
837 this(Expression expr) |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
838 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
839 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
840 addChild(expr); |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
841 this.expr = expr; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
842 } |
70 | 843 } |
844 | |
101 | 845 class TypeofExpression : Expression |
846 { | |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
847 TypeNode type; |
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
848 this(TypeNode type) |
101 | 849 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
850 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
851 addChild(type); |
101 | 852 this.type = type; |
853 } | |
854 } | |
855 | |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
856 class TypeDotIdExpression : Expression |
70 | 857 { |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
858 TypeNode type; |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
859 Identifier* ident; |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
860 this(TypeNode type, Identifier* ident) |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
861 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
862 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
863 addChild(type); |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
864 this.type = type; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
865 this.ident = ident; |
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
866 } |
70 | 867 } |
868 | |
86
0459c902a370
- Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents:
85
diff
changeset
|
869 class TypeidExpression : Expression |
70 | 870 { |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
871 TypeNode type; |
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
872 this(TypeNode type) |
99
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
873 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
874 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
875 addChild(type); |
99
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
876 this.type = type; |
6b8c248f5911
- Added member type to classes CastExpression and TypeidExpression.
aziz
parents:
97
diff
changeset
|
877 } |
70 | 878 } |
879 | |
89 | 880 class IsExpression : Expression |
70 | 881 { |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
882 TypeNode type; |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
883 Identifier* ident; |
248 | 884 Token* opTok, specTok; |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
885 TypeNode specType; |
377 | 886 TemplateParameters tparams; // D 2.0 |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
887 this(TypeNode type, Identifier* ident, Token* opTok, Token* specTok, |
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
888 TypeNode specType, typeof(tparams) tparams) |
100 | 889 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
890 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
891 addChild(type); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
892 addOptChild(specType); |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
893 version(D2) |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
894 addOptChild(tparams); |
100 | 895 this.type = type; |
896 this.ident = ident; | |
248 | 897 this.opTok = opTok; |
898 this.specTok = specTok; | |
100 | 899 this.specType = specType; |
377 | 900 this.tparams = tparams; |
100 | 901 } |
70 | 902 } |
130 | 903 |
904 class FunctionLiteralExpression : Expression | |
905 { | |
511
aa73f669c298
Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
505
diff
changeset
|
906 TypeNode returnType; |
668
a1f8d8f2db38
Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
665
diff
changeset
|
907 Parameters params; |
193
2a2975b6d539
- Using parseFunctionBody() when parsing FunctionLiteralExpression.
aziz
parents:
160
diff
changeset
|
908 FunctionBody funcBody; |
133
3924b1ee1302
- Added code for parsing function and delegate literal expressions.
aziz
parents:
130
diff
changeset
|
909 |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
910 this() |
130 | 911 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
912 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
913 addOptChild(returnType); |
668
a1f8d8f2db38
Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
665
diff
changeset
|
914 addOptChild(params); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
915 addChild(funcBody); |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
916 } |
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
917 |
668
a1f8d8f2db38
Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
665
diff
changeset
|
918 this(TypeNode returnType, Parameters params, FunctionBody funcBody) |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
919 { |
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
920 this.returnType = returnType; |
668
a1f8d8f2db38
Renamed some identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
665
diff
changeset
|
921 this.params = params; |
193
2a2975b6d539
- Using parseFunctionBody() when parsing FunctionLiteralExpression.
aziz
parents:
160
diff
changeset
|
922 this.funcBody = funcBody; |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
923 this(); |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
924 } |
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
925 |
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
926 this(FunctionBody funcBody) |
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
927 { |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
928 this.funcBody = funcBody; |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
929 this(); |
130 | 930 } |
931 } | |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
932 |
646
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
933 /// ParenthesisExpression := "(" Expression ")" |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
934 class ParenExpression : Expression |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
935 { |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
936 Expression next; |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
937 this(Expression next) |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
938 { |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
939 mixin(set_kind); |
647
6a1cb6768bd2
Fixed ctor of ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
646
diff
changeset
|
940 addChild(next); |
646
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
941 this.next = next; |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
942 } |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
943 } |
68953760d569
Added class ParenExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
645
diff
changeset
|
944 |
635 | 945 // version(D2) |
946 // { | |
269 | 947 class TraitsExpression : Expression |
948 { | |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
949 Identifier* ident; |
269 | 950 TemplateArguments targs; |
951 this(typeof(ident) ident, typeof(targs) targs) | |
952 { | |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
953 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
954 addOptChild(targs); |
269 | 955 this.ident = ident; |
289
a99357783c6f
- Fix: assign targs to member targs of TraitsExpression.
aziz
parents:
288
diff
changeset
|
956 this.targs = targs; |
269 | 957 } |
958 } | |
635 | 959 // } |
269 | 960 |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
961 class VoidInitializer : Expression |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
962 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
963 this() |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
964 { |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
965 mixin(set_kind); |
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
966 } |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
967 } |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
968 |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
969 class ArrayInitializer : Expression |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
970 { |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
971 Expression[] keys; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
972 Expression[] values; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
973 this(Expression[] keys, Expression[] values) |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
974 { |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
975 assert(keys.length == values.length); |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
976 mixin(set_kind); |
293
418c6548ce17
- Assigning to Node.children in several constructors that inherit from Node.
aziz
parents:
289
diff
changeset
|
977 foreach (i, key; keys) |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
293
diff
changeset
|
978 { |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
979 addOptChild(key); // The key is optional in ArrayInitializers. |
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
980 addChild(values[i]); |
299
559d5d62e0c1
- Added checks for null before adding member to Node.children.
aziz
parents:
293
diff
changeset
|
981 } |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
982 this.keys = keys; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
983 this.values = values; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
984 } |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
985 } |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
986 |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
987 class StructInitializer : Expression |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
988 { |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
989 Identifier*[] idents; |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
990 Expression[] values; |
505
3bb94ba21490
Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
502
diff
changeset
|
991 this(Identifier*[] idents, Expression[] values) |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
992 { |
276
d6b2f7616ca5
- Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents:
275
diff
changeset
|
993 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
994 addOptChildren(values); |
198
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
995 this.idents = idents; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
996 this.values = values; |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
997 } |
88c1777a9e51
- Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents:
193
diff
changeset
|
998 } |
287
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
999 |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1000 class AsmTypeExpression : UnaryExpression |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1001 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1002 this(Expression e) |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1003 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1004 super(e); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1005 mixin(set_kind); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1006 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1007 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1008 |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1009 class AsmOffsetExpression : UnaryExpression |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1010 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1011 this(Expression e) |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1012 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1013 super(e); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1014 mixin(set_kind); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1015 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1016 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1017 |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1018 class AsmSegExpression : UnaryExpression |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1019 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1020 this(Expression e) |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1021 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1022 super(e); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1023 mixin(set_kind); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1024 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1025 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1026 |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1027 class AsmPostBracketExpression : UnaryExpression |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1028 { |
632
20dddcc54621
Fixed parsing of AsmPostBracketExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
631
diff
changeset
|
1029 Expression e2; /// Expression in brackets: e [ e2 ] |
20dddcc54621
Fixed parsing of AsmPostBracketExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
631
diff
changeset
|
1030 this(Expression e, Expression e2) |
287
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1031 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1032 super(e); |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1033 mixin(set_kind); |
632
20dddcc54621
Fixed parsing of AsmPostBracketExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
631
diff
changeset
|
1034 addChild(e2); |
663
810e6f589d33
Fixed ctor of AsmPostBracketExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
659
diff
changeset
|
1035 this.e2 = e2; |
287
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1036 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1037 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1038 |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1039 class AsmBracketExpression : Expression |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1040 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1041 Expression e; |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1042 this(Expression e) |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1043 { |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1044 mixin(set_kind); |
489
a7291d3ee9d7
Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
488
diff
changeset
|
1045 addChild(e); |
287
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1046 this.e = e; |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1047 } |
211bdd69397d
- Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents:
286
diff
changeset
|
1048 } |
288
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1049 |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1050 class AsmLocalSizeExpression : Expression |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1051 { |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1052 this() |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1053 { |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1054 mixin(set_kind); |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1055 } |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1056 } |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1057 |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1058 class AsmRegisterExpression : Expression |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1059 { |
502
4e14cd1b24da
Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
1060 Identifier* register; |
4e14cd1b24da
Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
1061 int number; // ST(0) - ST(7) or FS:0, FS:4, FS:8 |
4e14cd1b24da
Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
490
diff
changeset
|
1062 this(Identifier* register, int number = -1) |
288
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1063 { |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1064 mixin(set_kind); |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1065 this.register = register; |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1066 this.number = number; |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1067 } |
833b301497f4
- Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents:
287
diff
changeset
|
1068 } |