--- a/stage1_2/iec.flex Fri Oct 24 16:38:26 2008 +0200
+++ b/stage1_2/iec.flex Fri Nov 21 13:43:49 2008 +0100
@@ -534,7 +534,6 @@
octal_digit [0-7]
hex_digit {digit}|[A-F]
identifier ({letter}|(_({letter}|{digit})))((_?({letter}|{digit}))*)
-invalid_identifier ({letter}|{digit}|_)*
/*******************/
/* B.1.2 Constants */
@@ -885,18 +884,19 @@
/* body_state -> (il_state | st_state) */
<body_state>{
{st_whitespace_no_pragma} /* Eat any whitespace */
-{qualified_identifier}{st_whitespace}":=" unput_text(0); BEGIN(st_state);
+{qualified_identifier}{st_whitespace}":=" unput_text(0); BEGIN(st_state);
{qualified_identifier}"[" unput_text(0); BEGIN(st_state);
-RETURN unput_text(0); BEGIN(st_state);
-IF unput_text(0); BEGIN(st_state);
+RETURN unput_text(0); BEGIN(st_state);
+IF unput_text(0); BEGIN(st_state);
CASE unput_text(0); BEGIN(st_state);
-FOR unput_text(0); BEGIN(st_state);
+FOR unput_text(0); BEGIN(st_state);
WHILE unput_text(0); BEGIN(st_state);
-REPEAT unput_text(0); BEGIN(st_state);
+REPEAT unput_text(0); BEGIN(st_state);
EXIT unput_text(0); BEGIN(st_state);
+
/* ':=' occurs only in transitions, and not Function or FB bodies! */
-:= unput_text(0); BEGIN(st_state);
+:= unput_text(0); BEGIN(st_state);
/* Hopefully, the above rules (along with the last one),
* used to distinguish ST from IL, are
@@ -1484,7 +1484,6 @@
*
* e.g.: ':' '(' ')' '+' '*' ...
*/
-{invalid_identifier} return INVALID_IDENTIFIER;
. {return yytext[0];}
--- a/stage1_2/iec.y Fri Oct 24 16:38:26 2008 +0200
+++ b/stage1_2/iec.y Fri Nov 21 13:43:49 2008 +0100
@@ -295,7 +295,6 @@
*/
%token <ID> identifier_token
%type <leaf> identifier
-%token INVALID_IDENTIFIER
/*********************/
/* B 1.2 - Constants */
@@ -839,6 +838,7 @@
%type <leaf> transition_priority
%type <leaf> transition_condition
%type <leaf> action
+%type <leaf> action_body
%type <leaf> transition_name
@@ -5067,24 +5067,35 @@
action:
// ACTION identifier ':' ...
- ACTION action_name ':' {cmd_goto_body_state();} function_block_body END_ACTION
- {$$ = new action_c($2, $5, locloc(@$));}
-/* ERROR_CHECK_BEGIN */
-| ACTION ':' {cmd_goto_body_state();} function_block_body END_ACTION
- {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no action name defined in action declaration."); yynerrs++;}
-| ACTION error ':' {cmd_goto_body_state();} function_block_body END_ACTION
+ ACTION action_name {cmd_goto_body_state();} action_body END_ACTION
+ {$$ = new action_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| ACTION {cmd_goto_body_state();} action_body END_ACTION
+ {$$ = NULL; print_err_msg(locl(@1), locf(@3), "no action name defined in action declaration."); yynerrs++;}
+| ACTION error {cmd_goto_body_state();} action_body END_ACTION
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "invalid action name defined in action declaration."); yyerrok;}
| ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION
{$$ = NULL; print_err_msg(locl(@2), locf(@4), "':' missing after action name in action declaration."); yynerrs++;}
-| ACTION action_name ':' END_ACTION
- {$$ = NULL; print_err_msg(locl(@3), locf(@4), "no body defined in action declaration."); yynerrs++;}
-/*| ACTION action_name ':' {cmd_goto_body_state();} function_block_body END_OF_INPUT
- {$$ = NULL; print_err_msg(locf(@1), locl(@3), "unclosed action declaration."); yyerrok;}*/
+/*| ACTION action_name {cmd_goto_body_state();} action_body END_OF_INPUT
+ {$$ = NULL; print_err_msg(locf(@1), locl(@2), "unclosed action declaration."); yyerrok;}*/
| ACTION error END_ACTION
{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in action declaration."); yyerrok;}
/* ERROR_CHECK_END */
;
+action_body:
+ ':' function_block_body
+ {$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| ':' error
+ {$$ = NULL;
+ if (is_current_syntax_token()) {print_err_msg(locl(@1), locf(@2), "no body defined in action declaration.");}
+ else {print_err_msg(locf(@2), locl(@2), "invalid body defined in action declaration."); yyclearin;}
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
+;
+
/********************************/
/* B 1.7 Configuration elements */