Mercurial > projects > dang
annotate parser/Action.d @ 114:3a0cd42de9cc
Removed misc/Error.d and is now using the error system all way through.
author | Anders Johnsen <skabet@gmail.com> |
---|---|
date | Sun, 25 May 2008 16:40:38 +0200 |
parents | 7ff4bc2accf2 |
children | 6a5f745d351c |
rev | line source |
---|---|
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
1 module parser.Action; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
2 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
3 import lexer.Token; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
4 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
5 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
6 Used to indicate what type of operator is used in a given binary expression |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
7 (and unary expressions?) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
8 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
9 public enum Operator |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
10 { |
48
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
11 Assign, |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
12 |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
13 Eq, Ne, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
14 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
15 Lt, Le, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
16 Gt, Ge, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
17 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
18 Add, Sub, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
19 Mul, Div, Mod, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
20 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
21 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
22 |
75 | 23 class Id |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
24 { |
75 | 25 public static Id opCall(Token tok) |
26 { | |
27 auto id = new Id(); | |
28 id.tok = tok; | |
29 return id; | |
30 } | |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
31 Token tok; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
32 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
33 |
75 | 34 class PointerId : Id |
35 { | |
36 public static PointerId opCall(Id id) | |
37 { | |
38 auto p = new PointerId(); | |
39 p.id = id; | |
40 return p; | |
41 } | |
42 | |
43 Id id; | |
44 } | |
45 | |
81 | 46 class ArrayId : Id |
47 { | |
48 public static ArrayId opCall(Id id, Object number) | |
49 { | |
50 auto a = new ArrayId(); | |
51 a.id = id; | |
52 a.number = number; | |
53 return a; | |
54 } | |
55 | |
56 Id id; | |
57 Object number; | |
58 } | |
59 | |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
60 /** |
99
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
61 Represents a fully qualified name, with some packages and a final identifier. |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
62 The identifier should always be set, but packages may have length 0. |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
63 **/ |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
64 struct ModuleName |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
65 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
66 Id id; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
67 Id[] packages; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
68 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
69 /// Get the full ranged spanned by packages and identifier |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
70 SourceRange asRange() |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
71 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
72 SourceRange r = id.tok.asRange(); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
73 foreach (identifier; packages) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
74 r = r + identifier.tok.asRange(); |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
75 return r; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
76 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
77 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
78 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
79 /** |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
80 All methods are optional. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
81 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
82 Warning: Interface is not stable yet. Use the `override` keyword in all classes |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
83 inheriting from this to get warning if the interface changes. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
84 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
85 abstract class Action |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
86 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
87 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
88 A few aliases to indicate what methods should be dealing with the same |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
89 types. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
90 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
91 Not typesafe, and not using typedef because users would need a lot of |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
92 casts (and base type would be void*, so no possibility to synchronize, |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
93 print etc.) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
94 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
95 alias Object ExprT; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
96 alias Object StmtT; /// ditto |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
97 alias Object DeclT; /// ditto |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
98 alias Object ModuleT; /// ditto |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
99 |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
100 // -- Modules -- |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
101 |
99
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
102 ModuleT actOnModule(ref Token _module, char[] name) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
103 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
104 return null; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
105 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
106 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
107 /** |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
108 This action is called when a file does not start with a module |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
109 declaration - in which case there is no Token available. |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
110 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
111 Instead a SLoc to the start of the file is given. |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
112 */ |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
113 ModuleT actOnImplicitModule(SourceLocation fileStart, char[] name) |
94
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
114 { |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
115 return null; |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
116 } |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
117 |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
118 void actOnModuleDecl(ModuleT m, DeclT d) |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
119 { |
48bb2287c035
Added Modules. Right now it's very simple - will grow with time and need.
Anders Johnsen <skabet@gmail.com>
parents:
88
diff
changeset
|
120 } |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
121 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
122 // -- Declarations -- |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
123 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
124 /** |
99
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
125 Called for an import statement, that may be renamed. Id name is null, |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
126 there is no rename. |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
127 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
128 If there are selective imports, its handled in add |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
129 */ |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
130 DeclT actOnImport(ref Token _import, ref ModuleName target, Id* name) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
131 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
132 return null; |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
133 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
134 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
135 /** |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
136 */ |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
137 void addSelectiveImport(DeclT _import, ref Id target, Id* name) |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
138 { |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
139 } |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
140 |
857f0d530789
Imports and improved module statement
Anders Halager <halager@gmail.com>
parents:
94
diff
changeset
|
141 /** |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
142 Either we should have one case that handles a lot of things, or we should |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
143 have a lot of separate cases. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
144 As an example, this method could handle the params in `int f(int, int)` |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
145 as well as handling `int x` at both top-level, in classes and in methods. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
146 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
147 The other solution is an addParamToFunc or similar. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
148 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
149 DeclT actOnDeclarator(ref Id type, ref Id name, ExprT init) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
150 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
151 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
152 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
153 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
154 /** |
53
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
155 Add a struct member to a struct. |
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
156 */ |
102
cd066f3b539a
Parsing methods in structs - error on semantics though.
Anders Johnsen <skabet@gmail.com>
parents:
99
diff
changeset
|
157 void actOnStructMember(DeclT st_decl, DeclT m_decl) //ref Id type, ref Id name, ExprT init) |
53
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
158 { |
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
159 return null; |
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
160 } |
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
161 |
da551f90e03f
Added struct decl and forward ref. A note on structs: they need to make a new scope when declared. Otherwise you could access struct members as globals
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
162 /** |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
163 Add an initialization expression to a previously created decl. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
164 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
165 Used for default values on function params and for values to local |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
166 variables. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
167 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
168 void addInitToDeclarator(DeclT decl, ExprT exp) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
169 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
170 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
171 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
172 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
173 Called at the start of a function, doesn't get a lot of info - that is |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
174 added later on, through addFuncArg and actOnEndOfFunction. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
175 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
176 DeclT actOnStartOfFunctionDef(ref Id type, ref Id name) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
177 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
178 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
179 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
180 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
181 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
182 Add a new parameter to the function func. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
183 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
184 void addFuncArg(DeclT func, Id type, Id name) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
185 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
186 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
187 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
188 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
189 Finish off the function, by giving it the body (a single statement, so |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
190 you probably want some sort of compound statement) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
191 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
192 DeclT actOnEndOfFunction(DeclT func, StmtT stmts) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
193 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
194 return func; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
195 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
196 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
197 // -- Statements -- |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
198 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
199 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
200 Called after parsing a function/while/for/whatever body. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
201 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
202 Note that stmts is to be considered temporary, it might point into the |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
203 stack and needs to be copied before saving. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
204 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
205 StmtT actOnCompoundStmt(ref Token left, ref Token right, StmtT[] stmts) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
206 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
207 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
208 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
209 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
210 /** |
48
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
211 An expression was used as a statement - this includes assignments, |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
212 function calls. |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
213 |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
214 Additionally the D spec dictates that expressions with no effect are not |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
215 legal as statements, but the parser can't test for this so it has to be |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
216 done in the later stages. |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
217 */ |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
218 StmtT actOnExprStmt(ExprT exp) |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
219 { |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
220 return null; |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
221 } |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
222 |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
223 /** |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
224 Called after parsing return statements. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
225 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
226 loc is the return token. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
227 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
228 StmtT actOnReturnStmt(ref Token loc, ExprT exp) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
229 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
230 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
231 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
232 |
45 | 233 /** |
234 */ | |
235 StmtT actOnIfStmt(ref Token ifTok, ExprT cond, StmtT thenBody, | |
236 ref Token elseTok, StmtT elseBody) | |
237 { | |
238 return null; | |
239 } | |
240 | |
46 | 241 /** |
242 */ | |
243 StmtT actOnWhileStmt(ref Token whileTok, ExprT cond, StmtT whileBody) | |
244 { | |
245 return null; | |
246 } | |
247 | |
48
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
248 /** |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
249 */ |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
250 StmtT actOnDeclStmt(DeclT decl) |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
251 { |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
252 return null; |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
253 } |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
254 |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
255 StmtT actOnStartOfSwitchStmt() |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
256 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
257 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
258 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
259 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
260 void actOnCaseStmt() |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
261 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
262 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
263 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
264 void actOnDefaultStmt() |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
265 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
266 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
267 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
268 StmtT actOnFinishSwitchStmt(StmtT sw) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
269 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
270 return sw; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
271 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
272 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
273 // -- Expressions -- |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
274 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
275 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
276 A single numerical constant -- this can be absolutely any kind of number. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
277 Integers, floats, hex, octal, binary, imaginary and so on. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
278 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
279 ExprT actOnNumericConstant(Token op) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
280 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
281 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
282 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
283 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
284 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
285 This is called when identifiers are used in expressions. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
286 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
287 ExprT actOnIdentifierExp(Id id) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
288 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
289 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
290 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
291 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
292 /** |
104
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
293 This is called when strings are used in expression |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
294 */ |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
295 ExprT actOnStringExp(Token t) |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
296 { |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
297 return null; |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
298 } |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
299 |
7ff4bc2accf2
Lexing more types of strings. Now all's left is to parse the string in the AST.
Anders Johnsen <skabet@gmail.com>
parents:
102
diff
changeset
|
300 /** |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
301 Unary operator. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
302 */ |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
303 ExprT actOnUnaryOp(Token op, ExprT operand) |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
304 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
305 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
306 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
307 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
308 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
309 Binary operator. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
310 */ |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
83
diff
changeset
|
311 ExprT actOnBinaryOp(SLoc op_loc, Operator op, ExprT l, ExprT r) |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
312 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
313 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
314 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
315 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
316 /** |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
317 Called when using the 'dot' operator. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
318 The left hand side can be any expression, but its only possible to look |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
319 up an identifier. |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
320 */ |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
83
diff
changeset
|
321 ExprT actOnMemberReference(ExprT lhs, SourceLocation op, Id member) |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
322 { |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
323 return null; |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
324 } |
48
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
325 |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
326 /** |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
327 Called when function calls are encountered. |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
328 |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
329 Note that args is temporary and might point into the stack. Remember to |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
330 copy before saving a reference to it. |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
331 */ |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
332 ExprT actOnCallExpr(ExprT func, ref Token left_paren, ExprT[] args, |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
333 ref Token right_paren) |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
334 { |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
335 return null; |
b6c1dc30ca4b
Only tests that dont pass now are structs and switches
Anders Halager <halager@gmail.com>
parents:
46
diff
changeset
|
336 } |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
337 |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
338 /** |
83
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
339 Called when function calls are encountered. |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
340 */ |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
341 ExprT actOnIndexEpr(ExprT array, ref Token left_bracket, ExprT index, |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
342 ref Token right_bracket) |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
343 { |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
344 return null; |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
345 } |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
346 |
9e90694f5da0
Parse array indexing, and allow reading from arrays
Anders Halager <halager@gmail.com>
parents:
81
diff
changeset
|
347 /** |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
348 Cast expression. |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
349 */ |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
83
diff
changeset
|
350 ExprT actOnCastExpr(ref Token _cast, Id type, ExprT exp) |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
351 { |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
352 return null; |
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
53
diff
changeset
|
353 } |
44
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
354 } |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
355 |
495188f9078e
Big update - Moving towards a better, more seperated parser
Anders Halager <halager@gmail.com>
parents:
diff
changeset
|
356 /** |
49
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
357 Doesn't do anything at all - can be used for benchmarking the parser. |
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
358 */ |
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
359 class NullAction : Action |
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
360 { |
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
361 } |
c7cde6af0095
Seperated the AST from LLVM
Anders Halager <halager@gmail.com>
parents:
48
diff
changeset
|
362 |