annotate trunk/src/dil/ast/Expressions.d @ 618:07946b379006

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