129 } |
129 } |
130 |
130 |
131 var_type_symbol->accept(*this); |
131 var_type_symbol->accept(*this); |
132 |
132 |
133 if (this->current_var_type_symbol == NULL) |
133 if (this->current_var_type_symbol == NULL) |
134 this->current_var_type_symbol = var_type_symbol; |
134 this->current_var_type_symbol = var_type_symbol; |
135 |
135 |
136 return (this->current_var_type_symbol); |
136 return (this->current_var_type_symbol); |
137 } |
137 } |
138 |
138 |
139 symbol_c *get_current_type_name(void) { |
139 symbol_c *get_current_type_name(void) { |
140 if (this->current_var_type_name == NULL) |
140 if (this->current_var_type_name == NULL) |
141 return (this->current_var_type_symbol); |
141 return (this->current_var_type_symbol); |
142 |
142 |
143 return (this->current_var_type_name); |
143 return (this->current_var_type_name); |
144 } |
144 } |
145 |
145 |
146 void *visit(identifier_c* symbol) { |
146 void *visit(identifier_c* symbol) { |
326 switch (search_type_symbol->current_var_type_category) { |
325 switch (search_type_symbol->current_var_type_category) { |
327 case search_type_symbol_c::structure_vtc: |
326 case search_type_symbol_c::structure_vtc: |
328 case search_type_symbol_c::function_block_vtc: |
327 case search_type_symbol_c::function_block_vtc: |
329 this->current_var_type_name->accept(*this); |
328 this->current_var_type_name->accept(*this); |
330 s4o.print(";\n"); |
329 s4o.print(";\n"); |
331 SYMBOL *current_name; |
330 if (this->current_var_class_category != external_vcc) { |
332 symbol_c *tmp_var_type; |
331 SYMBOL *current_name; |
333 current_name = new SYMBOL; |
332 symbol_c *tmp_var_type; |
334 current_name->symbol = symbol; |
333 current_name = new SYMBOL; |
335 tmp_var_type = this->current_var_type_symbol; |
334 current_name->symbol = symbol; |
336 current_symbol_list.push_back(*current_name); |
335 tmp_var_type = this->current_var_type_symbol; |
337 this->current_var_type_symbol->accept(*this); |
336 current_symbol_list.push_back(*current_name); |
338 current_symbol_list.pop_back(); |
337 this->current_var_type_symbol->accept(*this); |
339 this->current_var_type_symbol = tmp_var_type; |
338 current_symbol_list.pop_back(); |
|
339 this->current_var_type_symbol = tmp_var_type; |
|
340 } |
340 break; |
341 break; |
341 case search_type_symbol_c::array_vtc: |
342 case search_type_symbol_c::array_vtc: |
342 this->current_var_type_name->accept(*this); |
343 this->current_var_type_name->accept(*this); |
343 s4o.print(";\n"); |
344 s4o.print(";\n"); |
344 break; |
345 break; |
372 char str[10]; |
373 char str[10]; |
373 sprintf(str, "%d", action_number); |
374 sprintf(str, "%d", action_number); |
374 s4o.print(str); |
375 s4o.print(str); |
375 } |
376 } |
376 |
377 |
377 void print_symbol_list(void) { |
378 void print_symbol_list() { |
378 std::list<SYMBOL>::iterator pt; |
379 std::list<SYMBOL>::iterator pt; |
379 for(pt = current_symbol_list.begin(); pt != current_symbol_list.end(); pt++) { |
380 for(pt = current_symbol_list.begin(); pt != current_symbol_list.end(); pt++) { |
380 pt->symbol->accept(*this); |
381 pt->symbol->accept(*this); |
381 s4o.print("."); |
382 s4o.print("."); |
382 } |
383 } |
677 |
678 |
678 /*| global_var_name location */ |
679 /*| global_var_name location */ |
679 // SYM_REF2(global_var_spec_c, global_var_name, location) |
680 // SYM_REF2(global_var_spec_c, global_var_name, location) |
680 void *visit(global_var_spec_c *symbol) { |
681 void *visit(global_var_spec_c *symbol) { |
681 search_location_type_c search_location_type; |
682 search_location_type_c search_location_type; |
682 switch (search_location_type.get_location_type(symbol->location)) { |
683 switch (search_location_type.get_location_type(symbol->location)) { |
683 case search_location_type_c::input_lt: |
684 case search_location_type_c::input_lt: |
684 this->current_var_class_category = located_input_vcc; |
685 this->current_var_class_category = located_input_vcc; |
685 break; |
686 break; |
686 case search_location_type_c::memory_lt: |
687 case search_location_type_c::memory_lt: |
687 this->current_var_class_category = located_memory_vcc; |
688 this->current_var_class_category = located_memory_vcc; |
688 break; |
689 break; |
689 case search_location_type_c::output_lt: |
690 case search_location_type_c::output_lt: |
690 this->current_var_class_category = located_output_vcc; |
691 this->current_var_class_category = located_output_vcc; |
691 break; |
692 break; |
692 default: |
693 default: |
693 ERROR; |
694 ERROR; |
694 break; |
695 break; |
695 } |
696 } |
696 |
697 |
697 if (symbol->global_var_name != NULL) |
698 if (symbol->global_var_name != NULL) |
698 declare_variable(symbol->global_var_name); |
699 declare_variable(symbol->global_var_name); |
699 else |
700 else |
700 declare_variable(symbol->location); |
701 declare_variable(symbol->location); |