annotate trunk/src/dil/ast/Expressions.d @ 596:39fac5531b85

Moved dil.Token to dil.lexer.Token.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sun, 06 Jan 2008 00:25:29 +0100
parents b8dd677e0ace
children 041eae272362
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1 /++
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
2 Author: Aziz Köksal
249
32d354584b28 - Upgraded license notices to GPL3.
aziz
parents: 248
diff changeset
3 License: GPL3
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
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
fa6d3c52757d Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 563
diff changeset
7 import dil.ast.Node;
588
dcfec202718d Moved dil.Types to dil.ast.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 587
diff changeset
8 import dil.ast.Types;
585
05c375fb2d5c Moved dil.Declarations to dil.ast.Declarations.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 584
diff changeset
9 import dil.ast.Declarations;
587
7d0ba0c93e95 Moved dil.Statements to dil.ast.Statements.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 586
diff changeset
10 import dil.ast.Statements;
502
4e14cd1b24da Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
11 import dil.Identifier;
592
b8dd677e0ace Moved dil.Scope to dil.semantic.Scope.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 588
diff changeset
12 import dil.semantic.Scope;
584
556bfb18dff8 Moved dil.TypeSystem to dil.semantic.Types.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 580
diff changeset
13 import dil.semantic.Types;
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
14 import common;
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
15
277
38a68e534a3b - Made classes Declaration, Expression and Statement abstract.
aziz
parents: 276
diff changeset
16 abstract class Expression : Node
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
17 {
522
812f497b20dc Added module dil.TypesEnum.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 511
diff changeset
18 Type type; /// The type of this expression.
240
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 198
diff changeset
19 this()
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 198
diff changeset
20 {
275
e8de572e4d01 - Changed enum NodeType to NodeCategory.
aziz
parents: 269
diff changeset
21 super(NodeCategory.Expression);
240
deab661906ae - Classes Declaration, Expression, Statement and Type inherit from Node now.
aziz
parents: 198
diff changeset
22 }
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
23
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
24 // Semantic analysis:
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
25
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
26 Expression semantic(Scope scop)
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
27 {
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
28 debug Stdout("SA for "~this.classinfo.name).newline;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
29 if (!type)
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
30 type = Types.Undefined;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
31 return this;
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
32 }
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
33
559
c4bb948e5cc1 Added semantic code for pragmas.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 557
diff changeset
34 Expression evaluate()
c4bb948e5cc1 Added semantic code for pragmas.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 557
diff changeset
35 {
c4bb948e5cc1 Added semantic code for pragmas.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 557
diff changeset
36 return null;
c4bb948e5cc1 Added semantic code for pragmas.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 557
diff changeset
37 }
c4bb948e5cc1 Added semantic code for pragmas.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 557
diff changeset
38
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
39 import dil.Messages;
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
40 void error(Scope scop, MID mid)
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
41 {
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
42 scop.error(this.begin, mid);
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
43 }
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
44
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
45 void error(Scope scop, char[] msg)
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
46 {
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
47
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
48 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
49 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
50
136
96468715ea79 - Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents: 133
diff changeset
51 class EmptyExpression : Expression
96468715ea79 - Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents: 133
diff changeset
52 {
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 this()
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
54 {
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 }
136
96468715ea79 - Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents: 133
diff changeset
57 }
96468715ea79 - Returning EmptyExpression in parsePrimaryExpression() when no token matched.
aziz
parents: 133
diff changeset
58
286
0c1a2eba0c91 - Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents: 277
diff changeset
59 abstract class BinaryExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
60 {
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
61 Expression left, right;
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
62 Token* tok;
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
63 this(Expression left, Expression right, Token* tok)
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
64 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
65 addChildren([left, right]);
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
66 this.left = left;
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
67 this.right = right;
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
68 this.tok = tok;
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
69 }
557
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
70
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
71 override Expression semantic(Scope scop)
557
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
72 {
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
73 left = left.semantic(scop);
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
74 right = right.semantic(scop);
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
75 return this;
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
76 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
77 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
78
72
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
79 class CondExpression : BinaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
80 {
72
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
81 Expression condition;
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
82 this(Expression condition, Expression left, Expression right, Token* tok)
72
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
83 {
557
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
84 addChild(condition);
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
85 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
86 mixin(set_kind);
72
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
87 this.condition = condition;
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
88 }
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
89 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
90
72
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
91 class CommaExpression : BinaryExpression
f75e359f939f - Added parseExpression() method.
aziz
parents: 71
diff changeset
92 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
93 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
94 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
95 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
96 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
97 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
98 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
99
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
100 class OrOrExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
101 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
102 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
103 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
104 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
105 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
106 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
107 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
108
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
109 class AndAndExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
110 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
111 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
112 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
113 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
114 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
115 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
116 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
117
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
118 class OrExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
119 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
120 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
121 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
122 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
123 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
124 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
125 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
126
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
127 class XorExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
128 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
129 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
130 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
131 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
132 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
133 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
134 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
135
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
136 class AndExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
137 {
251
67a798459532 - Added parameter Token* tok to some Expression constructors. Adapted parser accordingly.
aziz
parents: 249
diff changeset
138 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
139 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
140 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
141 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
142 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
143 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
144
286
0c1a2eba0c91 - Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents: 277
diff changeset
145 abstract class CmpExpression : BinaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
146 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
147 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
148 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
149 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
150 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
151 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
152
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
153 class EqualExpression : CmpExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
154 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
155 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
156 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
157 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
158 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
159 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
160 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
161
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
162 class IdentityExpression : CmpExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
163 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
164 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
165 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
166 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
167 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
168 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
169 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
170
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
171 class RelExpression : CmpExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
172 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
173 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
174 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
175 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
176 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
177 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
178 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
179
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
180 class InExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
181 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
182 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
183 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
184 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
185 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
186 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
187 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
188
75
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
189 class LShiftExpression : BinaryExpression
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
190 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
191 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
192 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
193 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
194 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
195 }
75
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
196 }
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
197
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
198 class RShiftExpression : BinaryExpression
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
199 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
200 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
201 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
202 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
203 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
204 }
75
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
205 }
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
206
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
207 class URShiftExpression : BinaryExpression
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
208 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
209 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
210 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
211 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
212 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
213 }
75
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
214 }
3f976d9e0833 - Implemented parseShiftExpression().
aziz
parents: 74
diff changeset
215
76
a85f9edf6ce7 - Implemented parseAddExpression().
aziz
parents: 75
diff changeset
216 class PlusExpression : BinaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
217 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
218 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
219 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
220 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
221 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
222 }
76
a85f9edf6ce7 - Implemented parseAddExpression().
aziz
parents: 75
diff changeset
223 }
a85f9edf6ce7 - Implemented parseAddExpression().
aziz
parents: 75
diff changeset
224
a85f9edf6ce7 - Implemented parseAddExpression().
aziz
parents: 75
diff changeset
225 class MinusExpression : BinaryExpression
a85f9edf6ce7 - Implemented parseAddExpression().
aziz
parents: 75
diff changeset
226 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
227 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
228 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
229 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
230 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
231 }
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
232 }
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
233
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
234 class CatExpression : BinaryExpression
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
235 {
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
236 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
237 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
238 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
239 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
240 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
241 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
242
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
243 class MulExpression : BinaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
244 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
245 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
246 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
247 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
248 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
249 }
77
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
250 }
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
251
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
252 class DivExpression : BinaryExpression
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
253 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
254 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
255 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
256 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
257 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
258 }
77
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
259 }
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
260
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
261 class ModExpression : BinaryExpression
7e21c4df1c02 - Implemented parseMulExpression().
aziz
parents: 76
diff changeset
262 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
263 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
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, tok);
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
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
268 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
269
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
270 class AssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
271 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
272 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
273 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
274 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
275 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
276 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
277 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
278 class LShiftAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
279 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
280 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
281 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
282 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
283 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
284 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
285 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
286 class RShiftAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
287 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
288 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
289 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
290 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
291 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
292 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
293 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
294 class URShiftAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
295 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
296 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
297 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
298 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
299 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
300 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
301 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
302 class OrAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
303 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
304 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
305 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
306 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
307 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
308 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
309 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
310 class AndAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
311 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
312 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
313 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
314 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
315 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
316 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
317 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
318 class PlusAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
319 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
320 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
321 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
322 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
323 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
324 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
325 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
326 class MinusAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
327 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
328 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
329 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
330 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
331 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
332 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
333 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
334 class DivAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
335 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
336 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
337 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
338 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
339 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
340 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
341 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
342 class MulAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
343 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
344 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
345 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
346 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
347 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
348 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
349 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
350 class ModAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
351 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
352 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
353 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
354 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
355 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
356 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
357 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
358 class XorAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
359 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
360 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
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(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
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 }
71
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
365 }
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
366 class CatAssignExpression : BinaryExpression
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
367 {
b3777cca323c - Added Identity and NotIdentity tokens.
aziz
parents: 70
diff changeset
368 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
369 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
370 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
371 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
372 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
373 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
374
286
0c1a2eba0c91 - Made classes BinaryExpression, CmpExpression and UnaryExpression abstract. Removed mixin(set_kind) from their constructors.
aziz
parents: 277
diff changeset
375 abstract class UnaryExpression : Expression
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
376 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
377 Expression e;
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 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
380 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
381 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
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
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
385 class AddressExpression : UnaryExpression
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
386 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
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 }
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
392 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
393
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
394 class PreIncrExpression : UnaryExpression
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
395 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
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 }
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
401 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
402
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
403 class PreDecrExpression : 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
79
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
412 class PostIncrExpression : UnaryExpression
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
413 {
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
414 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
415 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
416 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
417 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
418 }
79
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
419 }
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
420
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
421 class PostDecrExpression : UnaryExpression
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
422 {
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
423 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
424 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
425 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
426 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
427 }
79
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
428 }
df4e5c7ad58a - Implemented most of parsePostExpression() and parsePreExpression().
aziz
parents: 78
diff changeset
429
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
430 class DerefExpression : UnaryExpression
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 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
433 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
434 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
435 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
436 }
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
437 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
438
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
439 class SignExpression : UnaryExpression
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
440 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
441 this(Expression e)
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
442 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
443 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
444 mixin(set_kind);
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
445 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
446 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
447
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
448 class NotExpression : UnaryExpression
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
449 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
450 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
451 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
452 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
453 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
454 }
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
455 }
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
456
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
457 class CompExpression : UnaryExpression
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
458 {
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
459 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
460 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
461 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
462 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
463 }
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
464 }
252
788398655d24 - Changed some string types to Token*. Adapted parser accordingly.
aziz
parents: 251
diff changeset
465 /+
81
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
466 class DotIdExpression : UnaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
467 {
108
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
468 string ident;
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
469 this(Expression e, string ident)
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
470 {
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
471 super(e);
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
472 this.ident = ident;
469188935d56 - Added ident member to DotIdExpression.
aziz
parents: 101
diff changeset
473 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
474 }
252
788398655d24 - Changed some string types to Token*. Adapted parser accordingly.
aziz
parents: 251
diff changeset
475 +/
788398655d24 - Changed some string types to Token*. Adapted parser accordingly.
aziz
parents: 251
diff changeset
476 /+
153
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
477 class DotTemplateInstanceExpression : UnaryExpression
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
478 {
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
479 string ident;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
480 TemplateArguments targs;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
481 this(Expression e, string ident, TemplateArguments targs)
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
482 {
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
483 super(e);
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
484 this.ident = ident;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
485 this.targs = targs;
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
486 }
66790fc2c0a2 - Added method parseIdentifierListType().
aziz
parents: 152
diff changeset
487 }
252
788398655d24 - Changed some string types to Token*. Adapted parser accordingly.
aziz
parents: 251
diff changeset
488 +/
160
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
489 class PostDotListExpression : UnaryExpression
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
490 {
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
491 DotListExpression dotList;
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
492 this(Expression e, DotListExpression dotList)
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
493 {
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
494 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
495 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
496 addChild(dotList);
160
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
497 this.dotList = dotList;
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
498 }
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
499 }
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
500
81
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
501 class CallExpression : UnaryExpression
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
502 {
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
503 Expression[] args;
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
504 this(Expression e, Expression[] args)
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
505 {
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
506 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
507 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
508 addOptChildren(args);
81
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
509 this.args = args;
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
510 }
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
511 }
aa1ea2548dd9 - Fixed parseExpression() method.
aziz
parents: 79
diff changeset
512
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
513 class NewExpression : /*Unary*/Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
514 {
144
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
515 Expression[] newArgs;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
516 TypeNode type;
144
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
517 Expression[] ctorArgs;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
518 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
519 {
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
520 /*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
521 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
522 addOptChildren(newArgs);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
523 addChild(type);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
524 addOptChildren(ctorArgs);
144
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
525 this.newArgs = newArgs;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
526 this.type = type;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
527 this.ctorArgs = ctorArgs;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
528 }
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
529 }
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
530
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
531 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
532 {
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
533 Expression[] newArgs;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
534 BaseClass[] bases;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
535 Expression[] ctorArgs;
305
df237b3b5f09 - Added class Declarations.
aziz
parents: 299
diff changeset
536 Declarations decls;
df237b3b5f09 - Added class Declarations.
aziz
parents: 299
diff changeset
537 this(/*Expression e, */Expression[] newArgs, BaseClass[] bases, Expression[] ctorArgs, Declarations decls)
144
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
538 {
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
539 /*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
540 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
541 addOptChildren(newArgs);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
542 addOptChildren(bases);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
543 addOptChildren(ctorArgs);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
544 addChild(decls);
305
df237b3b5f09 - Added class Declarations.
aziz
parents: 299
diff changeset
545
144
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
546 this.newArgs = newArgs;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
547 this.bases = bases;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
548 this.ctorArgs = ctorArgs;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
549 this.decls = decls;
cfd890b250e6 - Added bool parameter to parseBaseClasses. BaseClasses in anonymous classes don't start with a colon.
aziz
parents: 136
diff changeset
550 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
551 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
552
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
553 class DeleteExpression : UnaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
554 {
78
f043759fb59a - Added code to parseUnaryExpression(); not fully implemented.
aziz
parents: 77
diff changeset
555 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
556 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
557 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
558 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
559 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
560 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
561
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
562 class CastExpression : UnaryExpression
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
563 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
564 TypeNode type;
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
565 this(Expression e, TypeNode type)
99
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
566 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
567 addChild(type); // Add type before super().
99
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
568 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
569 mixin(set_kind);
99
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
570 this.type = type;
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
571 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
572 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
573
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
574 class IndexExpression : UnaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
575 {
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
576 Expression[] args;
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
577 this(Expression e, Expression[] args)
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
578 {
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
579 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
580 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
581 addChildren(args);
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
582 this.args = args;
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
583 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
584 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
585
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
586 class SliceExpression : UnaryExpression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
587 {
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
588 Expression left, right;
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
589 this(Expression e, Expression left, Expression right)
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
590 {
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
591 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
592 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
593 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
594 if (left)
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
595 addChildren([left, right]);
396
0a4619735ce9 Applied fixes to Lexer, Parser and other classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 391
diff changeset
596
83
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
597 this.left = left;
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
598 this.right = right;
9e6d66f647c9 - Fix: IsExpression was created instead of IdentityExpression.
aziz
parents: 81
diff changeset
599 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
600 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
601
84
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 class PrimaryExpression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
604 {
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 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
607 */
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
608
89
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
609 class IdentifierExpression : Expression
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
610 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
611 Identifier* identifier;
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
612 this(Identifier* identifier)
89
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
613 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
614 mixin(set_kind);
89
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
615 this.identifier = identifier;
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
616 }
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
617 }
312
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
618
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
619 class SpecialTokenExpression : Expression
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
620 {
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
621 Token* specialToken;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
622 this(Token* specialToken)
312
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
623 {
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
624 mixin(set_kind);
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
625 this.specialToken = specialToken;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
626 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
627
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
628 Expression e; /// The expression created in the semantic phase.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
629
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
630 override Expression semantic(Scope)
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
631 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
632 if (type)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
633 return e;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
634 switch (specialToken.type)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
635 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
636 case TOK.LINE, TOK.VERSION:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
637 e = new IntExpression(specialToken.uint_, Types.Uint);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
638 break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
639 case TOK.FILE, TOK.DATE, TOK.TIME, TOK.TIMESTAMP, TOK.VENDOR:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
640 e = new StringExpression(specialToken.str);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
641 break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
642 default:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
643 assert(0);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
644 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
645 type = e.type;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
646 return e;
312
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
647 }
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
648 }
fa0b6f32c1ae - Added Special to enum TOK.
aziz
parents: 309
diff changeset
649
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
650 /*
152
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
651 class IdentifierListExpression : Expression
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
652 {
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
653 Expression[] identList;
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
654 this(Expression[] identList)
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
655 {
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
656 this.identList = identList;
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
657 }
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
658 }
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
659 */
488
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
660
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
661 class DotExpression : Expression
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
662 {
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
663 this()
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
664 {
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
665 mixin(set_kind);
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
666 }
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
667 }
cfb3805768b6 Added DotExpression and DotType.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 486
diff changeset
668
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
669 class DotListExpression : Expression
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
670 {
160
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
671 Expression[] items;
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
672 this(Expression[] items)
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
673 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
674 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
675 addChildren(items);
160
c21192e8be2b - Parsing PostDotListExpression in parsePostExpression().
aziz
parents: 157
diff changeset
676 this.items = items;
154
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
677 }
0e7cefb15e43 - Renamed IdentifierListExpression to DotListExpression, and parseIdentifierListExpression() to parseDotListExpression().
aziz
parents: 153
diff changeset
678 }
152
fe2e36eb4b45 - Added method parseIdentifierListExpression() and class IdentifierListExpression.
aziz
parents: 150
diff changeset
679
150
753bc07bf3a0 - Forgot to pass ident to constructor of TemplateArgument.
aziz
parents: 144
diff changeset
680 class TemplateInstanceExpression : Expression
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
681 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
682 Identifier* ident;
150
753bc07bf3a0 - Forgot to pass ident to constructor of TemplateArgument.
aziz
parents: 144
diff changeset
683 TemplateArguments targs;
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
684 this(Identifier* ident, TemplateArguments targs)
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
685 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
686 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
687 addOptChild(targs);
150
753bc07bf3a0 - Forgot to pass ident to constructor of TemplateArgument.
aziz
parents: 144
diff changeset
688 this.ident = ident;
753bc07bf3a0 - Forgot to pass ident to constructor of TemplateArgument.
aziz
parents: 144
diff changeset
689 this.targs = targs;
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
690 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
691 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
692
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
693 class ThisExpression : Expression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
694 {
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
695 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
696 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
697 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
698 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
699 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
700
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
701 class SuperExpression : Expression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
702 {
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
703 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
704 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
705 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
706 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
707 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
708
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
709 class NullExpression : Expression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
710 {
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
711 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
712 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
713 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
714 }
546
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
715
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
716 this(Type type)
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
717 {
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
718 this();
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
719 this.type = type;
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
720 }
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
721
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
722 override Expression semantic(Scope)
546
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
723 {
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
724 if (!type)
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
725 type = Types.Void_ptr;
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
726 return this;
57f5b08b8313 Added semantic() and this() methods to NullExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 542
diff changeset
727 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
728 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
729
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
730 class DollarExpression : Expression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
731 {
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
732 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
733 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
734 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
735 }
557
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
736
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
737 override Expression semantic(Scope scop)
557
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
738 {
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
739 if (type)
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
740 return this;
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
741 type = Types.Size_t;
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
742 // if (!scop.inArraySubscript)
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
743 // error(scop, "$ can only be in an array subscript.");
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
744 return this;
c5a05e70911f Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 547
diff changeset
745 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
746 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
747
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
748 class BoolExpression : Expression
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
749 {
242
7ec7ad8df9da - Changed type of member tok in class BinaryExpression to Token*.
aziz
parents: 240
diff changeset
750 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
751 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
752 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
753 }
547
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
754
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
755 Expression e;
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
756 override Expression semantic(Scope scop)
547
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
757 {
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
758 if (type)
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
759 return this;
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
760 assert(this.begin !is null);
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
761 auto b = (this.begin.type == TOK.True) ? true : false;
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
762 e = new IntExpression(b, Types.Bool);
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
763 type = Types.Bool;
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
764 return this;
a6b43f87ee0c Added semantic() method to BoolExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 546
diff changeset
765 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
766 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
767
399
ff1d11c27061 Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 396
diff changeset
768 class IntExpression : Expression
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
769 {
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
770 ulong number;
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
771
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
772 this(ulong number, Type type)
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
773 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
774 mixin(set_kind);
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
775 this.number = number;
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
776 this.type = type;
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
777 }
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
778
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
779 this(Token* token)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
780 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
781 auto type = Types.Int; // Should be most common case.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
782 switch (token.type)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
783 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
784 // case TOK.Int32:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
785 // type = Types.Int; break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
786 case TOK.Uint32:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
787 type = Types.Uint; break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
788 case TOK.Int64:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
789 type = Types.Long; break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
790 case TOK.Uint64:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
791 type = Types.Ulong; break;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
792 default:
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
793 assert(token.type == TOK.Int32);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
794 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
795 this(token.ulong_, type);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
796 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
797
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
798 override Expression semantic(Scope)
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
799 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
800 if (type)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
801 return this;
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
802
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
803 if (number & 0x8000_0000_0000_0000)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
804 type = Types.Ulong; // 0xFFFF_FFFF_FFFF_FFFF
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
805 else if (number & 0xFFFF_FFFF_0000_0000)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
806 type = Types.Long; // 0x7FFF_FFFF_FFFF_FFFF
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
807 else if (number & 0x8000_0000)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
808 type = Types.Uint; // 0xFFFF_FFFF
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
809 else
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
810 type = Types.Int; // 0x7FFF_FFFF
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
811 return this;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
812 }
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
813 }
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
814
399
ff1d11c27061 Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 396
diff changeset
815 class RealExpression : Expression
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
816 {
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
817 real number;
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
818
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
819 this(real number, Type type)
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
820 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
821 mixin(set_kind);
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
822 this.number = number;
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
823 this.type = type;
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
824 }
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
825
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
826 this(Token* token)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
827 {
540
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
828 auto type = Types.Double; // Most common case?
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
829 switch (token.type)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
830 {
540
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
831 case TOK.Float32:
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
832 type = Types.Float; break;
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
833 // case TOK.Float64:
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
834 // type = Types.Double; break;
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
835 case TOK.Float80:
540
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
836 type = Types.Real; break;
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
837 case TOK.Imaginary32:
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
838 type = Types.Ifloat; break;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
839 case TOK.Imaginary64:
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
840 type = Types.Idouble; break;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
841 case TOK.Imaginary80:
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
842 type = Types.Ireal; break;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
843 default:
540
660684f559a4 Fixed code in RealExpression.semantic().
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 539
diff changeset
844 assert(token.type == TOK.Float64);
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
845 }
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
846 this(token.real_, type);
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
847 }
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
848
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
849 override Expression semantic(Scope)
539
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
850 {
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
851 if (type)
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
852 return this;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
853 type = Types.Double;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
854 return this;
3418027c3914 Added semantic() method to RealExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 537
diff changeset
855 }
97
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
856 }
1a83e5070a84 - Added code for parsing IntNumber- and RealNumberExpressions.
aziz
parents: 94
diff changeset
857
541
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
858 /++
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
859 This expression holds a complex number.
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
860 It is only created in the semantic phase.
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
861 +/
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
862 class ComplexExpression : Expression
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
863 {
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
864 creal number;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
865
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
866 this(creal number, Type type)
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
867 {
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
868 mixin(set_kind);
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
869 this.number = number;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
870 this.type = type;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
871 }
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
872
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
873 override Expression semantic(Scope)
541
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
874 {
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
875 if (type)
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
876 return this;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
877 type = Types.Cdouble;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
878 return this;
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
879 }
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
880 }
c0f5b1f78a55 Added ComplexExpression.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 540
diff changeset
881
399
ff1d11c27061 Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 396
diff changeset
882 class CharExpression : Expression
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
883 {
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
884 dchar character;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
885 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
886 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
887 mixin(set_kind);
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
888 this.character = character;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
889 }
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
890
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
891 override Expression semantic(Scope scop)
536
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
892 {
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
893 if (type)
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
894 return this;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
895 if (character <= 0xFF)
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
896 type = Types.Char;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
897 else if (character <= 0xFFFF)
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
898 type = Types.Wchar;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
899 else
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
900 type = Types.Dchar;
0781ac288537 Added some semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 522
diff changeset
901 return 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
902 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
903 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
904
399
ff1d11c27061 Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 396
diff changeset
905 class StringExpression : Expression
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
906 {
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
907 Token*[] stringTokens;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
908 this()
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
909 { mixin(set_kind); }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
910
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
911 /// Constructor used in parsing phase.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
912 this(Token*[] stringTokens)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
913 {
542
743b0390d20a Fixed StringExpression constructor.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 541
diff changeset
914 this();
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
915 this.stringTokens = stringTokens;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
916 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
917
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
918 ubyte[] str; /// The string data.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
919 Type charType; /// The character type of the string.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
920 // Constructors used in semantic phase.
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
921 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
922 {
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
923 this();
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
924 this.str = str;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
925 this.charType = charType;
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
926 type = new TypeSArray(charType, str.length);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
927 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
928
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
929 this(char[] str)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
930 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
931 this(cast(ubyte[])str, Types.Char);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
932 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
933 this(wchar[] str)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
934 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
935 this(cast(ubyte[])str, Types.Wchar);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
936 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
937 this(dchar[] str)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
938 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
939 this(cast(ubyte[])str, Types.Dchar);
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
940 }
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
941
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
942 override Expression semantic(Scope scop)
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
943 {
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
944 if (type)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
945 return this;
580
fa6d3c52757d Moved SyntaxTree.d to new package 'ast'.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 563
diff changeset
946 return 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
947 }
309
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
948
391
33b566df6af4 Migrated project to Tango.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 377
diff changeset
949 char[] getString()
309
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
950 {
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
951 char[] buffer;
537
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
952 foreach (token; stringTokens)
db7913148b29 Added constructors and semantic() methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 536
diff changeset
953 buffer ~= token.str[0..$-1];
309
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
954 return buffer;
b4d842b0d2c7 - Added new files Settings.d, config.d and lang_en.d
aziz
parents: 305
diff changeset
955 }
84
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
956 }
ac8d961d10d1 - Added code for parsing This-,Super-,Null-,Bool-,Dollar-,CharLiteral- and StringLiteralExpression.
aziz
parents: 83
diff changeset
957
85
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
958 class ArrayLiteralExpression : Expression
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
959 {
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
960 Expression[] values;
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
961 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
962 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
963 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
964 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
965 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
966 }
85
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
967 }
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
968
399
ff1d11c27061 Renamed some Expression classes.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 396
diff changeset
969 class AArrayLiteralExpression : Expression
85
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
970 {
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
971 Expression[] keys, values;
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
972 this(Expression[] keys, Expression[] values)
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
973 {
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
974 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
975 mixin(set_kind);
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
976 foreach (i, key; keys)
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
977 addChildren([key, values[i]]);
85
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
978 this.keys = keys;
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
979 this.values = values;
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
980 }
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
981 }
d8dc3171440d - Fixed parsing CallExpression and IndexExpression.
aziz
parents: 84
diff changeset
982
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
983 class AssertExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
984 {
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
985 Expression expr, msg;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
986 this(Expression expr, Expression msg)
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
987 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
988 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
989 addChild(expr);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
990 addOptChild(msg);
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
991 this.expr = expr;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
992 this.msg = msg;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
993 }
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
994 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
995
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
996 class MixinExpression : Expression
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
997 {
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
998 Expression expr;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
999 this(Expression expr)
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1000 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1001 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1002 addChild(expr);
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1003 this.expr = expr;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1004 }
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1005
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1006 // import dil.Parser;
563
c838ed7f2ac9 Added 'override' to some methods.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 559
diff changeset
1007 override Expression semantic(Scope scop)
490
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1008 {
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1009 // TODO:
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1010 /+
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1011 auto expr = this.expr.semantic(scop);
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1012 auto strExpr = Cast!(StringExpression)(expr);
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1013 // if (strExpr is null)
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1014 // error(scop, MID.MixinExpressionMustBeString);
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1015 auto parser = new Parser(strExpr.getString(), "", scop.infoMan);
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1016 expr = parser.start2();
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1017 return expr;
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1018 +/
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1019 return null;
47be6bfe39cd Refactored code and added new modules.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 489
diff changeset
1020 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1021 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1022
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1023 class ImportExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1024 {
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1025 Expression expr;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1026 this(Expression expr)
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1027 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1028 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1029 addChild(expr);
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1030 this.expr = expr;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1031 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1032 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1033
101
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1034 class TypeofExpression : Expression
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1035 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1036 TypeNode type;
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1037 this(TypeNode type)
101
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1038 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1039 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1040 addChild(type);
101
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1041 this.type = type;
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1042 }
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1043 }
6f3c5473c5e5 - Implemented parsing TypeofExpression.
aziz
parents: 100
diff changeset
1044
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1045 class TypeDotIdExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1046 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1047 TypeNode type;
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
1048 Identifier* ident;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1049 this(TypeNode type, Identifier* ident)
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1050 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1051 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1052 addChild(type);
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1053 this.type = type;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1054 this.ident = ident;
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1055 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1056 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1057
86
0459c902a370 - Added code for parsing Assert-, Mixin-, Import-, Typeid- and TypeDotIdExpressions.
aziz
parents: 85
diff changeset
1058 class TypeidExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1059 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1060 TypeNode type;
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1061 this(TypeNode type)
99
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
1062 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1063 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1064 addChild(type);
99
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
1065 this.type = type;
6b8c248f5911 - Added member type to classes CastExpression and TypeidExpression.
aziz
parents: 97
diff changeset
1066 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1067 }
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1068
89
18c71269fb52 - Added code for parsing IdentifierExpression.
aziz
parents: 86
diff changeset
1069 class IsExpression : Expression
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1070 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1071 TypeNode type;
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
1072 Identifier* ident;
248
63a15b082c0c - Removed class SpecializationType.
aziz
parents: 243
diff changeset
1073 Token* opTok, specTok;
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1074 TypeNode specType;
377
906599374b69 - Added tparams member to IsExpression.
aziz
parents: 376
diff changeset
1075 TemplateParameters tparams; // D 2.0
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1076 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
1077 TypeNode specType, typeof(tparams) tparams)
100
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 99
diff changeset
1078 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1079 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1080 addChild(type);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1081 addOptChild(specType);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1082 version(D2)
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1083 addOptChild(tparams);
100
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 99
diff changeset
1084 this.type = type;
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 99
diff changeset
1085 this.ident = ident;
248
63a15b082c0c - Removed class SpecializationType.
aziz
parents: 243
diff changeset
1086 this.opTok = opTok;
63a15b082c0c - Removed class SpecializationType.
aziz
parents: 243
diff changeset
1087 this.specTok = specTok;
100
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 99
diff changeset
1088 this.specType = specType;
377
906599374b69 - Added tparams member to IsExpression.
aziz
parents: 376
diff changeset
1089 this.tparams = tparams;
100
538e8b546669 - Added code for parsing IsExpressions.
aziz
parents: 99
diff changeset
1090 }
70
0d3ef6daec04 - Added Expression class stubs.
aziz
parents:
diff changeset
1091 }
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1092
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1093 class FunctionLiteralExpression : Expression
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1094 {
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1095 TypeNode returnType;
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1096 Parameters parameters;
193
2a2975b6d539 - Using parseFunctionBody() when parsing FunctionLiteralExpression.
aziz
parents: 160
diff changeset
1097 FunctionBody funcBody;
133
3924b1ee1302 - Added code for parsing function and delegate literal expressions.
aziz
parents: 130
diff changeset
1098
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1099 this()
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1100 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1101 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1102 addOptChild(returnType);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1103 addOptChild(parameters);
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1104 addChild(funcBody);
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1105 }
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1106
511
aa73f669c298 Renamed class Type to TypeNode.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 505
diff changeset
1107 this(TypeNode returnType, Parameters parameters, FunctionBody funcBody)
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1108 {
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1109 this.returnType = returnType;
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1110 this.parameters = parameters;
193
2a2975b6d539 - Using parseFunctionBody() when parsing FunctionLiteralExpression.
aziz
parents: 160
diff changeset
1111 this.funcBody = funcBody;
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
1112 this();
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1113 }
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1114
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1115 this(FunctionBody funcBody)
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1116 {
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
1117 this.funcBody = funcBody;
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1118 this();
130
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1119 }
0467f01ed524 - Fix: parameters can have optional identifier.
aziz
parents: 108
diff changeset
1120 }
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1121
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1122 version(D2)
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1123 {
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1124 class TraitsExpression : Expression
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1125 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
1126 Identifier* ident;
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1127 TemplateArguments targs;
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1128 this(typeof(ident) ident, typeof(targs) targs)
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1129 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1130 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1131 addOptChild(targs);
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1132 this.ident = ident;
289
a99357783c6f - Fix: assign targs to member targs of TraitsExpression.
aziz
parents: 288
diff changeset
1133 this.targs = targs;
269
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1134 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1135 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1136 }
a416e09c08ea - Implemented D 2.0 additions.
aziz
parents: 263
diff changeset
1137
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1138 class VoidInitializer : Expression
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1139 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1140 this()
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1141 {
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1142 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
1143 }
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1144 }
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1145
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1146 class ArrayInitializer : Expression
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1147 {
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1148 Expression[] keys;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1149 Expression[] values;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1150 this(Expression[] keys, Expression[] values)
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1151 {
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
1152 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
1153 mixin(set_kind);
293
418c6548ce17 - Assigning to Node.children in several constructors that inherit from Node.
aziz
parents: 289
diff changeset
1154 foreach (i, key; keys)
299
559d5d62e0c1 - Added checks for null before adding member to Node.children.
aziz
parents: 293
diff changeset
1155 {
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1156 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
1157 addChild(values[i]);
299
559d5d62e0c1 - Added checks for null before adding member to Node.children.
aziz
parents: 293
diff changeset
1158 }
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1159 this.keys = keys;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1160 this.values = values;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1161 }
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1162 }
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1163
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1164 class StructInitializer : Expression
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1165 {
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
1166 Identifier*[] idents;
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1167 Expression[] values;
505
3bb94ba21490 Refactored a great amount of code.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 502
diff changeset
1168 this(Identifier*[] idents, Expression[] values)
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1169 {
276
d6b2f7616ca5 - Added enum NodeKind to classify different nodes in the AST. Correspondingly added member 'kind' to class Node.
aziz
parents: 275
diff changeset
1170 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1171 addOptChildren(values);
198
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1172 this.idents = idents;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1173 this.values = values;
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1174 }
88c1777a9e51 - Implemented parseInitializer() and parseNonVoidInitializer().
aziz
parents: 193
diff changeset
1175 }
287
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1176
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1177 class AsmTypeExpression : UnaryExpression
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1178 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1179 this(Expression e)
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1180 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1181 super(e);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1182 mixin(set_kind);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1183 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1184 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1185
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1186 class AsmOffsetExpression : UnaryExpression
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1187 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1188 this(Expression e)
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1189 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1190 super(e);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1191 mixin(set_kind);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1192 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1193 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1194
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1195 class AsmSegExpression : UnaryExpression
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1196 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1197 this(Expression e)
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1198 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1199 super(e);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1200 mixin(set_kind);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1201 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1202 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1203
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1204 class AsmPostBracketExpression : UnaryExpression
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1205 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1206 this(Expression e)
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1207 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1208 super(e);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1209 mixin(set_kind);
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1210 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1211 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1212
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1213 class AsmBracketExpression : Expression
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1214 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1215 Expression e;
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1216 this(Expression e)
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1217 {
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1218 mixin(set_kind);
489
a7291d3ee9d7 Refactored classes that inherit from Node.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 488
diff changeset
1219 addChild(e);
287
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1220 this.e = e;
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1221 }
211bdd69397d - Added classes AsmTypeExpression, AsmOffsetExpression, AsmSegExpression, AsmPostBracketExpression and AsmBracketExpression.
aziz
parents: 286
diff changeset
1222 }
288
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1223
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1224 class AsmLocalSizeExpression : Expression
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1225 {
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1226 this()
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1227 {
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1228 mixin(set_kind);
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1229 }
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1230 }
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1231
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1232 class AsmRegisterExpression : Expression
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1233 {
502
4e14cd1b24da Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
1234 Identifier* register;
4e14cd1b24da Refactored code and added modules related to tabulated Identifiers.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 490
diff changeset
1235 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
1236 this(Identifier* register, int number = -1)
288
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1237 {
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1238 mixin(set_kind);
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1239 this.register = register;
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1240 this.number = number;
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1241 }
833b301497f4 - Added classes AsmLocalSizeExpression and AsmRegisterExpression.
aziz
parents: 287
diff changeset
1242 }