225 void *visit(array_spec_init_c *symbol) { |
225 void *visit(array_spec_init_c *symbol) { |
226 return handle_type_spec(symbol->array_specification, symbol->array_initialization); |
226 return handle_type_spec(symbol->array_specification, symbol->array_initialization); |
227 } |
227 } |
228 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
228 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
229 void *visit(array_specification_c *symbol) { |
229 void *visit(array_specification_c *symbol) { |
230 symbol_c *init_value = (symbol_c *)symbol->non_generic_type_name->accept(*this); |
230 //symbol_c *init_value = (symbol_c *)symbol->non_generic_type_name->accept(*this); |
231 |
231 |
232 /* Now build a array_initial_elements_list_c list, and populate it |
232 /* Now build a array_initial_elements_list_c list, and populate it |
233 * with 1 element of the array_initial_elements_c class |
233 * with 1 element of the array_initial_elements_c class |
234 */ |
234 */ |
235 /* The array_initial_elements_c will contain a reference to the init_value, |
235 /* The array_initial_elements_c will contain a reference to the init_value, |
248 /* For now, just assume an array with 1 element. |
248 /* For now, just assume an array with 1 element. |
249 * I (Mario) want to finish off this part of the code before getting boged down |
249 * I (Mario) want to finish off this part of the code before getting boged down |
250 * in something else... |
250 * in something else... |
251 */ |
251 */ |
252 // NOTE: We are leaking memory, as the integer will never get free'd!! |
252 // NOTE: We are leaking memory, as the integer will never get free'd!! |
253 integer_c *integer = new integer_c("1"); |
253 //integer_c *integer = new integer_c("1"); |
254 // NOTE: We are leaking memory, as the array_initial_elements will never get free'd!! |
254 // NOTE: We are leaking memory, as the array_initial_elements will never get free'd!! |
255 array_initial_elements_c *array_initial_elements = new array_initial_elements_c(integer, init_value); |
255 //array_initial_elements_c *array_initial_elements = new array_initial_elements_c(integer, init_value); |
256 // NOTE: We are leaking memory, as the array_initial_elements_list will never get free'd!! |
256 // NOTE: We are leaking memory, as the array_initial_elements_list will never get free'd!! |
257 array_initial_elements_list_c *array_initial_elements_list = new array_initial_elements_list_c(); |
257 array_initial_elements_list_c *array_initial_elements_list = new array_initial_elements_list_c(); |
258 array_initial_elements_list->add_element(array_initial_elements); |
258 //array_initial_elements_list->add_element(array_initial_elements); |
259 return array_initial_elements_list; |
259 return array_initial_elements_list; |
260 } |
260 } |
261 /* helper symbol for array_specification */ |
261 /* helper symbol for array_specification */ |
262 /* array_subrange_list ',' subrange */ |
262 /* array_subrange_list ',' subrange */ |
263 void *visit(array_subrange_list_c *symbol) {ERROR; return NULL;} |
263 void *visit(array_subrange_list_c *symbol) {ERROR; return NULL;} |
275 |
275 |
276 /* structure_type_name ':' structure_specification */ |
276 /* structure_type_name ':' structure_specification */ |
277 void *visit(structure_type_declaration_c *symbol) {return NULL;} |
277 void *visit(structure_type_declaration_c *symbol) {return NULL;} |
278 /* structure_type_name ASSIGN structure_initialization */ |
278 /* structure_type_name ASSIGN structure_initialization */ |
279 /* structure_initialization may be NULL ! */ |
279 /* structure_initialization may be NULL ! */ |
280 void *visit(initialized_structure_c *symbol) {return NULL;} |
280 void *visit(initialized_structure_c *symbol) { |
|
281 return handle_type_spec(symbol->structure_type_name, symbol->structure_initialization); |
|
282 } |
281 /* helper symbol for structure_declaration */ |
283 /* helper symbol for structure_declaration */ |
282 /* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
284 /* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
283 /* structure_element_declaration_list structure_element_declaration ';' */ |
285 /* structure_element_declaration_list structure_element_declaration ';' */ |
284 void *visit(structure_element_declaration_list_c *symbol) {return NULL;} |
286 void *visit(structure_element_declaration_list_c *symbol) { |
|
287 structure_element_initialization_list_c *structure_element_initialization_list = new structure_element_initialization_list_c(); |
|
288 return structure_element_initialization_list; |
|
289 } |
285 /* structure_element_name ':' *_spec_init */ |
290 /* structure_element_name ':' *_spec_init */ |
286 void *visit(structure_element_declaration_c *symbol) {return NULL;} |
291 void *visit(structure_element_declaration_c *symbol) {return NULL;} |
287 /* helper symbol for structure_initialization */ |
292 /* helper symbol for structure_initialization */ |
288 /* structure_initialization: '(' structure_element_initialization_list ')' */ |
293 /* structure_initialization: '(' structure_element_initialization_list ')' */ |
289 /* structure_element_initialization_list ',' structure_element_initialization */ |
294 /* structure_element_initialization_list ',' structure_element_initialization */ |