equal
deleted
inserted
replaced
139 } |
139 } |
140 |
140 |
141 |
141 |
142 |
142 |
143 |
143 |
144 |
144 /*************************/ |
|
145 /* B.1 - Common elements */ |
|
146 /*************************/ |
|
147 /*******************************************/ |
|
148 /* B 1.1 - Letters, digits and identifiers */ |
|
149 /*******************************************/ |
|
150 // SYM_TOKEN(identifier_c) |
|
151 void *search_varfb_instance_type_c::visit(identifier_c *variable_name) { |
|
152 /* symbol should be a variable name!! */ |
|
153 /* Note: although the method is called get_decl(), it is getting the declaration of the variable, which for us is the type_id of that variable! */ |
|
154 current_type_id = search_var_instance_decl.get_decl (variable_name); |
|
155 current_basetype_decl = search_base_type.get_basetype_decl(current_type_id); |
|
156 current_basetype_id = search_base_type.get_basetype_id (current_type_id); |
|
157 |
|
158 /* What if the variable has not been declared? Then this should not be a compiler error! |
|
159 * However, currently stage 2 of the compiler already detects when variables have not been delcared, |
|
160 * so if the variable's declaration is not found, then that means that we have an internal compiler error! |
|
161 */ |
|
162 if (NULL == current_type_id) ERROR; |
|
163 |
|
164 return NULL; |
|
165 } |
145 |
166 |
146 |
167 |
147 |
168 |
148 |
169 |
149 |
170 |
267 /*********************/ |
288 /*********************/ |
268 /* B 1.4 - Variables */ |
289 /* B 1.4 - Variables */ |
269 /*********************/ |
290 /*********************/ |
270 // SYM_REF1(symbolic_variable_c, var_name) |
291 // SYM_REF1(symbolic_variable_c, var_name) |
271 void *search_varfb_instance_type_c::visit(symbolic_variable_c *symbol) { |
292 void *search_varfb_instance_type_c::visit(symbolic_variable_c *symbol) { |
272 /* Note: although the method is called get_decl(), it is getting the declaration of the variable, which for us is the type_id of that variable! */ |
293 symbol->var_name->accept(*this); |
273 current_type_id = search_var_instance_decl.get_decl (symbol->var_name); |
|
274 current_basetype_decl = search_base_type.get_basetype_decl(current_type_id); |
|
275 current_basetype_id = search_base_type.get_basetype_id (current_type_id); |
|
276 |
|
277 if (NULL == current_type_id) ERROR; /* why should this be an error? what if the variable has not been declared? */ |
|
278 |
|
279 return NULL; |
294 return NULL; |
280 } |
295 } |
281 |
296 |
282 /********************************************/ |
297 /********************************************/ |
283 /* B.1.4.1 Directly Represented Variables */ |
298 /* B.1.4.1 Directly Represented Variables */ |