fix compilation of SFC transitions written in IL (compiler was entering endless loop)
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 25 Jan 2017 18:29:55 +0000
changeset 1031 ce026aee03e0
parent 1030 9aba95daf81a
child 1032 7a4b29e25481
fix compilation of SFC transitions written in IL (compiler was entering endless loop)
stage1_2/iec_bison.yy
stage1_2/iec_flex.ll
--- a/stage1_2/iec_bison.yy	Wed Jan 25 18:25:35 2017 +0000
+++ b/stage1_2/iec_bison.yy	Wed Jan 25 18:29:55 2017 +0000
@@ -5846,14 +5846,14 @@
 
 
 transition_condition:
-  ':' eol_list simple_instr_list
-	{$$ = new transition_condition_c($3, NULL, locloc(@$));}
+ start_IL_body_token ':' eol_list simple_instr_list
+	{$$ = new transition_condition_c($4, NULL, locloc(@$));}
 | ASSIGN expression ';'
 	{$$ = new transition_condition_c(NULL, $2, locloc(@$));}
 /* ERROR_CHECK_BEGIN */
-| eol_list simple_instr_list
+| start_IL_body_token eol_list simple_instr_list
 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "':' missing before IL condition in transition declaration."); yynerrs++;}
-| ':' eol_list error
+| start_IL_body_token ':' eol_list error
 	{$$ = NULL;
 	 if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no instructions defined in IL condition of transition declaration.");}
 	 else {print_err_msg(locf(@3), locl(@3), "invalid instructions in IL condition of transition declaration."); yyclearin;}
--- a/stage1_2/iec_flex.ll	Wed Jan 25 18:25:35 2017 +0000
+++ b/stage1_2/iec_flex.ll	Wed Jan 25 18:29:55 2017 +0000
@@ -1193,10 +1193,11 @@
 				  else				 	{append_bodystate_buffer(yytext);}
 				}
  
-	/* check if ';' occurs before an END_FUNCTION, END_FUNCTION_BLOCK, END_PROGRAM or END_ACTION. (If true => we are parsing ST; If false => parsing IL). */
+	/* check if ';' occurs before an END_FUNCTION, END_FUNCTION_BLOCK, END_PROGRAM, END_ACTION or END_TRANSITION. (If true => we are parsing ST; If false => parsing IL). */
 END_ACTION			| /* execute the next rule's action, i.e. fall-through! */
 END_FUNCTION			|
 END_FUNCTION_BLOCK		|
+END_TRANSITION   		|
 END_PROGRAM			{ append_bodystate_buffer(yytext); unput_bodystate_buffer(); BEGIN(il_state); /*printf("returning start_IL_body_token\n");*/ return start_IL_body_token;}
 .|\n				{ append_bodystate_buffer(yytext);
 				  if (strcmp(yytext, ";") == 0)