stage1_2/iec_bison.yy
changeset 980 9ed5aff159db
parent 971 8aee27d46208
child 1011 76175defb87b
equal deleted inserted replaced
979:f8f1d89ff7d5 980:9ed5aff159db
  2774 /* a non standard construct, used to allow the declaration of array subranges using a variable */
  2774 /* a non standard construct, used to allow the declaration of array subranges using a variable */
  2775 subrange_with_var:
  2775 subrange_with_var:
  2776   signed_integer DOTDOT signed_integer
  2776   signed_integer DOTDOT signed_integer
  2777 	{$$ = new subrange_c($1, $3, locloc(@$));}
  2777 	{$$ = new subrange_c($1, $3, locloc(@$));}
  2778 | any_identifier DOTDOT signed_integer
  2778 | any_identifier DOTDOT signed_integer
  2779 	{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), $3, locloc(@$));}
  2779 	{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), $3, locloc(@$));
       
  2780 	 if (!runtime_options.nonliteral_in_array_size) {
       
  2781 	   print_err_msg(locf(@1), locl(@1), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); 
       
  2782 	   yynerrs++;
       
  2783 	 }
       
  2784 	}
  2780 | signed_integer DOTDOT any_identifier
  2785 | signed_integer DOTDOT any_identifier
  2781 	{$$ = new subrange_c($1, new symbolic_constant_c($3, locloc(@3)), locloc(@$));}
  2786 	{$$ = new subrange_c($1, new symbolic_constant_c($3, locloc(@3)), locloc(@$));
       
  2787 	 if (!runtime_options.nonliteral_in_array_size) {
       
  2788 	   print_err_msg(locf(@3), locl(@3), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); 
       
  2789 	   yynerrs++;
       
  2790 	 }
       
  2791 	}
  2782 | any_identifier DOTDOT any_identifier
  2792 | any_identifier DOTDOT any_identifier
  2783 	{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), new symbolic_constant_c($3, locloc(@3)), locloc(@$));}
  2793 	{$$ = new subrange_c(new symbolic_constant_c($1, locloc(@1)), new symbolic_constant_c($3, locloc(@3)), locloc(@$));
       
  2794 	 if (!runtime_options.nonliteral_in_array_size) {
       
  2795 	   print_err_msg(locf(@$), locl(@$), "Use of variables in array size limits is not allowed in IEC 61131-3 (use -a option to activate support for this non-standard feature)."); 
       
  2796 	   yynerrs++;
       
  2797 	 }
       
  2798 	}
  2784 /* ERROR_CHECK_BEGIN */
  2799 /* ERROR_CHECK_BEGIN */
  2785 | signed_integer signed_integer
  2800 | signed_integer signed_integer
  2786 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;}
  2801 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "'..' missing between bounds in subrange definition."); yynerrs++;}
  2787 | signed_integer DOTDOT error
  2802 | signed_integer DOTDOT error
  2788 	{$$ = NULL;
  2803 	{$$ = NULL;