Only allow function invocation outside ST expressions when command line option is activated.
authormjsousa
Thu, 26 May 2016 18:30:17 +0100
changeset 1019 1e3cefbbdee2
parent 1018 49c4edf76e63
child 1020 36fb9443b6ea
Only allow function invocation outside ST expressions when command line option is activated.
stage1_2/iec_bison.yy
--- a/stage1_2/iec_bison.yy	Thu May 26 17:59:01 2016 +0100
+++ b/stage1_2/iec_bison.yy	Thu May 26 18:30:17 2016 +0100
@@ -7905,7 +7905,15 @@
 | subprogram_control_statement
 | selection_statement
 | iteration_statement
-| function_invocation /* TODO: this must be conditional on command line parameter! */
+| function_invocation 
+	{ /* This is a non-standard extension (calling a function outside an ST expression!) */
+	  /* Only allow this if command line option has been selected...                     */
+	  $$ = $1; 
+	  if (!runtime_options.allow_void_datatype) {
+	    print_err_msg(locf(@1), locl(@1), "Function invocation in ST code is not allowed outside an expression. To allow this non-standard syntax, activate the apropriate command line option."); 
+	    yynerrs++;
+	  }
+	}  
 ;