stage1_2/iec_bison.yy
changeset 746 c7219a37cc39
parent 745 26cb3fa00d29
child 747 d1c1a0254e4f
equal deleted inserted replaced
745:26cb3fa00d29 746:c7219a37cc39
   200 
   200 
   201 /* A global flag used to tell the parser whether to include the full variable location
   201 /* A global flag used to tell the parser whether to include the full variable location
   202  * when printing out error messages...
   202  * when printing out error messages...
   203  */
   203  */
   204 extern bool full_token_loc;
   204 extern bool full_token_loc;
       
   205 
       
   206 /* A global flag used to tell the parser whether to generate conversion function
       
   207  * for enumerated data types.
       
   208  */
       
   209 extern bool conversion_functions_;
   205 
   210 
   206 /* A pointer to the root of the parsing tree that will be generated 
   211 /* A pointer to the root of the parsing tree that will be generated 
   207  * by bison.
   212  * by bison.
   208  */
   213  */
   209 extern symbol_c *tree_root;
   214 extern symbol_c *tree_root;
  2707  *       and include the library_element_symtable.insert(...) code in the rule actions!
  2712  *       and include the library_element_symtable.insert(...) code in the rule actions!
  2708  */
  2713  */
  2709   identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);}
  2714   identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);}
  2710 	{
  2715 	{
  2711       $$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, NULL, locloc(@3)), locloc(@$));
  2716       $$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, NULL, locloc(@3)), locloc(@$));
  2712       const char *name = ((identifier_c *)$1)->value;
  2717       if (conversion_functions_) {
  2713 	  make_derived_conversion_functions(name);
  2718         const char *name = ((identifier_c *)$1)->value;
       
  2719 	    make_derived_conversion_functions(name);
       
  2720 	  }
  2714     }
  2721     }
  2715 | identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} ASSIGN enumerated_value
  2722 | identifier ':' enumerated_specification {library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);} ASSIGN enumerated_value
  2716 	{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));}
  2723 	{$$ = new enumerated_type_declaration_c($1, new enumerated_spec_init_c($3, $6, locf(@3), locl(@6)), locloc(@$));}
  2717 /* ERROR_CHECK_BEGIN */
  2724 /* ERROR_CHECK_BEGIN */
  2718 | error ':' enumerated_spec_init
  2725 | error ':' enumerated_spec_init