--- a/stage1_2/iec.y Thu Jul 17 19:07:26 2008 +0200
+++ b/stage1_2/iec.y Thu Jul 17 19:07:28 2008 +0200
@@ -228,7 +228,6 @@
*/
%token BOGUS_TOKEN_ID
-
%type <leaf> start
%type <leaf> any_identifier
@@ -829,6 +828,7 @@
%type <leaf> transition
%type <leaf> steps
%type <list> step_name_list
+%type <leaf> transition_priority
%type <leaf> transition_condition
%type <leaf> action
%type <leaf> transition_name
@@ -1382,8 +1382,6 @@
-
-
/***************************/
/* B 0 - Programming Model */
/***************************/
@@ -1398,7 +1396,7 @@
/* ERROR_CHECK_BEGIN */
| library error END_OF_INPUT
{$$ = NULL;
- print_err_msg(current_filename, locf(@2), locl(@2), "unknown error.");
+ print_err_msg(current_filename, locf(@2), locl(@2), "unknown syntax error.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -1682,6 +1680,53 @@
* why signed_integer, binary_integer, octal_integer
* and hex_integer are missing here!
*/
+/* ERROR_CHECK_BEGIN */
+| integer_type_name signed_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
+ }
+| integer_type_name binary_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
+ }
+| integer_type_name octal_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
+ }
+| integer_type_name hex_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between integer type name and value in integer literal.");
+ }
+| integer_type_name error signed_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
+ yyerrok;
+ }
+| integer_type_name error binary_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
+ yyerrok;
+ }
+| integer_type_name error octal_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
+ yyerrok;
+ }
+| integer_type_name error hex_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between integer type name and value in integer literal.");
+ yyerrok;
+ }
+| integer_type_name '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for integer literal.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
signed_integer:
@@ -1704,6 +1749,23 @@
signed_real
| real_type_name '#' signed_real
{$$ = new real_literal_c($1, $3, locf(@1), locl(@3));}
+/* ERROR_CHECK_BEGIN */
+| real_type_name signed_real
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between real type name and value in real literal.");
+ }
+| real_type_name error signed_real
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between real type name and value in real literal.");
+ yyerrok;
+ }
+| real_type_name '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for real literal.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for non_negative_numeric_literal */
@@ -1744,6 +1806,53 @@
* bit_string_type_name, although seemingly incorrect, is
* really correct here!
*/
+/* ERROR_CHECK_BEGIN */
+| bit_string_type_name integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
+ }
+| bit_string_type_name binary_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
+ }
+| bit_string_type_name octal_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
+ }
+| bit_string_type_name hex_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between bit string type name and value in bit string literal.");
+ }
+| bit_string_type_name error integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
+ yyerrok;
+ }
+| bit_string_type_name error binary_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
+ yyerrok;
+ }
+| bit_string_type_name error octal_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
+ yyerrok;
+ }
+| bit_string_type_name error hex_integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between bit string type name and value in bit string literal.");
+ yyerrok;
+ }
+| bit_string_type_name '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for bit string literal.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -1842,6 +1951,38 @@
{$$ = new duration_c(NULL, $2, locloc(@$));}
| T_SHARP '-' interval
{$$ = new duration_c(new neg_time_c(locloc(@$)), $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| TIME interval
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME' and interval in duration.");
+ }
+| TIME '-' interval
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME' and interval in duration.");
+ }
+| TIME error interval
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME' and interval in duration.");
+ yyerrok;
+ }
+| TIME error '-' interval
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME' and interval in duration.");
+ yyerrok;
+ }
+| TIME '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for duration.");
+ yyerrok;
+ }
+| T_SHARP error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid value for duration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -1906,6 +2047,13 @@
{$$ = new days_c($1, $2, locloc(@$));}
| integer_d '_' hours
{$$ = new days_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| integer_d '_' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for hours in duration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -1918,6 +2066,14 @@
{$$ = new hours_c($1, $2, locloc(@$));}
| integer_h '_' minutes
{$$ = new hours_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| integer_h '_' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for minutes in duration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
+
;
minutes:
@@ -1929,6 +2085,13 @@
{$$ = new minutes_c($1, $2, locloc(@$));}
| integer_m '_' seconds
{$$ = new minutes_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| integer_m '_' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for seconds in duration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
seconds:
@@ -1940,6 +2103,13 @@
{$$ = new seconds_c($1, $2, locloc(@$));}
| integer_s '_' milliseconds
{$$ = new seconds_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| integer_s '_' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for milliseconds in duration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
milliseconds:
@@ -1956,12 +2126,66 @@
time_of_day:
TIME_OF_DAY '#' daytime
{$$ = new time_of_day_c($3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| TIME_OF_DAY daytime
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day.");
+ }
+| TIME_OF_DAY error daytime
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'TIME_OF_DAY' and daytime in time of day.");
+ yyerrok;
+ }
+| TIME_OF_DAY '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for time of day.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
daytime:
day_hour ':' day_minute ':' day_second
{$$ = new daytime_c($1, $3, $5, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| day_hour day_minute ':' day_second
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between hours and minutes in daytime.");
+ }
+| day_hour error day_minute ':' day_second
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' between hours and minutes in daytime.");
+ yyerrok;
+ }
+| day_hour ':' ':' day_second
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no minutes defined in daytime.");
+ }
+| day_hour ':' error ':' day_second
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid value for minutes in daytime.");
+ yyerrok;
+ }
+| day_hour ':' day_minute day_second
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "':' missing between minutes and seconds in daytime.");
+ }
+| day_hour ':' day_minute error day_second
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' between minutes and seconds in daytime.");
+ yyerrok;
+ }
+| day_hour ':' day_minute ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@4), "invalid value for seconds in daytime.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -1975,12 +2199,71 @@
{$$ = new date_c($3, locloc(@$));}
| D_SHARP date_literal
{$$ = new date_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| DATE date_literal
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'DATE' and date literal in date.");
+ }
+| DATE error date_literal
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'DATE' and date literal in date.");
+ yyerrok;
+ }
+| DATE '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date.");
+ yyerrok;
+ }
+| D_SHARP error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
date_literal:
year '-' month '-' day
{$$ = new date_literal_c($1, $3, $5, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| year month '-' day
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'-' missing between year and month in date literal.");
+ }
+| year error month '-' day
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '-' between year and month in date literal.");
+ yyerrok;
+ }
+| year '-' '-' day
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no month defined in date literal.");
+ }
+| year '-' error '-' day
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid value for month in date literal.");
+ yyerrok;
+ }
+| year '-' month day
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "':' missing between month and day in date literal.");
+ }
+| year ':' month error day
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' between month and day in date literal.");
+ yyerrok;
+ }
+| year ':' month ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@4), "invalid value for day in date literal.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -1992,6 +2275,43 @@
date_and_time:
DATE_AND_TIME '#' date_literal '-' daytime
{$$ = new date_and_time_c($3, $5, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| DATE_AND_TIME date_literal '-' daytime
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time.");
+ }
+| DATE_AND_TIME error date_literal '-' daytime
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between 'DATE_AND_TIME' and date literal in date and time.");
+ yyerrok;
+ }
+| DATE_AND_TIME '#' '-' daytime
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no value defined for date literal in date and time.");
+ }
+| DATE_AND_TIME '#' error '-' daytime
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for date literal in date and time.");
+ yyerrok;
+ }
+| DATE_AND_TIME '#' date_literal daytime
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "'-' missing between date literal and daytime in date and time.");
+ }
+| DATE_AND_TIME '#' date_literal error daytime
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting '-' between date literal and daytime in date and time.");
+ yyerrok;
+ }
+| DATE_AND_TIME '#' date_literal '-' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for daytime in date and time.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2155,6 +2475,23 @@
data_type_declaration:
TYPE type_declaration_list END_TYPE
{$$ = new data_type_declaration_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| TYPE END_TYPE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no data type declared in data type(s) declaration.");
+ }
+| TYPE error type_declaration_list END_TYPE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'TYPE' in data type(s) declaration.");
+ yyerrok;
+ }
+| TYPE error END_TYPE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in data type(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for data_type_declaration */
@@ -2163,6 +2500,23 @@
{$$ = new type_declaration_list_c(locloc(@$)); $$->add_element($1);}
| type_declaration_list type_declaration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| type_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of data type declaration.");
+ yyerrok;
+ }
+| type_declaration_list type_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of data type declaration.");
+ yyerrok;
+ }
+| type_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after data type declaration.");
+ }
+/* ERROR_CHECK_END */
;
type_declaration:
@@ -2184,6 +2538,23 @@
{$$ = new simple_type_declaration_c($1, $3, locloc(@$));
library_element_symtable.insert($1, prev_declared_simple_type_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| identifier simple_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in simple type declaration.");
+ }
+| identifier ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@3), "unknown data type defined in specification for data type declaration.");
+ }
+| identifier ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in data type declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2202,6 +2573,23 @@
{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
| prev_declared_simple_type_name ASSIGN constant
{$$ = new simple_spec_init_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| elementary_type_name constant
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in specification with initialization.");
+ }
+| prev_declared_simple_type_name constant
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in specification with initialization.");
+ }
+| identifier ASSIGN constant
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unknown type defined in specification.");
+ }
+/* ERROR_CHECK_END */
;
/* When converting to C/C++, we need to know whether
@@ -2230,6 +2618,13 @@
{$$ = new subrange_type_declaration_c($1, $3, locloc(@$));
library_element_symtable.insert($1, prev_declared_subrange_type_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| identifier subrange_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in subrange type declaration.");
+ }
+/* ERROR_CHECK_END */
;
subrange_spec_init:
@@ -2237,19 +2632,60 @@
{$$ = new subrange_spec_init_c($1, NULL, locloc(@$));}
| subrange_specification ASSIGN signed_integer
{$$ = new subrange_spec_init_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| subrange_specification signed_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in subrange specification with initialization.");
+ }
+/* ERROR_CHECK_END */
;
subrange_specification:
- integer_type_name '(' subrange')'
+ integer_type_name '(' subrange ')'
{$$ = new subrange_specification_c($1, $3, locloc(@$));}
| prev_declared_subrange_type_name
{$$ = new subrange_specification_c($1, NULL, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| integer_type_name '(' ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no subrange defined in subrange specification.");
+ }
+| integer_type_name '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid subrange defined in subrange specification.");
+ yyerrok;
+ }
+| integer_type_name '(' subrange error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@3), "')' missing after subrange defined in subrange specification.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
subrange:
signed_integer DOTDOT signed_integer
{$$ = new subrange_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| signed_integer signed_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'..' missing between bounds in subrange definition.");
+ }
+| signed_integer error signed_integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "expecting '..' between bounds in subrange definition.");
+ }
+| signed_integer DOTDOT error
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid value for upper bound in subrange definition.");
+ }
+/* ERROR_CHECK_END */
;
enumerated_type_declaration:
@@ -2258,6 +2694,13 @@
{$$ = new enumerated_type_declaration_c($1, $3, locloc(@$));
library_element_symtable.insert($1, prev_declared_enumerated_type_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| identifier enumerated_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in enumerated type declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2266,12 +2709,36 @@
{$$ = new enumerated_spec_init_c($1, NULL, locloc(@$));}
| enumerated_specification ASSIGN enumerated_value
{$$ = new enumerated_spec_init_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| enumerated_specification enumerated_value
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in enumerated specification with initialization.");
+ }
+/* ERROR_CHECK_END */
;
enumerated_specification:
'(' enumerated_value_list ')'
{$$ = $2;}
| prev_declared_enumerated_type_name
+/* ERROR_CHECK_BEGIN */
+| '(' ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no enumerated value list defined in enumerated specification.");
+ }
+| '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid enumerated value list defined in enumerated specification.");
+ yyerrok;
+ }
+| '(' enumerated_value_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of enumerated specification.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for enumerated_specification */
@@ -2280,6 +2747,18 @@
{$$ = new enumerated_value_list_c(locloc(@$)); $$->add_element($1);}
| enumerated_value_list ',' enumerated_value
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| enumerated_value_list enumerated_value
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in enumerated value list.");
+ }
+| enumerated_value_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid value in enumerated value list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2288,6 +2767,28 @@
{$$ = new enumerated_value_c(NULL, $1, locloc(@$));}
| prev_declared_enumerated_type_name '#' any_identifier
{$$ = new enumerated_value_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| prev_declared_enumerated_type_name any_identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'#' missing between enumerated type name and value in enumerated literal.");
+ }
+| prev_declared_enumerated_type_name error any_identifier
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '#' between enumerated type name and value in enumerated literal.");
+ yyerrok;
+ }
+| prev_declared_enumerated_type_name '#' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for enumerated literal.");
+ yyerrok;
+ }
+| identifier '#' any_identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unknown type name for typed literal.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2305,6 +2806,13 @@
{$$ = new array_type_declaration_c($1, $3, locloc(@$));
library_element_symtable.insert($1, prev_declared_array_type_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| identifier array_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in array type declaration.");
+ }
+/* ERROR_CHECK_END */
;
array_spec_init:
@@ -2312,6 +2820,13 @@
{$$ = new array_spec_init_c($1, NULL, locloc(@$));}
| array_specification ASSIGN array_initialization
{$$ = new array_spec_init_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| array_specification array_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in array specification with initialization.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2319,6 +2834,63 @@
prev_declared_array_type_name
| ARRAY '[' array_subrange_list ']' OF non_generic_type_name
{$$ = new array_specification_c($3, $6, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| ARRAY array_subrange_list ']' OF non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'[' missing before subrange list in array specification.");
+ }
+| ARRAY error array_subrange_list ']' OF non_generic_type_name
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '[' after 'ARRAY' in array specification.");
+ yyerrok;
+ }
+| ARRAY '[' ']' OF non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no subrange list defined in array specification.");
+ }
+| ARRAY '[' error ']' OF non_generic_type_name
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid subrange list defined in array specification.");
+ yyerrok;
+ }
+| ARRAY OF non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no subrange list defined in array specification.");
+ }
+| ARRAY error OF non_generic_type_name
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid subrange list defined in array specification.");
+ yyerrok;
+ }
+| ARRAY '[' array_subrange_list OF non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "']' missing after subrange list in array specification.");
+ }
+| ARRAY '[' array_subrange_list error OF non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting '[' after subrange list in array specification.");
+ }
+| ARRAY '[' array_subrange_list ']' non_generic_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "'OF' missing between subrange list and item type name in array specification.");
+ }
+| ARRAY '[' array_subrange_list ']' error non_generic_type_name
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'OF' between subrange list and item type name in array specification.");
+ yyerrok;
+ }
+| ARRAY '[' array_subrange_list ']' OF error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "no itme data type defined in array specification.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for array_specification */
@@ -2327,12 +2899,41 @@
{$$ = new array_subrange_list_c(locloc(@$)); $$->add_element($1);}
| array_subrange_list ',' subrange
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| array_subrange_list subrange
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in subrange list.");
+ }
+| array_subrange_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid subrange in subrange list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
array_initialization:
'[' array_initial_elements_list ']'
{$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| '[' ']'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no initial values list defined in array initialization.");
+ }
+| '[' error ']'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid initial values list defined in array initialization.");
+ yyerrok;
+ }
+| '[' array_initial_elements_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "']' missing at the end of array initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2342,6 +2943,13 @@
{$$ = new array_initial_elements_list_c(locloc(@$)); $$->add_element($1);}
| array_initial_elements_list ',' array_initial_elements
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN
+| array_initial_elements_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid array initial value in array initial values list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2350,6 +2958,18 @@
| integer '(' ')'
| integer '(' array_initial_element ')'
{$$ = new array_initial_elements_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN
+| integer '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid array initial value in array initial values list.");
+ yyerrok;
+ }
+| integer '(' array_initial_element error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "')' missing at the end of array initial value in array initial values list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2368,6 +2988,13 @@
{$$ = new structure_type_declaration_c($1, $3, locloc(@$));
library_element_symtable.insert($1, prev_declared_structure_type_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| identifier structure_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing between data type name and specification in structure type declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2382,12 +3009,41 @@
{$$ = new initialized_structure_c($1, NULL, locloc(@$));}
| prev_declared_structure_type_name ASSIGN structure_initialization
{$$ = new initialized_structure_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| prev_declared_structure_type_name structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structure specification with initialization.");
+ }
+| identifier ASSIGN structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "unknown type name for structure specification with initialization.");
+ }
+/* ERROR_CHECK_END */
;
structure_declaration:
STRUCT structure_element_declaration_list END_STRUCT
{$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| STRUCT END_STRUCT
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no structure element declared in structure type declaration.");
+ }
+| STRUCT error structure_element_declaration_list END_STRUCT
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'STRUCT' in structure type declaration.");
+ yyerrok;
+ }
+| STRUCT error END_STRUCT
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in structure type declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for structure_declaration */
@@ -2396,6 +3052,23 @@
{$$ = new structure_element_declaration_list_c(locloc(@$)); $$->add_element($1);}
| structure_element_declaration_list structure_element_declaration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| structure_element_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of structure element declaration.");
+ yyerrok;
+ }
+| structure_element_declaration_list structure_element_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of structure element declaration.");
+ yyerrok;
+ }
+| structure_element_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after structure element declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2410,6 +3083,43 @@
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
| structure_element_name ':' initialized_structure
{$$ = new structure_element_declaration_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| structure_element_name simple_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and simple specification.");
+ }
+| structure_element_name subrange_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and subrange specification.");
+ }
+| structure_element_name enumerated_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and enumerated specification.");
+ }
+| structure_element_name array_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and array specification.");
+ }
+| structure_element_name initialized_structure
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between structure element name and structure specification.");
+ }
+| structure_element_name ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unknown variable type defined in structure element declaration.");
+ }
+| structure_element_name ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in structure element declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2419,6 +3129,18 @@
structure_initialization:
'(' structure_element_initialization_list ')'
{$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid structure element initialization list in structure initialization.");
+ yyerrok;
+ }
+| '(' structure_element_initialization_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting ')' at the end of structure element initialization list in structure initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for structure_initialization */
@@ -2427,6 +3149,18 @@
{$$ = new structure_element_initialization_list_c(locloc(@$)); $$->add_element($1);}
| structure_element_initialization_list ',' structure_element_initialization
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN
+| structure_element_initialization_list structure_element_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in structure element initialization list in structure initialization.");
+ }
+| structure_element_initialization_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid structure element initialization in structure initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2439,6 +3173,28 @@
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
| structure_element_name ASSIGN structure_initialization
{$$ = new structure_element_initialization_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| structure_element_name constant
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structure element initialization.");
+ }
+| structure_element_name enumerated_value
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in enumerated structure element initialization.");
+ }
+| structure_element_name array_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in array structure element initialization.");
+ }
+| structure_element_name structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':=' missing in structured structure element initialization.");
+ }
+/* ERROR_CHECK_END */
;
/* NOTE: in order to remove a reduce/reduce conflict,
@@ -2644,10 +3400,49 @@
| VAR_INPUT NON_RETAIN input_declaration_list END_VAR
{$$ = new input_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR_INPUT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in input variable(s) declaration.");
+ }
+| VAR_INPUT RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive input variable(s) declaration.");
+ }
+| VAR_INPUT NON_RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive input variable(s) declaration.");
+ }
+| VAR_INPUT error input_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_INPUT' in input variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_INPUT RETAIN error input_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive input variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_INPUT NON_RETAIN error input_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive input variable(s) declaration.");
+ yyerrok;
+ }
| VAR_INPUT error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in input variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in input variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_INPUT RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in retentive input variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_INPUT NON_RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in non-retentive input variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -2659,6 +3454,23 @@
{$$ = new input_declaration_list_c(locloc(@$)); $$->add_element($1);}
| input_declaration_list input_declaration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| input_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of input variable declaration.");
+ yyerrok;
+ }
+| input_declaration_list input_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of input variable declaration.");
+ yyerrok;
+ }
+| input_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after input variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2673,6 +3485,33 @@
{$$ = new edge_declaration_c(new raising_edge_option_c(locloc(@3)), $1, locloc(@$));}
| var1_list ':' BOOL F_EDGE
{$$ = new edge_declaration_c(new falling_edge_option_c(locloc(@3)), $1, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list BOOL R_EDGE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and specification.");
+ }
+| var1_list BOOL F_EDGE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and specification.");
+ }
+| var1_list ':' BOOL R_EDGE F_EDGE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@4), "'R_EDGE' and 'F_EDGE' can't be present at the same time in edge declaration.");
+ }
+| var1_list ':' R_EDGE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "'BOOL' missing in edge declaration.");
+ }
+| var1_list ':' F_EDGE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "'BOOL' missing in edge declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2694,6 +3533,33 @@
{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
| var1_list ':' enumerated_spec_init
{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list simple_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and simple specification.");
+ }
+| var1_list subrange_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and subrange specification.");
+ }
+| var1_list enumerated_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and enumerated specification.");
+ }
+| var1_list ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unknown variable type defined in variable declaration.");
+ }
+| var1_list ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2706,6 +3572,18 @@
{$$ = $1; $$->add_element($3);
variable_name_symtable.insert($3, prev_declared_variable_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| var1_list variable_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in variable list.");
+ }
+| var1_list ',' error
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ',' in variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2713,12 +3591,26 @@
array_var_init_decl:
var1_list ':' array_spec_init
{$$ = new array_var_init_decl_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list array_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and array specification.");
+ }
+/* ERROR_CHECK_END */
;
structured_var_init_decl:
var1_list ':' initialized_structure
{$$ = new structured_var_init_decl_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list initialized_structure
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and structured specification.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2734,6 +3626,23 @@
/*| fb_name_list ':' function_block_type_name ASSIGN structure_initialization */
| fb_name_list_with_colon function_block_type_name ASSIGN structure_initialization
{$$ = new fb_name_decl_c($1, $2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| fb_name_list_with_colon ASSIGN structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no function block type name defined in function block declaration with initialization.");
+ }
+| fb_name_list_with_colon function_block_type_name structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing in function block declaration with initialization.");
+ }
+| fb_name_list_with_colon function_block_type_name ASSIGN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid initialization in function block declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2797,10 +3706,49 @@
| VAR_OUTPUT NON_RETAIN var_init_decl_list END_VAR
{$$ = new output_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR_OUTPUT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in output variable(s) declaration.");
+ }
+| VAR_OUTPUT RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive output variable(s) declaration.");
+ }
+| VAR_OUTPUT NON_RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive output variable(s) declaration.");
+ }
+| VAR_OUTPUT error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_OUPUT' in output variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_OUTPUT RETAIN error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive output variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_OUTPUT NON_RETAIN error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive output variable(s) declaration.");
+ yyerrok;
+ }
| VAR_OUTPUT error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in output variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in output variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_OUTPUT RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in retentive output variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_OUTPUT NON_RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in non-retentive output variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -2812,10 +3760,14 @@
VAR_IN_OUT var_declaration_list END_VAR
{$$ = new input_output_declarations_c($2, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR_IN_OUT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in in_out variable(s) declaration.");
+ }
| VAR_IN_OUT error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in in_out variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in in_out variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -2829,6 +3781,23 @@
{$$ = new var_declaration_list_c(locloc(@$)); $$->add_element($1);}
| var_declaration_list var_declaration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| var_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of variable declaration.");
+ yyerrok;
+ }
+| var_declaration_list var_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of variable declaration.");
+ yyerrok;
+ }
+| var_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2852,6 +3821,23 @@
{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
| var1_list ':' enumerated_specification
{$$ = new var1_init_decl_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list simple_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and simple specification.");
+ }
+| var1_list subrange_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and subrange specification.");
+ }
+| var1_list enumerated_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and enumerated specification.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2859,11 +3845,30 @@
array_var_declaration:
var1_list ':' array_specification
{$$ = new array_var_declaration_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list array_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and array specification.");
+ }
+/* ERROR_CHECK_END */
;
structured_var_declaration:
var1_list ':' prev_declared_structure_type_name
{$$ = new structured_var_declaration_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list prev_declared_structure_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and structured specification.");
+ }
+| var1_list ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unknown type name in structured variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2872,6 +3877,38 @@
{$$ = new var_declarations_c(NULL, $2, locloc(@$));}
| VAR CONSTANT var_init_decl_list END_VAR
{$$ = new var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in variable(s) declaration.");
+ }
+| VAR CONSTANT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in constant variable(s) declaration.");
+ }
+| VAR error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in variable(s) declaration.");
+ yyerrok;
+ }
+| VAR CONSTANT error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant variable(s) declaration.");
+ yyerrok;
+ }
+| VAR error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in variable(s) declaration.");
+ yyerrok;
+ }
+| VAR CONSTANT error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in constant variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2879,10 +3916,19 @@
VAR RETAIN var_init_decl_list END_VAR
{$$ = new retentive_var_declarations_c($3, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive variable(s) declaration.");
+ }
+| VAR RETAIN error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive variable(s) declaration.");
+ yyerrok;
+ }
| VAR RETAIN error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in retentive variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -2890,7 +3936,7 @@
located_var_declarations:
- VAR located_var_decl_list END_VAR
+ VAR located_var_decl_list END_VAR
{$$ = new located_var_declarations_c(NULL, $2, locloc(@$));}
| VAR CONSTANT located_var_decl_list END_VAR
{$$ = new located_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
@@ -2898,6 +3944,38 @@
{$$ = new located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
| VAR NON_RETAIN located_var_decl_list END_VAR
{$$ = new located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR NON_RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in non-retentive located variable(s) declaration.");
+ }
+| VAR error located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR CONSTANT error located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR RETAIN error located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR NON_RETAIN error located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR NON_RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in non retentive variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2907,6 +3985,23 @@
{$$ = new located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
| located_var_decl_list located_var_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| located_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of located variable declaration.");
+ yyerrok;
+ }
+| located_var_decl_list located_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of located variable declaration.");
+ yyerrok;
+ }
+| located_var_decl_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after located variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2917,6 +4012,28 @@
}
| location ':' located_var_spec_init
{$$ = new located_var_decl_c(NULL, $1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| variable_name location located_var_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between located variable location and specification.");
+ }
+| location located_var_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between located variable location and specification.");
+ }
+| variable_name location ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in located variable declaration.");
+ yyerrok;
+ }
+| location ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in located variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2928,10 +4045,34 @@
| VAR_EXTERNAL CONSTANT external_declaration_list END_VAR
{$$ = new external_var_declarations_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR_EXTERNAL END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in external variable(s) declaration.");
+ }
+| VAR_EXTERNAL CONSTANT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "no variable declared in constant external variable(s) declaration.");
+ }
+| VAR_EXTERNAL error external_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@4), "unexpected token after 'VAR_EXTERNAL' in external variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_EXTERNAL CONSTANT error external_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@5), "unexpected token after 'CONSTANT' in constant external variable(s) declaration.");
+ yyerrok;
+ }
| VAR_EXTERNAL error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in external variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in external variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_EXTERNAL CONSTANT error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant external variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -2941,8 +4082,25 @@
external_declaration_list:
external_declaration ';'
{$$ = new external_declaration_list_c(locloc(@$)); $$->add_element($1);}
-| external_declaration_list external_declaration';'
+| external_declaration_list external_declaration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| external_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of external variable declaration.");
+ yyerrok;
+ }
+| external_declaration_list external_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of external variable declaration.");
+ yyerrok;
+ }
+| external_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after external variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -2971,6 +4129,48 @@
{$$ = new external_declaration_c($1, $3, locloc(@$));
variable_name_symtable.insert($1, prev_declared_fb_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| global_var_name simple_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and simple specification.");
+ }
+| global_var_name subrange_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and subrange specification.");
+ }
+| global_var_name enumerated_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and enumerated specification.");
+ }
+| global_var_name array_specification
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and array specification.");
+ }
+| global_var_name prev_declared_structure_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and structured specification.");
+ }
+| global_var_name function_block_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between external variable name and function block type specification.");
+ }
+| global_var_name ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unknown type name in external variable declaration.");
+ }
+| global_var_name ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in external variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -2985,10 +4185,49 @@
| VAR_GLOBAL RETAIN global_var_decl_list END_VAR
{$$ = new global_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
/* ERROR_CHECK_BEGIN */
+| VAR_GLOBAL END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in global variable(s) declaration.");
+ }
+| VAR_GLOBAL CONSTANT END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in constant global variable(s) declaration.");
+ }
+| VAR_GLOBAL RETAIN END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable declared in retentive global variable(s) declaration.");
+ }
+| VAR_GLOBAL error global_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_GLOBAL' in global variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_GLOBAL CONSTANT error global_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant global variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_GLOBAL RETAIN error global_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive global variable(s) declaration.");
+ yyerrok;
+ }
| VAR_GLOBAL error END_VAR
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in global variable(s) declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in global variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_GLOBAL CONSTANT error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant global variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_GLOBAL RETAIN error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown error in constant global variable(s) declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -3001,16 +4240,62 @@
{$$ = new global_var_decl_list_c(locloc(@$)); $$->add_element($1);}
| global_var_decl_list global_var_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| global_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of global variable declaration.");
+ yyerrok;
+ }
+| global_var_decl_list global_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of global variable declaration.");
+ yyerrok;
+ }
+| global_var_decl_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after global variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
global_var_decl:
+/* NOTE : This possibility defined in standard has no sense and generate a conflict (disabled)
global_var_spec ':'
{$$ = new global_var_decl_c($1, NULL, locloc(@$));}
-| global_var_spec ':' located_var_spec_init
+*/
+ global_var_spec ':' located_var_spec_init
{$$ = new global_var_decl_c($1, $3, locloc(@$));}
| global_var_spec ':' function_block_type_name
{$$ = new global_var_decl_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| global_var_list located_var_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between global variable list and type specification.");
+ }
+| global_var_name location located_var_spec_init
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@3), "':' missing between global variable specification and type specification.");
+ }
+| global_var_spec function_block_type_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between global variable specification and function block type specification.");
+ }
+| global_var_spec ':' identifier
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@3), "unknown variable type defined in global variable declaration.");
+ }
+| global_var_spec ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in global variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3022,7 +4307,6 @@
{$$ = new global_var_spec_c($1, $2, locloc(@$));
variable_name_symtable.insert($1, prev_declared_global_var_name_token);
}
-
;
@@ -3040,6 +4324,13 @@
location:
AT direct_variable
{$$ = new location_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| AT error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid location in location declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3053,6 +4344,18 @@
{$$ = $1; $$->add_element($3);
variable_name_symtable.insert($3, prev_declared_global_var_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| global_var_list global_var_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "',' missing in global variable list.");
+ }
+| global_var_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ',' in global variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3065,6 +4368,13 @@
single_byte_string_var_declaration:
var1_list ':' single_byte_string_spec
{$$ = new single_byte_string_var_declaration_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list single_byte_string_spec
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and string type specification.");
+ }
+/* ERROR_CHECK_END */
;
/* NOTE: The constructs
@@ -3111,12 +4421,61 @@
*/
| STRING '[' integer ']' ASSIGN single_byte_character_string
{$$ = new single_byte_string_spec_c($3, $6, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| STRING '[' error ']'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited string type specification.");
+ yyerrok;
+ }
+| STRING '[' error ']' ASSIGN single_byte_character_string
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited string type specification.");
+ yyerrok;
+ }
+| STRING '[' ']'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited string type specification.");
+ }
+| STRING '[' ']' ASSIGN single_byte_character_string
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited string type specification.");
+ }
+| STRING '[' integer error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@3), "expecting ']' after length definition for limited string type specification.");
+ yyerrok;
+ }
+| STRING '[' integer error ASSIGN single_byte_character_string
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting ']' after length definition for limited string type specification.");
+ yyerrok;
+ }
+| STRING '[' integer ']' single_byte_character_string
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "':=' missing before limited string type initialization.");
+ }
+| STRING '[' integer ']' ASSIGN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@5), "invalid value for limited string type initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
double_byte_string_var_declaration:
var1_list ':' double_byte_string_spec
{$$ = new double_byte_string_var_declaration_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| var1_list double_byte_string_spec
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between variable list and double byte string type specification.");
+ }
+/* ERROR_CHECK_END */
;
double_byte_string_spec:
@@ -3131,6 +4490,48 @@
*/
| WSTRING '[' integer ']' ASSIGN double_byte_character_string
{$$ = new double_byte_string_spec_c($3, $6, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| WSTRING '[' error ']'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited double byte string type specification.");
+ yyerrok;
+ }
+| WSTRING '[' error ']' ASSIGN single_byte_character_string
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid length value for limited double byte string type specification.");
+ yyerrok;
+ }
+| WSTRING '[' ']'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited double byte string type specification.");
+ }
+| WSTRING '[' ']' ASSIGN single_byte_character_string
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "missing length value for limited double byte string type specification.");
+ }
+| WSTRING '[' integer error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@3), "expecting ']' after length definition for limited double byte string type specification.");
+ yyerrok;
+ }
+| WSTRING '[' integer error ASSIGN single_byte_character_string
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting ']' after length definition for limited double byte string type specification.");
+ yyerrok;
+ }
+| WSTRING '[' integer ']' single_byte_character_string
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "':=' missing before limited double byte string type initialization.");
+ }
+| WSTRING '[' integer ']' ASSIGN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@5), "invalid value for limited double byte string type initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3142,6 +4543,23 @@
{$$ = new incompl_located_var_declarations_c(new retain_option_c(locloc(@2)), $3, locloc(@$));}
| VAR NON_RETAIN incompl_located_var_decl_list END_VAR
{$$ = new incompl_located_var_declarations_c(new non_retain_option_c(locloc(@2)), $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR error incompl_located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in incomplete located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR RETAIN error incompl_located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive located variable(s) declaration.");
+ yyerrok;
+ }
+| VAR NON_RETAIN error incompl_located_var_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive located variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for incompl_located_var_declarations */
@@ -3150,12 +4568,41 @@
{$$ = new incompl_located_var_decl_list_c(locloc(@$)); $$->add_element($1);}
| incompl_located_var_decl_list incompl_located_var_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| incompl_located_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of incomplete located variable declaration.");
+ yyerrok;
+ }
+| incompl_located_var_decl_list incompl_located_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of incomplete located variable declaration.");
+ yyerrok;
+ }
+| incompl_located_var_decl_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after incomplete located variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
incompl_located_var_decl:
variable_name incompl_location ':' var_spec
{$$ = new incompl_located_var_decl_c($1, $2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| variable_name incompl_location ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no specification defined in incomplete located variable declaration.");
+ yyerrok;
+ }
+| variable_name incompl_location var_spec
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':' missing between incomplete located variable and type specification.");
+ }
+/* ERROR_CHECK_END */
;
@@ -3212,6 +4659,13 @@
{$$ = new var_init_decl_list_c(locloc(@$)); $$->add_element($1);}
| var_init_decl_list var_init_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| var_init_decl_list var_init_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of variable declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3423,10 +4877,69 @@
}
}
/* ERROR_CHECK_BEGIN */
-| FUNCTION error END_FUNCTION
- {$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in function declaration.");
- /* yychar */
+| function_name_declaration elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after function name in function declaration.");
+ }
+| function_name_declaration derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after function name in function declaration.");
+ }
+| function_name_declaration error derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' after function name in function declaration.");
+ yyerrok;
+ }
+| function_name_declaration ':' io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no return type defined in function declaration.");
+ }
+| function_name_declaration ':' error io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid return type defined in function declaration.");
+ yyerrok;
+ }
+| function_name_declaration ':' identifier io_OR_function_var_declarations_list function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown return type defined in function declaration.");
+ }
+| function_name_declaration ':' elementary_type_name function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared in function declaration.");
+ }
+| function_name_declaration ':' derived_type_name function_body END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared in function declaration.");
+ }
+| function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "no body defined in function declaration.");
+ }
+| function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "no body defined in function declaration.");
+ }
+| function_name_declaration ':' elementary_type_name END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared and body defined in function declaration.");
+ }
+| function_name_declaration ':' derived_type_name END_FUNCTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no variable(s) declared and body defined in function declaration.");
+ }
+| function_name_declaration error END_FUNCTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in function declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -3476,18 +4989,34 @@
*/
variable_name_symtable.insert($2, prev_declared_variable_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| FUNCTION error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "no function name defined in function declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* intermediate helper symbol for function_declaration */
io_OR_function_var_declarations_list:
- /* empty */
- {$$ = new var_declarations_list_c(locloc(@$));}
+ io_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);}
+| function_var_decls
+ {$$ = new var_declarations_list_c(locloc(@1));$$->add_element($1);}
| io_OR_function_var_declarations_list io_var_declarations
{$$ = $1; $$->add_element($2);}
| io_OR_function_var_declarations_list function_var_decls
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| io_OR_function_var_declarations_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in function declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3503,6 +5032,18 @@
{$$ = new function_var_decls_c(new constant_option_c(locloc(@2)), $3, locloc(@$));}
| VAR var2_init_decl_list END_VAR
{$$ = new function_var_decls_c(NULL, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR' in function variable(s) declaration.");
+ yyerrok;
+ }
+| VAR CONSTANT error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'CONSTANT' in constant function variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* intermediate helper symbol for function_var_decls */
@@ -3511,6 +5052,23 @@
{$$ = new var2_init_decl_list_c(locloc(@$)); $$->add_element($1);}
| var2_init_decl_list var2_init_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| var2_init_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of function variable(s) declaration.");
+ yyerrok;
+ }
+| var2_init_decl_list var2_init_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of function variable(s) declaration.");
+ yyerrok;
+ }
+| var2_init_decl_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after function variable(s) declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -3559,10 +5117,34 @@
variable_name_symtable.pop();
}
/* ERROR_CHECK_BEGIN */
+| FUNCTION_BLOCK io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in function block declaration.");
+ }
+| FUNCTION_BLOCK error io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name in function block declaration.");
+ yyerrok;
+ }
+| FUNCTION_BLOCK derived_function_block_name function_block_body END_FUNCTION_BLOCK
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared in function declaration.");
+ }
+| FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list END_FUNCTION_BLOCK
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in function block declaration.");
+ }
+| FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared and body defined in function block declaration.");
+ }
| FUNCTION_BLOCK error END_FUNCTION_BLOCK
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in function block declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in function block declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -3576,12 +5158,21 @@
* NOTE: we re-use the var_declarations_list_c
*/
io_OR_other_var_declarations_list:
- /* empty */
- {$$ = new var_declarations_list_c(locloc(@$));}
+ io_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);}
+| other_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@$));$$->add_element($1);}
| io_OR_other_var_declarations_list io_var_declarations
{$$ = $1; $$->add_element($2);}
| io_OR_other_var_declarations_list other_var_declarations
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| io_OR_other_var_declarations_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in function declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* NOTE:
@@ -3607,21 +5198,24 @@
| var_declarations
| retentive_var_declarations
| incompl_located_var_declarations
-/* TODO: the following error rule is not working! Must be fixed. */
-/* ERROR_CHECK_BEGIN */
-| VAR error END_VAR
- {$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in variable(s) declaration.");
- /* yychar */
- yyerrok;
- }
-/* ERROR_CHECK_END */
;
temp_var_decls:
VAR_TEMP temp_var_decls_list END_VAR
{$$ = new temp_var_decls_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR_TEMP END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in temporary variable(s) declaration.");
+ }
+| VAR_TEMP error temp_var_decls_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_TEMP' in function variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3631,12 +5225,36 @@
{$$ = new temp_var_decls_list_c(locloc(@$)); $$->add_element($1);}
| temp_var_decls_list temp_var_decl ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| temp_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at end of temporary variable declaration.");
+ yyerrok;
+ }
+| temp_var_decls_list temp_var_decl error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of temporary variable declaration.");
+ yyerrok;
+ }
+| temp_var_decls_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after temporary variable declaration.");
+ }
+/* ERROR_CHECK_END */
;
non_retentive_var_decls:
VAR NON_RETAIN var_init_decl_list END_VAR
{$$ = new non_retentive_var_decls_c($3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR NON_RETAIN error var_init_decl_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive temporary variable(s) declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3673,10 +5291,34 @@
variable_name_symtable.pop();
}
/* ERROR_CHECK_BEGIN */
+| PROGRAM program_var_declarations_list function_block_body END_PROGRAM
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no program name defined in program declaration.");
+ }
+| PROGRAM error program_var_declarations_list function_block_body END_PROGRAM
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid program name in program declaration.");
+ yyerrok;
+ }
+| PROGRAM program_type_name function_block_body END_PROGRAM
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared in program declaration.");
+ }
+| PROGRAM program_type_name program_var_declarations_list END_PROGRAM
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in program declaration.");
+ }
+| PROGRAM program_type_name END_PROGRAM
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no variable(s) declared and body defined in program declaration.");
+ }
| PROGRAM error END_PROGRAM
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in function block declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in program declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -3688,8 +5330,12 @@
* NOTE: we re-use the var_declarations_list_c
*/
program_var_declarations_list:
- /* empty */
- {$$ = new var_declarations_list_c(locloc(@$));}
+ io_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
+| other_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
+| located_var_declarations
+ {$$ = new var_declarations_list_c(locloc(@$)); $$->add_element($1);}
| program_var_declarations_list io_var_declarations
{$$ = $1; $$->add_element($2);}
| program_var_declarations_list other_var_declarations
@@ -3700,6 +5346,13 @@
| program_var_declarations_list program_access_decls
{$$ = $1; $$->add_element($2);}
*/
+/* ERROR_CHECK_BEGIN */
+| program_var_declarations_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after variable(s) declaration in program declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3747,18 +5400,89 @@
{$$ = $1; $$->add_element($2);}
| sfc_network action
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| sfc_network error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after SFC network in sequencial function chart.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
initial_step:
INITIAL_STEP step_name ':' action_association_list END_STEP
// INITIAL_STEP identifier ':' action_association_list END_STEP
{$$ = new initial_step_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| INITIAL_STEP ':' action_association_list END_STEP
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no step name defined in initial step declaration.");
+ }
+| INITIAL_STEP error ':' action_association_list END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid step name defined in initial step declaration.");
+ yyerrok;
+ }
+| INITIAL_STEP step_name action_association_list END_STEP
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "':' missing after step name in initial step declaration.");
+ }
+| INITIAL_STEP step_name error action_association_list END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':' after step name in initial step declaration.");
+ yyerrok;
+ }
+| INITIAL_STEP step_name ':' error END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid action association list in initial step declaration.");
+ yyerrok;
+ }
+| INITIAL_STEP error END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in initial step declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
step:
STEP step_name ':' action_association_list END_STEP
// STEP identifier ':' action_association_list END_STEP
{$$ = new step_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| STEP ':' action_association_list END_STEP
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no step name defined in step declaration.");
+ }
+| STEP error ':' action_association_list END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid step name defined in step declaration.");
+ yyerrok;
+ }
+| STEP step_name action_association_list END_STEP
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "':' missing after step name in step declaration.");
+ }
+| STEP step_name error action_association_list END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':' after step name in step declaration.");
+ yyerrok;
+ }
+| STEP step_name ':' error END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid action association list in step declaration.");
+ yyerrok;
+ }
+| STEP error END_STEP
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in step declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for:
@@ -3770,6 +5494,18 @@
{$$ = new action_association_list_c(locloc(@$));}
| action_association_list action_association ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| action_association_list action_association error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at end of action association declaration.");
+ yyerrok;
+ }
+| action_association_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after action association declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -3779,6 +5515,13 @@
action_association:
action_name '(' {cmd_goto_sfc_qualifier_state()} action_qualifier {cmd_pop_state()} indicator_name_list ')'
{$$ = new action_association_c($1, $4, $6, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+/*| action_name '(' error indicator_name_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid qualifier defined in action association.");
+ yyerrok;
+ }*/
+/* ERROR_CHECK_END */
;
/* helper symbol for action_association */
@@ -3787,6 +5530,18 @@
{$$ = new indicator_name_list_c(locloc(@$));}
| indicator_name_list ',' indicator_name
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| indicator_name_list indicator_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at end of action association declaration.");
+ }
+| indicator_name_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected token after ',' in indicator list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
// action_name: identifier;
@@ -3799,6 +5554,18 @@
{$$ = new action_qualifier_c($1, NULL, locloc(@$));}
| timed_qualifier ',' action_time
{$$ = new action_qualifier_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| timed_qualifier action_time
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "',' missing between timed qualifier and action time in action qualifier.");
+ }
+| timed_qualifier ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected token after ',' in action qualifier.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
qualifier:
@@ -3832,6 +5599,18 @@
{$$ = new steps_c($1, NULL, locloc(@$));}
| '(' step_name_list ')'
{$$ = new steps_c(NULL, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| '(' step_name_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting ')' at the end of step list in transition declaration.");
+ yyerrok;
+ }
+| '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid step list in transition declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
step_name_list:
@@ -3839,6 +5618,18 @@
{$$ = new step_name_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
| step_name_list ',' step_name
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| step_name_list step_name
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in step list.");
+ }
+| step_name_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid step name in step list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3847,30 +5638,112 @@
* after forcing flex to go to body_state.
*/
transition:
- TRANSITION
+ TRANSITION transition_priority
FROM steps TO steps
{cmd_goto_body_state();} transition_condition
END_TRANSITION
- {$$ = new transition_c(NULL, NULL, $3, $5, $7, locloc(@$));}
+ {$$ = new transition_c(NULL, $2, $4, $6, $8, locloc(@$));}
//| TRANSITION identifier FROM steps TO steps ...
-| TRANSITION transition_name
+| TRANSITION transition_name transition_priority
FROM steps TO steps
{cmd_goto_body_state();} transition_condition
END_TRANSITION
- {$$ = new transition_c($2, NULL, $4, $6, $8, locloc(@$));}
-| TRANSITION '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')'
- FROM steps TO steps
- {cmd_goto_body_state();} transition_condition
- END_TRANSITION
- {$$ = new transition_c(NULL, $7, $10, $12, $14, locloc(@$));}
-//| TRANSITION identifier '(' PRIORITY ASSIGN integer ')' FROM steps TO steps ...
-| TRANSITION transition_name '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')'
- FROM steps TO steps
- {cmd_goto_body_state();} transition_condition
- END_TRANSITION
- {$$ = new transition_c($2, $8, $11, $13, $15, locloc(@$));}
-;
-
+ {$$ = new transition_c($2, $3, $5, $7, $9, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| TRANSITION error transition_priority FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid transition name defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_name error FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid transition priority defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no origin step(s) defined in transition declaration.");
+ }
+| TRANSITION transition_name transition_priority FROM TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "no origin step(s) defined in transition declaration.");
+ }
+| TRANSITION transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid origin step(s) defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_name transition_priority FROM error TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "invalid origin step(s) defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "'TO' missing between origin step(s) and destination step(s) in transition declaration.");
+ }
+| TRANSITION transition_name transition_priority FROM steps steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@5), locl(@6), "'TO' missing between origin step(s) and destination step(s) in transition declaration.");
+ }
+| TRANSITION transition_priority FROM steps error steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between origin step(s) and destination step(s) in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_name transition_priority FROM steps error steps {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@7), "expecting 'TO' between origin step(s) and destination step(s) in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@5), locl(@7), "no destination step(s) defined in transition declaration.");
+ }
+| TRANSITION transition_name transition_priority FROM steps TO {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@6), locl(@8), "no destination step(s) defined in transition declaration.");
+ }
+| TRANSITION transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@8), "invalid destination step(s) defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_name transition_priority FROM steps TO error {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@6), locl(@9), "invalid destination step(s) defined in transition declaration.");
+ yyerrok;
+ }
+| TRANSITION transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "no origin and destination step(s) defined in transition declaration.");
+ }
+| TRANSITION transition_name transition_priority {cmd_goto_body_state();} transition_condition END_TRANSITION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@5), "no origin and destination step(s) defined in transition declaration.");
+ }
+| TRANSITION error END_TRANSITION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in transition declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
+;
+
+transition_priority:
+ /* empty */
+ {$$ = NULL;}
+| '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')'
+ {$$ = $6;}
+;
transition_condition:
@@ -3878,6 +5751,33 @@
{$$ = new transition_condition_c($3, NULL, locloc(@$));}
| ASSIGN expression ';'
{$$ = new transition_condition_c(NULL, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| eol_list simple_instr_list
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "':' missing before IL condition in transition declaration.");
+ }
+| ':' eol_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no instructions defined in IL condition of transition declaration.");
+ yyerrok;
+ }
+| ASSIGN ';'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no expression defined in ST condition of transition declaration.");
+ yyerrok;
+ }
+| ASSIGN error ';'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression defined in ST condition of transition declaration.");
+ yyerrok;
+ }
+| ASSIGN expression error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting ';' after expression defined in ST condition of transition declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3886,6 +5786,33 @@
// 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;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no action name defined in action declaration.");
+ }
+| ACTION error ':' {cmd_goto_body_state();} function_block_body END_ACTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid action name defined in action declaration.");
+ yyerrok;
+ }
+| ACTION action_name {cmd_goto_body_state();} function_block_body END_ACTION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "':' missing after action name in action declaration.");
+ }
+| ACTION action_name ':' END_ACTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no body defined in action declaration.");
+ yyerrok;
+ }
+| ACTION error END_ACTION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in action declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -3915,7 +5842,7 @@
* each of the groups (resource, program, global variables), produces
* reduce/reduce conflicts in the syntax parser. Actually, it is only
* the resource names that need to be distinguished into a
- * prev_delcared_resource_name so as not to conflict with [gloabl] variable
+ * prev_declared_resource_name so as not to conflict with [gloabl] variable
* names in the 'data' construct.
* The program names are only tracked to make sure that two programs do not
* get the same name.
@@ -3976,10 +5903,70 @@
variable_name_symtable.pop();
}
/* ERROR_CHECK_BEGIN */
+| CONFIGURATION
+ optional_global_var_declarations
+ single_resource_declaration
+ {variable_name_symtable.pop();}
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no configuration name defined in configuration declaration.");
+ }
+| CONFIGURATION
+ optional_global_var_declarations
+ resource_declaration_list
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no configuration name defined in configuration declaration.");
+ }
+| CONFIGURATION error
+ optional_global_var_declarations
+ single_resource_declaration
+ {variable_name_symtable.pop();}
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid configuration name defined in configuration declaration.");
+ yyerrok;
+ }
+| CONFIGURATION error
+ optional_global_var_declarations
+ resource_declaration_list
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid configuration name defined in configuration declaration.");
+ yyerrok;
+ }
+| CONFIGURATION configuration_name
+ optional_global_var_declarations
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no resource(s) defined in configuration declaration.");
+ yyerrok;
+ }
+| CONFIGURATION configuration_name
+ optional_global_var_declarations
+ error
+ optional_access_declarations
+ optional_instance_specific_initializations
+ END_CONFIGURATION
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid resource(s) defined in configuration declaration.");
+ yyerrok;
+ }
| CONFIGURATION error END_CONFIGURATION
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in configuration declaration.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in configuration declaration.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -4016,6 +6003,13 @@
{$$ = new resource_declaration_list_c(locloc(@$)); $$->add_element($1);}
| resource_declaration_list resource_declaration
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| resource_declaration_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected token after resource declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4028,6 +6022,21 @@
variable_name_symtable.pop();
variable_name_symtable.insert($3, prev_declared_resource_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| RESOURCE {variable_name_symtable.push();} ON resource_type_name
+ optional_global_var_declarations
+ single_resource_declaration
+ END_RESOURCE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "no resource name defined in resource declaration.");
+ }
+| RESOURCE error END_RESOURCE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in resource declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4043,6 +6052,18 @@
{$$ = new task_configuration_list_c(locloc(@$));}
| task_configuration_list task_configuration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| task_configuration_list task_configuration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of task configuration in resource declaration.");
+ yyerrok;
+ }
+| task_configuration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "unexpected ';' after task configuration in resource declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4052,6 +6073,23 @@
{$$ = new program_configuration_list_c(locloc(@$)); $$->add_element($1);}
| program_configuration_list program_configuration ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| program_configuration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of program configuration in resource declaration.");
+ yyerrok;
+ }
+| program_configuration_list program_configuration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of program configuration in resource declaration.");
+ yyerrok;
+ }
+| program_configuration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after program configuration in resource declaration.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4061,12 +6099,46 @@
access_declarations:
VAR_ACCESS access_declaration_list END_VAR
{$$ = NULL;}
+// ERROR_CHECK_BEGIN //
+| VAR_ACCESS END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in access variable(s) declaration.");
+ }
+| VAR_ACCESS error access_declaration_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_ACCESS' in access variable(s) declaration.");
+ yyerrok;
+ }
+| VAR_ACCESS error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in access variable(s) declaration.");
+ yyerrok;
+ }
+// ERROR_CHECK_END //
;
// helper symbol for access_declarations //
access_declaration_list:
access_declaration ';'
| access_declaration_list access_declaration ';'
+// ERROR_CHECK_BEGIN //
+| access_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of access variable declaration.");
+ yyerrok;
+ }
+| access_declaration_list access_declaration error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of access variable declaration.");
+ yyerrok;
+ }
+| access_declaration_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after access variable declaration.");
+ }
+// ERROR_CHECK_END //
;
@@ -4078,11 +6150,11 @@
access_path:
direct_variable
-| prev_delcared_resource_name '.' direct_variable
+| prev_declared_resource_name '.' direct_variable
| any_fb_name_list symbolic_variable
-| prev_delcared_resource_name '.' any_fb_name_list symbolic_variable
-| prev_delcared_program_name '.' any_fb_name_list symbolic_variable
-| prev_delcared_resource_name '.' prev_delcared_program_name '.' any_fb_name_list symbolic_variable
+| prev_declared_resource_name '.' any_fb_name_list symbolic_variable
+| prev_declared_program_name '.' any_fb_name_list symbolic_variable
+| prev_declared_resource_name '.' prev_declared_program_name '.' any_fb_name_list symbolic_variable
;
*/
@@ -4158,6 +6230,23 @@
task_configuration:
TASK task_name task_initialization
{$$ = new task_configuration_c($2, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| TASK task_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no task name defined in task declaration.");
+ }
+| TASK error task_initialization
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid task name defined in task declaration.");
+ yyerrok;
+ }
+| TASK task_name error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid task initialization in task declaration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* NOTE: The specification does not mention the namespace to which task names
@@ -4183,6 +6272,28 @@
{$$ = NULL;}
| SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
{$$ = $4;}
+/* ERROR_CHECK_BEGIN */
+| SINGLE {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'SINGLE' in task initialization.");
+ }
+| SINGLE error {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@4), "expecteing ':=' after 'SINGLE' in task initialization.");
+ yyerrok;
+ }
+| SINGLE ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "no data source defined in 'SINGLE' statement of task initialization.");
+ }
+| SINGLE ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@5), "invalid data source defined in 'SINGLE' statement of task initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4192,6 +6303,28 @@
{$$ = NULL;}
| INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
{$$ = $4;}
+/* ERROR_CHECK_BEGIN */
+| INTERVAL {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'INTERVAL' in task initialization.");
+ }
+| INTERVAL error {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@4), "expecting ':=' after 'INTERVAL' in task initialization.");
+ yyerrok;
+ }
+| INTERVAL ASSIGN {cmd_pop_state();} ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "no data source defined in 'INTERVAL' statement of task initialization.");
+ }
+| INTERVAL ASSIGN {cmd_pop_state();} error ',' {cmd_goto_task_init_state();}
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@5), "invalid data source defined in 'INTERVAL' statement of task initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4200,6 +6333,23 @@
// PRIORITY ASSIGN integer
PRIORITY ASSIGN {cmd_pop_state();} integer
{$$ = $4;}
+/* ERROR_CHECK_BEGIN */
+| PRIORITY {cmd_pop_state();} integer
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "':=' missing after 'PRIORITY' in task initialization.");
+ }
+| PRIORITY error {cmd_pop_state();} integer
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@4), "expecting ':=' after 'PRIORITY' in task initialization.");
+ yyerrok;
+ }
+| PRIORITY ASSIGN {cmd_pop_state();} error
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "no priority number defined in 'PRIORITY' statement of task initialization.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4225,6 +6375,113 @@
{$$ = new program_configuration_c(new non_retain_option_c(locloc(@2)), $3, $4, $6, $7, locloc(@$));
variable_name_symtable.insert($3, prev_declared_program_name_token);
}
+/* ERROR_CHECK_BEGIN */
+| PROGRAM program_name optional_task_name ':' identifier optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown program type name after ':' in program configuration.");
+ }
+| PROGRAM RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown program type name after ':' in program configuration.");
+ }
+| PROGRAM NON_RETAIN program_name optional_task_name ':' identifier optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unknown program type name after ':' in program configuration.");
+ }
+| PROGRAM error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'PROGRAM' in program configuration.");
+ yyerrok;
+ }
+| PROGRAM RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'RETAIN' in retentive program configuration.");
+ yyerrok;
+ }
+| PROGRAM NON_RETAIN error program_name optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "unexpected token after 'NON_RETAIN' in non-retentive program configuration.");
+ yyerrok;
+ }
+| PROGRAM optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no program name defined in program configuration.");
+ }
+| PROGRAM RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no program name defined in retentive program configuration.");
+ }
+| PROGRAM NON_RETAIN optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "no program name defined in non-retentive program configuration.");
+ }
+| PROGRAM error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "no program name defined in program configuration.");
+ yyerrok;
+ }
+| PROGRAM RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "no program name defined in retentive program configuration.");
+ yyerrok;
+ }
+| PROGRAM NON_RETAIN error optional_task_name ':' prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "no program name defined in non-retentive program configuration.");
+ yyerrok;
+ }
+| PROGRAM program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "':' missing after program name or optional task name in program configuration.");
+ }
+| PROGRAM RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "':' missing after program name or optional task name in program configuration.");
+ }
+| PROGRAM NON_RETAIN program_name optional_task_name prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "':' missing after program name or optional task name in program configuration.");
+ }
+| PROGRAM program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "expecting ':' after program name or optional task name in program configuration.");
+ yyerrok;
+ }
+| PROGRAM RETAIN program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting ':' after program name or optional task name in program configuration.");
+ yyerrok;
+ }
+| PROGRAM NON_RETAIN program_name optional_task_name error prev_declared_program_type_name optional_prog_conf_elements
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting ':' after program name or optional task name in program configuration.");
+ yyerrok;
+ }
+| PROGRAM program_name optional_task_name ':' optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@4), locl(@5), "no program type defined in program configuration.");
+ }
+| PROGRAM RETAIN program_name optional_task_name ':' optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@5), locl(@6), "no program type defined in program configuration.");
+ }
+| PROGRAM NON_RETAIN program_name optional_task_name ':' optional_prog_conf_elements
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@5), locl(@6), "no program type defined in program configuration.");
+ }
+/* ERROR_CHECK_END */
;
// helper symbol for program_configuration //
@@ -4233,6 +6490,13 @@
{$$ = NULL;}
| WITH task_name
{$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| WITH error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid tack name in optional task name of program configuration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
// helper symbol for program_configuration //
@@ -4241,6 +6505,18 @@
{$$ = NULL;}
| '(' prog_conf_elements ')'
{$$ = $2;}
+/* ERROR_CHECK_BEGIN */
+| '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid program configuration elements in program configuration.");
+ yyerrok;
+ }
+| '(' prog_conf_elements error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of program configuration elements in program configuration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4249,6 +6525,18 @@
{$$ = new prog_conf_elements_c(locloc(@$)); $$->add_element($1);}
| prog_conf_elements ',' prog_conf_element
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| prog_conf_elements prog_conf_element
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in program configuration elements list.");
+ }
+| prog_conf_elements ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value for program configuration element in program configuration list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4266,6 +6554,13 @@
*/
any_identifier WITH task_name
{$$ = new fb_task_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| any_identifier WITH error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid task name in function block configuration.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4304,6 +6599,38 @@
{$$ = new prog_cnxn_assign_c($1, $3, locloc(@$));}
| any_symbolic_variable SENDTO data_sink
{$$ = new prog_cnxn_sendto_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| any_symbolic_variable constant
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between parameter and value in program configuration element.");
+ }
+| any_symbolic_variable enumerated_value
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between parameter and value in program configuration element.");
+ }
+| any_symbolic_variable data_sink
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':=' or '=>' missing between parameter and variable in program configuration element.");
+ }
+| any_symbolic_variable error prog_data_source
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting ':=' or '=>' after parameter in program configuration element.");
+ yyerrok;
+ }
+| any_symbolic_variable ASSIGN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid value or variable in program configuration assignment element.");
+ yyerrok;
+ }
+| any_symbolic_variable SENDTO error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid variable in program configuration sendto element.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
prog_data_source:
@@ -4321,6 +6648,23 @@
instance_specific_initializations:
VAR_CONFIG instance_specific_init_list END_VAR
{$$ = new instance_specific_initializations_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| VAR_CONFIG END_VAR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no variable declared in configuration variable(s) initialization.");
+ }
+| VAR_CONFIG error instance_specific_init_list END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unexpected token after 'VAR_CONFIG' in configuration variable(s) initialization.");
+ yyerrok;
+ }
+| VAR_CONFIG error END_VAR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in configuration variable(s) initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
// helper symbol for instance_specific_initializations //
@@ -4329,6 +6673,23 @@
{$$ = new instance_specific_init_list_c(locloc(@$)); $$->add_element($1);}
| instance_specific_init_list instance_specific_init ';'
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| instance_specific_init error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of configuration variable initialization.");
+ yyerrok;
+ }
+| instance_specific_init_list instance_specific_init error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of configuration variable initialization.");
+ yyerrok;
+ }
+| instance_specific_init_list ';'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "unexpected ';' after configuration variable initialization.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4358,6 +6719,18 @@
fb_initialization:
function_block_type_name ASSIGN structure_initialization
{$$ = new fb_initialization_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| function_block_type_name structure_initialization
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "':=' missing between function block name and initialization in function block initialization.");
+ }
+| function_block_type_name error structure_initialization
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "expecting ':=' after function block name in function block initialization.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/***********************************/
@@ -4382,6 +6755,13 @@
{$$ = $1; $$->add_element($2);}
| instruction_list pragma
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| instruction_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid IL instruction.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4394,14 +6774,37 @@
/* ERROR_CHECK_BEGIN */
| error eol_list
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@1), "error in IL instruction.");
- yyerrok;
- }
-/* ERROR_CHECK_END */
-/* ERROR_CHECK_BEGIN */
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid IL instruction.");
+ yyerrok;
+ }
+| il_incomplete_instruction error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of IL instruction.");
+ yyerrok;
+ }
+| error ':' il_incomplete_instruction eol_list
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid label in IL instruction.");
+ yyerrok;
+ }
+| label il_incomplete_instruction eol_list
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after label in IL instruction.");
+ }
+| label error il_incomplete_instruction eol_list
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting ':' after label in IL instruction.");
+ yyerrok;
+ }
| label ':' error eol_list
{$$ = NULL;
- print_err_msg(current_filename, locf(@1), locl(@3), "error in IL instruction.");
+ print_err_msg(current_filename, locf(@2), locl(@4), "invalid IL instruction.");
+ yyerrok;
+ }
+| label ':' il_incomplete_instruction error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of IL instruction.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -4520,12 +6923,56 @@
{$$ = new il_expression_c($1, $3, $5, locloc(@$));}
| il_expr_operator_clash_eol_list simple_instr_list ')'
{$$ = new il_expression_c($1, NULL, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| il_expr_operator_noclash '(' eol_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@3), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_noclash '(' il_operand eol_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_noclash '(' eol_list simple_instr_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_noclash '(' il_operand eol_list simple_instr_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@5), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_clash '(' il_operand eol_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@4), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_clash '(' il_operand eol_list simple_instr_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@5), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+| il_expr_operator_clash_eol_list simple_instr_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of IL expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
il_jump_operation:
il_jump_operator label
{$$ = new il_jump_operation_c($1, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| il_jump_operator error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid label defined in IL jump operation.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4541,6 +6988,78 @@
{$$ = new il_fb_call_c($1, $2, $4, NULL, locloc(@$));}
| il_call_operator prev_declared_fb_name '(' eol_list il_param_list ')'
{$$ = new il_fb_call_c($1, $2, NULL, $5, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| il_call_operator error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid function block name defined in IL function block call.");
+ yyerrok;
+ }
+| il_call_operator '(' ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
+ }
+| il_call_operator '(' eol_list ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
+ }
+| il_call_operator '(' il_operand_list ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
+ }
+| il_call_operator '(' eol_list il_param_list ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no function block name defined in IL function block call.");
+ }
+| il_call_operator error '(' ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
+ yyerrok;
+ }
+| il_call_operator error '(' eol_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
+ yyerrok;
+ }
+| il_call_operator error '(' il_operand_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
+ yyerrok;
+ }
+| il_call_operator error '(' eol_list il_param_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid function block name defined in IL function block call.");
+ yyerrok;
+ }
+| il_call_operator prev_declared_fb_name ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "'(' missing after function block name defined in IL function block call.");
+ }
+| il_call_operator prev_declared_fb_name il_operand_list ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "'(' missing after function block name defined in IL function block call.");
+ }
+| il_call_operator prev_declared_fb_name '(' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
+ yyerrok;
+ }
+| il_call_operator prev_declared_fb_name '(' eol_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
+ yyerrok;
+ }
+| il_call_operator prev_declared_fb_name '(' il_operand_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of IL function block call.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4607,12 +7126,36 @@
*/
| il_expr_operator_clash_eol_list il_param_list ')'
{$$ = new il_formal_funct_call_c(il_operator_c_2_identifier_c($1), $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| function_name_no_clashes '(' eol_list error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid parameter list defined in IL formal function call.");
+ yyerrok;
+ }
+| function_name_simpleop_clashes '(' eol_list error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid parameter list defined in IL formal function call.");
+ yyerrok;
+ }
+| il_expr_operator_clash_eol_list error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter list defined in IL formal function call.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
il_expr_operator_clash_eol_list:
il_expr_operator_clash '(' eol_list
{$$ = $1;}
+/* ERROR_CHECK_BEGIN */
+| il_expr_operator_clash '(' error
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "EOL missing after '(' in IL instruction.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4636,6 +7179,23 @@
{$$ = new il_operand_list_c(locloc(@$)); $$->add_element($1); $$->add_element($3);}
| il_operand_list2 ',' il_operand
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| il_operand_list2 il_operand
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "',' missing in IL operand list.");
+ }
+| il_formal_funct_call error il_operand
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting ',' in IL operand list.");
+ yyerrok;
+ }
+| il_formal_funct_call ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid operand in IL operand list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4651,6 +7211,18 @@
il_simple_operation eol_list
| il_expression eol_list
| il_formal_funct_call eol_list
+/* ERROR_CHECK_BEGIN */
+| il_expression error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing after expression IL instruction.");
+ yyerrok;
+ }
+| il_formal_funct_call error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing after formal function call IL instruction.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4673,6 +7245,23 @@
{$$ = $1; $$->add_element($2);}
| il_param_last_instruction
{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
+/* ERROR_CHECK_BEGIN */
+| il_param_instruction_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter assignment in parameter assignment list.");
+ yyerrok;
+ }
+| il_param_last_instruction il_param_last_instruction
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at the end of parameter assignment in parameter assignment list.");
+ }
+| il_param_instruction_list il_param_last_instruction il_param_last_instruction
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "',' missing at the end of parameter assignment in parameter assignment list.");
+ }
+/* ERROR_CHECK_END */
;
@@ -4682,18 +7271,55 @@
{$$ = new il_param_list_c(locloc(@$)); $$->add_element($1);}
| il_param_instruction_list il_param_instruction
{$$ = $1; $$->add_element($2);}
+/* ERROR_CHECK_BEGIN */
+| il_param_last_instruction il_param_instruction
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "',' missing at the end of parameter assignment in parameter assignment list.");
+ }
+| il_param_instruction_list il_param_last_instruction il_param_instruction
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@2), "',' missing at the end of parameter assignment in parameter assignment list.");
+ }
+/* ERROR_CHECK_END */
;
il_param_instruction:
il_param_assignment ',' eol_list
| il_param_out_assignment ',' eol_list
+/* ERROR_CHECK_BEGIN */
+| il_param_assignment ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "EOL missing at the end of parameter assignment in parameter assignment list.");
+ yyerrok;
+ }
+| il_param_out_assignment ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "EOL missing at the end of parameter out assignment in parameter assignment list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
il_param_last_instruction:
il_param_assignment eol_list
| il_param_out_assignment eol_list
+/* ERROR_CHECK_BEGIN */
+| il_param_assignment error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of last parameter assignment in parameter assignment list.");
+ yyerrok;
+ }
+| il_param_out_assignment error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "EOL missing at the end of last parameter out assignment in parameter assignment list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
+
;
@@ -4702,12 +7328,51 @@
{$$ = new il_param_assignment_c($1, $2, NULL, locloc(@$));}
| il_assign_operator '(' eol_list simple_instr_list ')'
{$$ = new il_param_assignment_c($1, NULL, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| error il_operand
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid operator in parameter assignment.");
+ yyerrok;
+ }
+| error '(' eol_list simple_instr_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid operator in parameter assignment.");
+ yyerrok;
+ }
+| il_assign_operator error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid operand defined in parameter assignment.");
+ yyerrok;
+ }
+| il_assign_operator '(' ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "no instruction list defined in parameter assignment.");
+ yyerrok;
+ }
+| il_assign_operator '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid instruction list defined in parameter assignment.");
+ yyerrok;
+ }
+| il_assign_operator '(' eol_list simple_instr_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "')' missing at the end of instruction list defined in parameter assignment.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
il_param_out_assignment:
il_assign_out_operator variable
{$$ = new il_param_out_assignment_c($1, $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| il_assign_out_operator error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid variable defined in parameter out assignment.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4848,6 +7513,13 @@
il_assign_operator:
/* variable_name ASSIGN */
any_identifier ASSIGN
+/* ERROR_CHECK_BEGIN */
+| error ASSIGN
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter defined in parameter assignment.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4859,6 +7531,23 @@
/*| NOT variable_name SENDTO */
| NOT sendto_identifier SENDTO
{$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| error SENDTO
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter defined in parameter out assignment.");
+ yyerrok;
+ }
+| NOT SENDTO
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no paramter defined in parameter out assignment.");
+ }
+| NOT error SENDTO
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter defined in parameter out assignment.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4890,12 +7579,26 @@
xor_expression
| expression OR xor_expression
{$$ = new or_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| expression OR error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'OR' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
xor_expression:
and_expression
| xor_expression XOR and_expression
{$$ = new xor_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| xor_expression XOR error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'XOR' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
and_expression:
@@ -4913,6 +7616,23 @@
*/
| and_expression AND2 comparison
{$$ = new and_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| and_expression '&' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '&' in ST expression.");
+ yyerrok;
+ }
+| and_expression AND error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'AND' in ST expression.");
+ yyerrok;
+ }
+| and_expression AND2 error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '&' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
comparison:
@@ -4921,6 +7641,18 @@
{$$ = new equ_expression_c($1, $3, locloc(@$));}
| comparison OPER_NE equ_expression
{$$ = new notequ_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| comparison '=' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '=' in ST expression.");
+ yyerrok;
+ }
+| comparison OPER_NE error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<>' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
equ_expression:
@@ -4933,6 +7665,28 @@
{$$ = new le_expression_c($1, $3, locloc(@$));}
| equ_expression OPER_GE add_expression
{$$ = new ge_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| equ_expression '<' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<' in ST expression.");
+ yyerrok;
+ }
+| equ_expression '>' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '>' in ST expression.");
+ yyerrok;
+ }
+| equ_expression OPER_LE error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '<=' in ST expression.");
+ yyerrok;
+ }
+| equ_expression OPER_GE error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '>=' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* Not required...
@@ -4945,6 +7699,18 @@
{$$ = new add_expression_c($1, $3, locloc(@$));}
| add_expression '-' term
{$$ = new sub_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| add_expression '+' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '+' in ST expression.");
+ yyerrok;
+ }
+| add_expression '-' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '-' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* Not required...
@@ -4959,6 +7725,23 @@
{$$ = new div_expression_c($1, $3, locloc(@$));}
| term MOD power_expression
{$$ = new mod_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| term '*' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '*' in ST expression.");
+ yyerrok;
+ }
+| term '/' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '/' in ST expression.");
+ yyerrok;
+ }
+| term MOD error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after 'MOD' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* Not required...
@@ -4969,6 +7752,13 @@
unary_expression
| power_expression OPER_EXP unary_expression
{$$ = new power_expression_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| power_expression OPER_EXP error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid expression after '**' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -4978,6 +7768,18 @@
{$$ = new neg_expression_c($2, locloc(@$));}
| NOT primary_expression
{$$ = new not_expression_c($2, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| '-' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after '-' in ST expression.");
+ yyerrok;
+ }
+| NOT error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after 'NOT' in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* Not required...
@@ -5017,6 +7819,13 @@
| '(' expression ')'
{$$ = $2;}
| function_invocation
+/* ERROR_CHECK_BEGIN */
+| '(' expression error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "')' missing at the end of expression in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5052,6 +7861,43 @@
{$$ = new function_invocation_c($1, $3, locloc(@$));}
| function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
{$$ = new function_invocation_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| function_name_no_NOT_clashes param_assignment_formal_list ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "'(' missing after function name in ST expression.");
+ }
+| function_name_no_NOT_clashes error param_assignment_formal_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '(' after function name in ST expression.");
+ yyerrok;
+ }
+| function_name_no_NOT_clashes error param_assignment_nonformal_list ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting '(' after function name in ST expression.");
+ yyerrok;
+ }
+| function_name_no_NOT_clashes '(' ')'
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@3), "no parameter defined in function invocation of ST expression.");
+ }
+| function_name_no_NOT_clashes '(' error ')'
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid parameter(s) defined in function invocation of ST expression.");
+ yyerrok;
+ }
+| function_name_no_NOT_clashes '(' param_assignment_formal_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of function invocation in ST expression.");
+ yyerrok;
+ }
+| function_name_no_NOT_clashes '(' param_assignment_nonformal_list error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "')' missing at the end of function invocation in ST expression.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5068,10 +7914,19 @@
| statement_list pragma
{$$ = $1; $$->add_element($2);}
/* ERROR_CHECK_BEGIN */
+| statement_list error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "';' missing at the end of statement in ST statement.");
+ yyerrok;
+ }
| statement_list error ';'
{$$ = $1;
- print_err_msg(current_filename, locf(@2), locl(@2), "error in statement.");
- /* yychar */
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid statement in ST statement.");
+ yyerrok;
+ }
+| statement_list statement error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@2), locl(@2), "';' missing at the end of statement in ST statement.");
yyerrok;
}
/* ERROR_CHECK_END */
@@ -5092,6 +7947,13 @@
assignment_statement:
variable ASSIGN expression
{$$ = new assignment_statement_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| variable ASSIGN error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid expression after ':=' in ST assignment statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5119,6 +7981,53 @@
{$$ = new fb_invocation_c($1, $3, locloc(@$));}
| prev_declared_fb_name '(' param_assignment_nonformal_list ')'
{$$ = new fb_invocation_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| prev_declared_fb_name ')'
+ {$$ = $1;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "'(' missing after function block name in ST statement.");
+ }
+| prev_declared_fb_name param_assignment_formal_list ')'
+ {$$ = $1;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@1), "'(' missing after function block name in ST statement.");
+ }
+| prev_declared_fb_name error ')'
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name error param_assignment_formal_list ')'
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name error param_assignment_nonformal_list ')'
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "expecting '(' after function block name in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name '(' error ')'
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "invalid parameter list in function block invocation in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name '(' error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name '(' param_assignment_formal_list error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
+ yyerrok;
+ }
+| prev_declared_fb_name '(' param_assignment_nonformal_list error
+ {$$ = $1;
+ print_err_msg(current_filename, locf(@1), locl(@1), "')' missing after parameter list of function block invocation in ST statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5131,6 +8040,18 @@
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
| param_assignment_formal_list ',' param_assignment_formal
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| param_assignment_formal_list error param_assignment_formal
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "expecting ',' in ST parameter assignment list.");
+ yyerrok;
+ }
+| param_assignment_formal_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid parameter assignment in ST parameter assignment list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for
@@ -5142,6 +8063,13 @@
{$$ = new param_assignment_list_c(locloc(@$)); $$->add_element($1);}
| param_assignment_nonformal_list ',' param_assignment_nonformal
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| param_assignment_nonformal_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid parameter assignment in ST parameter assignment list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5188,6 +8116,33 @@
/*| NOT any_identifier SENDTO variable*/
| NOT sendto_identifier SENDTO variable
{$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)),$2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| any_identifier ASSIGN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter assignment.");
+ yyerrok;
+ }
+| sendto_identifier SENDTO error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter out assignment.");
+ yyerrok;
+ }
+| NOT SENDTO variable
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no parameter name defined in ST formal parameter out negated assignment.");
+ }
+| NOT error SENDTO variable
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid parameter name defined in ST formal parameter out negated assignment.");
+ yyerrok;
+ }
+| NOT sendto_identifier SENDTO error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid expression in ST formal parameter out negated assignment.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5208,6 +8163,63 @@
{$$ = new if_statement_c($2, $4, $5, NULL, locloc(@$));}
| IF expression THEN statement_list elseif_statement_list ELSE statement_list END_IF
{$$ = new if_statement_c($2, $4, $5, $7, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| IF THEN statement_list elseif_statement_list END_IF
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'IF' statement.");
+ }
+| IF THEN statement_list elseif_statement_list ELSE statement_list END_IF
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'IF' statement.");
+ }
+| IF error THEN statement_list elseif_statement_list END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'IF' statement.");
+ yyerrok;
+ }
+| IF error THEN statement_list elseif_statement_list ELSE statement_list END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'IF' statement.");
+ yyerrok;
+ }
+| IF expression error statement_list elseif_statement_list END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in ST 'IF' statement.");
+ yyerrok;
+ }
+| IF expression error statement_list elseif_statement_list ELSE statement_list END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in ST 'IF' statement.");
+ yyerrok;
+ }
+| IF expression THEN elseif_statement_list END_IF
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no statement defined after 'THEN' in ST 'IF' statement.");
+ }
+| IF expression THEN elseif_statement_list ELSE statement_list END_IF
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no statement defined after 'THEN' in ST 'IF' statement.");
+ }
+| IF expression THEN statement_list elseif_statement_list ELSE END_IF
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@6), locl(@7), "no statement defined after 'ELSE' in ST 'IF' statement.");
+ }
+| IF expression THEN statement_list elseif_statement_list ELSE error END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@6), locl(@8), "invalid statement defined after 'ELSE' in ST 'IF' statement.");
+ yyerrok;
+ }
+| IF error END_IF
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'IF' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* helper symbol for if_statement */
@@ -5222,6 +8234,28 @@
elseif_statement:
ELSIF expression THEN statement_list
{$$ = new elseif_statement_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| ELSIF THEN statement_list
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined for 'ELSEIF' statement in ST 'IF' statement.");
+ }
+| ELSIF error THEN statement_list
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for 'ELSEIF' statement in ST 'IF' statement.");
+ yyerrok;
+ }
+| ELSIF expression error statement_list
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'THEN' after test expression in 'ELSEIF' statement of ST 'IF' statement.");
+ yyerrok;
+ }
+| ELSIF expression THEN error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@3), "invalid statement list in 'ELSEIF' statement of ST 'IF' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5230,6 +8264,73 @@
{$$ = new case_statement_c($2, $4, NULL, locloc(@$));}
| CASE expression OF case_element_list ELSE statement_list END_CASE
{$$ = new case_statement_c($2, $4, $6, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| CASE OF case_element_list END_CASE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'CASE' statement.");
+ }
+| CASE OF case_element_list ELSE statement_list END_CASE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'CASE' statement.");
+ }
+| CASE error OF case_element_list END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE error OF case_element_list ELSE statement_list END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE expression error case_element_list END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'OF' after test expression in ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE expression error case_element_list ELSE statement_list END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'OF' after test expression in ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE expression OF END_CASE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement.");
+ }
+| CASE expression OF ELSE statement_list END_CASE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no case element(s) defined after 'OF' in ST 'CASE' statement.");
+ }
+| CASE expression OF error END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid case element(s) defined after 'OF' in ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE expression OF error ELSE statement_list END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid case element(s) defined after 'OF' in ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE expression OF case_element_list ELSE END_CASE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@5), locl(@6), "no statement defined after 'ELSE' in ST 'CASE' statement.");
+ }
+| CASE expression OF case_element_list ELSE error END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@5), locl(@7), "invalid statement defined after 'ELSE' in ST 'CASE' statement.");
+ yyerrok;
+ }
+| CASE error END_CASE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'CASE' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5245,6 +8346,18 @@
case_element:
case_list ':' statement_list
{$$ = new case_element_c($1, $3, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| case_list statement_list
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "':' missing after case list in ST 'CASE' statement.");
+ }
+| case_list ':' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@2), "invalid statement in case element of ST 'CASE' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5253,6 +8366,13 @@
{$$ = new case_list_c(locloc(@$)); $$->add_element($1);}
| case_list ',' case_list_element
{$$ = $1; $$->add_element($3);}
+/* ERROR_CHECK_BEGIN */
+| case_list ',' error
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@2), "invalid case in case list of ST parameter assignment list.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5282,6 +8402,113 @@
{$$ = new for_statement_c($2, $4, $6, $8, $10, locloc(@$));}
| FOR control_variable ASSIGN expression TO expression DO statement_list END_FOR
{$$ = new for_statement_c($2, $4, $6, NULL, $8, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| FOR ASSIGN expression TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no control variable defined in ST 'FOR' statement.");
+ }
+| FOR ASSIGN expression TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no control variable defined in ST 'FOR' statement.");
+ }
+| FOR error ASSIGN expression TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid control variable defined for ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR error ASSIGN expression TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid control variable defined for ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable expression TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "':=' missing between control variable and start expression in ST 'FOR' statement.");
+ }
+| FOR control_variable expression TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@2), locl(@3), "':=' missing between control variable and start expression in ST 'FOR' statement.");
+ }
+| FOR control_variable error expression TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':=' between control variable and start expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable error expression TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting ':=' between control variable and start expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no start expression defined in ST 'FOR' statement.");
+ }
+| FOR control_variable ASSIGN TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no start expression defined in ST 'FOR' statement.");
+ }
+| FOR control_variable ASSIGN error TO expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid start expression defined in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN error TO expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid start expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression error expression BY expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between start expression and end expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression error expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@4), locl(@6), "expecting 'TO' between start expression and end expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression error expression DO statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@6), locl(@8), "expecting 'BY' between end expression and step expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression BY expression error statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@8), locl(@10), "expecting 'DO' after step expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression error statement_list END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@6), locl(@8), "expecting 'DO' after end expression in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression BY expression DO END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@9), locl(@10), "no statement(s) defined after 'DO' in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression DO END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@7), locl(@8), "no statement(s) defined after 'DO' in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression BY expression DO error END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@9), locl(@11), "invalid statement(s) defined after 'DO' in ST 'FOR' statement.");
+ yyerrok;
+ }
+| FOR control_variable ASSIGN expression TO expression DO error END_FOR
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@7), locl(@9), "invalid statement(s) defined after 'DO' in ST 'FOR' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
/* The spec has the syntax
@@ -5312,12 +8539,71 @@
while_statement:
WHILE expression DO statement_list END_WHILE
{$$ = new while_statement_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| WHILE DO statement_list END_WHILE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no test expression defined in ST 'WHILE' statement.");
+ }
+| WHILE error DO statement_list END_WHILE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid test expression defined for ST 'WHILE' statement.");
+ yyerrok;
+ }
+| WHILE expression error statement_list END_WHILE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@2), locl(@4), "expecting 'DO' after test expression in ST 'WHILE' statement.");
+ yyerrok;
+ }
+| WHILE expression DO END_WHILE
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no statement(s) defined after 'DO' in ST 'WHILE' statement.");
+ }
+| WHILE expression DO error END_WHILE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid statement(s) defined after 'DO' in ST 'WHILE' statement.");
+ yyerrok;
+ }
+| WHILE error END_WHILE
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'WHILE' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
repeat_statement:
REPEAT statement_list UNTIL expression END_REPEAT
{$$ = new repeat_statement_c($2, $4, locloc(@$));}
+/* ERROR_CHECK_BEGIN */
+| REPEAT UNTIL expression END_REPEAT
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@1), locl(@2), "no statement(s) defined after 'REPEAT' in ST 'REPEAT' statement.");
+ }
+| REPEAT error UNTIL expression END_REPEAT
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "invalid statement(s) defined after 'REPEAT' for ST 'REPEAT' statement.");
+ yyerrok;
+ }
+| REPEAT statement_list UNTIL END_REPEAT
+ {$$ = NULL;
+ yynerrs++;
+ print_err_msg(current_filename, locf(@3), locl(@4), "no test expression defined after 'UNTIL' in ST 'REPEAT' statement.");
+ }
+| REPEAT statement_list UNTIL error END_REPEAT
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@3), locl(@5), "invalid test expression defined after 'UNTIL' in ST 'REPEAT' statement.");
+ yyerrok;
+ }
+| REPEAT error END_REPEAT
+ {$$ = NULL;
+ print_err_msg(current_filename, locf(@1), locl(@3), "unknown error in ST 'REPEAT' statement.");
+ yyerrok;
+ }
+/* ERROR_CHECK_END */
;
@@ -5376,9 +8662,10 @@
int last_line,
int last_column,
const char *additional_error_msg) {
- fprintf(stderr, "error %d: %s\n", yynerrs /* a global variable */, additional_error_msg);
+ fprintf(stderr, "%s:%d: error : %s\n", filename, first_line, additional_error_msg);
+ //fprintf(stderr, "error %d: %s\n", yynerrs /* a global variable */, additional_error_msg);
print_include_stack();
- fprintf(stderr, "%s(%d-%d): %s\n", filename, first_line, last_line, current_error_msg);
+ //fprintf(stderr, "%s(%d-%d): %s\n", filename, first_line, last_line, current_error_msg);
}