737 |
737 |
738 %type <leaf> subrange_type_declaration |
738 %type <leaf> subrange_type_declaration |
739 %type <leaf> subrange_spec_init |
739 %type <leaf> subrange_spec_init |
740 %type <leaf> subrange_specification |
740 %type <leaf> subrange_specification |
741 %type <leaf> subrange |
741 %type <leaf> subrange |
|
742 /* A non standard construct, used to support the use of variables in array subranges. e.g.: ARRAY [12..max] OF INT */ |
|
743 %type <leaf> subrange_with_var |
742 |
744 |
743 %type <leaf> enumerated_type_declaration |
745 %type <leaf> enumerated_type_declaration |
744 %type <leaf> enumerated_spec_init |
746 %type <leaf> enumerated_spec_init |
745 %type <leaf> enumerated_specification |
747 %type <leaf> enumerated_specification |
746 /* helper symbol for enumerated_value */ |
748 /* helper symbol for enumerated_value */ |
2767 {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after subrange defined in subrange specification."); yyerrok;} |
2769 {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing after subrange defined in subrange specification."); yyerrok;} |
2768 /* ERROR_CHECK_END */ |
2770 /* ERROR_CHECK_END */ |
2769 ; |
2771 ; |
2770 |
2772 |
2771 |
2773 |
2772 subrange: |
2774 /* a non standard construct, used to allow the declaration of array subranges using a variable */ |
|
2775 subrange_with_var: |
2773 signed_integer DOTDOT signed_integer |
2776 signed_integer DOTDOT signed_integer |
|
2777 {$$ = new subrange_c($1, $3, locloc(@$));} |
|
2778 | any_identifier DOTDOT signed_integer |
|
2779 {$$ = new subrange_c($1, $3, locloc(@$));} |
|
2780 | signed_integer DOTDOT any_identifier |
|
2781 {$$ = new subrange_c($1, $3, locloc(@$));} |
|
2782 | any_identifier DOTDOT any_identifier |
2774 {$$ = new subrange_c($1, $3, locloc(@$));} |
2783 {$$ = new subrange_c($1, $3, locloc(@$));} |
2775 /* ERROR_CHECK_BEGIN */ |
2784 /* ERROR_CHECK_BEGIN */ |
2776 | signed_integer signed_integer |
2785 | signed_integer signed_integer |
2777 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
2786 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
2778 | signed_integer DOTDOT error |
2787 | signed_integer DOTDOT error |
2781 else {print_err_msg(locf(@3), locl(@3), "invalid value for upper bound in subrange definition."); yyclearin;} |
2790 else {print_err_msg(locf(@3), locl(@3), "invalid value for upper bound in subrange definition."); yyclearin;} |
2782 yyerrok; |
2791 yyerrok; |
2783 } |
2792 } |
2784 /* ERROR_CHECK_END */ |
2793 /* ERROR_CHECK_END */ |
2785 ; |
2794 ; |
|
2795 |
|
2796 |
|
2797 subrange: |
|
2798 signed_integer DOTDOT signed_integer |
|
2799 {$$ = new subrange_c($1, $3, locloc(@$));} |
|
2800 /* ERROR_CHECK_BEGIN */ |
|
2801 | signed_integer signed_integer |
|
2802 {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;} |
|
2803 | signed_integer DOTDOT error |
|
2804 {$$ = NULL; |
|
2805 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for upper bound in subrange definition.");} |
|
2806 else {print_err_msg(locf(@3), locl(@3), "invalid value for upper bound in subrange definition."); yyclearin;} |
|
2807 yyerrok; |
|
2808 } |
|
2809 /* ERROR_CHECK_END */ |
|
2810 ; |
|
2811 |
2786 |
2812 |
2787 enumerated_type_declaration: |
2813 enumerated_type_declaration: |
2788 /* enumerated_type_name ':' enumerated_spec_init */ |
2814 /* enumerated_type_name ':' enumerated_spec_init */ |
2789 /* NOTE: The 'identifier' used for the name of the new enumerated type is inserted early into the library_element_symtable so it may be used |
2815 /* NOTE: The 'identifier' used for the name of the new enumerated type is inserted early into the library_element_symtable so it may be used |
2790 * in defining the default initial value of this type, using the fully qualified enumerated constant syntax: type_name#enum_value |
2816 * in defining the default initial value of this type, using the fully qualified enumerated constant syntax: type_name#enum_value |
2987 /* ERROR_CHECK_END */ |
3013 /* ERROR_CHECK_END */ |
2988 ; |
3014 ; |
2989 |
3015 |
2990 /* helper symbol for array_specification */ |
3016 /* helper symbol for array_specification */ |
2991 array_subrange_list: |
3017 array_subrange_list: |
2992 subrange |
3018 /* the construct 'subrange' has been replaced with 'subrange_with_var' in order to support the declaration of array ranges using a varable: e.g. ARRAY [2..max] OF INT */ |
|
3019 subrange_with_var |
2993 {$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);} |
3020 {$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);} |
2994 | array_subrange_list ',' subrange |
3021 | array_subrange_list ',' subrange_with_var |
2995 {$$ = $1; $$->add_element($3);} |
3022 {$$ = $1; $$->add_element($3);} |
2996 /* ERROR_CHECK_BEGIN */ |
3023 /* ERROR_CHECK_BEGIN */ |
2997 | array_subrange_list subrange |
3024 | array_subrange_list subrange |
2998 {$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in subrange list."); yynerrs++;} |
3025 {$$ = $1; print_err_msg(locl(@1), locf(@2), "',' missing in subrange list."); yynerrs++;} |
2999 | array_subrange_list ',' error |
3026 | array_subrange_list ',' error |