diff -r 8ffa211b7f9a -r 90782e241346 stage1_2/iec.y --- a/stage1_2/iec.y Thu Aug 27 16:29:23 2009 +0100 +++ b/stage1_2/iec.y Wed Mar 30 19:53:32 2011 +0100 @@ -326,9 +326,7 @@ /* B 1.2 - Constants */ /*********************/ %type constant -/* a helper symbol for expression */ -%type non_negative_constant - +%type non_negative_constant /******************************/ /* B 1.2.1 - Numeric Literals */ @@ -337,12 +335,8 @@ bit */ %type numeric_literal -/* helper symbol for non_negative_constant */ -%type non_negative_numeric_literal %type integer_literal %type signed_integer -/* a helper symbol for non_negative_constant */ -%type non_negative_signed_integer %token integer_token %type integer %token binary_integer_token @@ -354,15 +348,16 @@ %token real_token %type real %type signed_real -/* helper symbol for non_negative_real_literal */ -%type non_negative_signed_real %type real_literal -/* helper symbol for non_negative_numeric_literal */ -%type non_negative_real_literal // %type exponent %type bit_string_literal %type boolean_literal +%token safeboolean_true_literal_token +%token safeboolean_false_literal_token +%token boolean_true_literal_token +%token boolean_false_literal_token + %token FALSE %token TRUE @@ -419,7 +414,7 @@ %token fixed_point_ms_token %token integer_ms_token -%token TIME +// %token TIME %token T_SHARP @@ -438,10 +433,10 @@ %type day %type date_and_time -%token TIME_OF_DAY -%token DATE +// %token TIME_OF_DAY +// %token DATE %token D_SHARP -%token DATE_AND_TIME +// %token DATE_AND_TIME /**********************/ @@ -522,13 +517,49 @@ %token STRING %token BOOL -// %token TIME -// %token DATE -// %token DATE_AND_TIME +%token TIME +%token DATE +%token DATE_AND_TIME %token DT -// %token TIME_OF_DAY +%token TIME_OF_DAY %token TOD +/******************************************************/ +/* Symbols defined in */ +/* "Safety Software Technical Specification, */ +/* Part 1: Concepts and Function Blocks, */ +/* Version 1.0 – Official Release" */ +/* by PLCopen - Technical Committee 5 - 2006-01-31 */ +/******************************************************/ + +%token SAFEBYTE +%token SAFEWORD +%token SAFEDWORD +%token SAFELWORD + +%token SAFELREAL +%token SAFEREAL + +%token SAFESINT +%token SAFEINT +%token SAFEDINT +%token SAFELINT + +%token SAFEUSINT +%token SAFEUINT +%token SAFEUDINT +%token SAFEULINT + +%token SAFEWSTRING +%token SAFESTRING +%token SAFEBOOL + +%token SAFETIME +%token SAFEDATE +%token SAFEDATE_AND_TIME +%token SAFEDT +%token SAFETIME_OF_DAY +%token SAFETOD /********************************/ /* B 1.3.2 - Generic data types */ @@ -1168,6 +1199,7 @@ %type unary_expression // %type unary_operator %type primary_expression +%type non_negative_primary_expression /* intermediate helper symbol for primary_expression */ %type function_invocation @@ -1274,15 +1306,6 @@ %token EXIT -/******************************************************/ -/* Symbols defined in */ -/* "Safety Software Technical Specification, */ -/* Part 1: Concepts and Function Blocks, */ -/* Version 1.0 – Official Release" */ -/* by PLCopen - Technical Committee 5 - 2006-01-31 */ -/******************************************************/ -%token SAFEBOOL - %% @@ -1597,10 +1620,23 @@ | bit_string_literal | boolean_literal /* NOTE: in order to remove reduce/reduce conflicts, + * [between -9.5 being parsed as + * (i) a signed real, + * (ii) or as a real preceded by the '-' operator + * ] + * we need to define a variant of the constant construct + * where any constant is never preceded by the '-' character. + * In order to do this, we have borugh the signed_real + * directly into the definition of the constant construct + * (so we can define another non_negative_constant + * construct that does not include it!) + */ +| signed_real +/* NOTE: in order to remove reduce/reduce conflicts, * unsigned_integer, signed_integer, binary_integer, octal_integer * and hex_integer have been integrated directly into * the constants construct, instead of belonging to - * either the bit_string_literal or integer_literal + * both the bit_string_literal or integer_literal * construct. */ /* NOTE: unsigned_integer, although used in some @@ -1614,24 +1650,58 @@ | hex_integer ; -/* a helper symbol for expression */ -/* A constant without any preceding '-', but may - * include a preceding '+' ! + +/* NOTE: in order to remove reduce/reduce conflicts, + * [between -9.5 being parsed as + * (i) a signed real, + * (ii) or as a real preceded by the '-' operator + * ] + * we need to define a variant of the constant construct + * where any constant is never preceded by the '-' character. + * In order to do this, we have borugh the signed_real + * directly into the definition of the constant construct + * (so we can define another non_negative_constant + * construct that does not include it!) */ non_negative_constant: - non_negative_numeric_literal + numeric_literal | character_string | time_literal | bit_string_literal | boolean_literal -| non_negative_signed_integer +/* NOTE: in order to remove reduce/reduce conflicts, + * [between -9.5 being parsed as + * (i) a signed real, + * (ii) or as a real preceded by the '-' operator + * ] + * we need to define a variant of the constant construct + * where any constant is never preceded by the '-' character. + * In order to do this, we have borugh the signed_real + * directly into the definition of the constant construct + * (so we can define another non_negative_constant + * construct that does not include it!) + */ +/* | signed_real */ +| real /* an unsigned real */ +/* NOTE: in order to remove reduce/reduce conflicts, + * unsigned_integer, signed_integer, binary_integer, octal_integer + * and hex_integer have been integrated directly into + * the constants construct, instead of belonging to + * both the bit_string_literal or integer_literal + * construct. + */ +/* NOTE: unsigned_integer, although used in some + * rules, is not defined in the spec! + * We therefore replaced unsigned_integer as integer + */ +| integer /* i.e. an unsigned_integer */ +/* | signed_integer */ | binary_integer | octal_integer | hex_integer ; - /******************************/ /* B 1.2.1 - Numeric Literals */ /******************************/ @@ -1663,7 +1733,7 @@ * Flex handles real, while bison handles signed_real * and real_literal. * - * - According to the spec, intger '.' integer + * - According to the spec, integer '.' integer * may be reduced to either a real or a fixed_point. * It is nevertheless possible to figure out from the * context which of the two rules should be used in @@ -1720,12 +1790,6 @@ | real_literal ; -/* helper symbol for non_negative_constant */ -non_negative_numeric_literal: - integer_literal -| non_negative_real_literal -; - integer_literal: integer_type_name '#' signed_integer @@ -1761,22 +1825,16 @@ signed_integer: integer | '+' integer {$$ = $2;} -| '-' integer {$$ = new neg_literal_c($2, locloc(@$));} -; - -/* a helper symbol for non_negative_constant */ -/* A integer without any preceding '-', but may - * include a preceding '+' ! - */ -non_negative_signed_integer: - integer -| '+' integer {$$ = $2;} +| '-' integer {$$ = new neg_integer_c($2, locloc(@$));} ; real_literal: - signed_real -| real_type_name '#' signed_real +/* NOTE: see note in the definition of constant for reason + * why signed_real is missing here! + */ +/* 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 @@ -1790,24 +1848,13 @@ /* ERROR_CHECK_END */ ; -/* helper symbol for non_negative_numeric_literal */ -non_negative_real_literal: - non_negative_signed_real -| real_type_name '#' signed_real - {$$ = new real_literal_c($1, $3, locf(@1), locl(@3));} -; signed_real: real | '+' real {$$ = $2;} -| '-' real {$$ = new neg_literal_c($2, locloc(@2));} -; - -/* helper symbol for non_negative_real_literal */ -non_negative_signed_real: - real -| '+' real {$$ = $2;} -; +| '-' real {$$ = new neg_real_c($2, locloc(@2));} +; + bit_string_literal: @@ -1838,7 +1885,7 @@ | bit_string_type_name hex_integer {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between bit string type name and value in bit string literal."); yynerrs++;} | bit_string_type_name '#' error - {$$ = NULL; + {$$ = NULL; if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no value defined for bit string literal.");} else {print_err_msg(locf(@3), locl(@3), "invalid value for bit string literal."); yyclearin;} yyerrok; @@ -1848,12 +1895,36 @@ boolean_literal: - TRUE {$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), - new boolean_true_c(locloc(@$)), - locloc(@$));} -| FALSE {$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), + boolean_true_literal_token + {$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), + new boolean_true_c(locloc(@$)), + locloc(@$)); + } +| boolean_false_literal_token + {$$ = new boolean_literal_c(new bool_type_name_c(locloc(@$)), new boolean_false_c(locloc(@$)), - locloc(@$));} + locloc(@$)); + } +| safeboolean_true_literal_token + {$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), + new boolean_true_c(locloc(@$)), + locloc(@$)); + } +| safeboolean_false_literal_token + {$$ = new boolean_literal_c(new safebool_type_name_c(locloc(@$)), + new boolean_false_c(locloc(@$)), + locloc(@$)); + } +| FALSE + {$$ = new boolean_literal_c(NULL, + new boolean_false_c(locloc(@$)), + locloc(@$)); + } +| TRUE + {$$ = new boolean_literal_c(NULL, + new boolean_true_c(locloc(@$)), + locloc(@$)); + } /* | BOOL '#' '1' {} | BOOL '#' '0' {} @@ -1935,13 +2006,17 @@ * when it comes across 'T#' */ TIME '#' interval - {$$ = new duration_c(NULL, $3, locloc(@$));} + {$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $3, locloc(@$));} | TIME '#' '-' interval - {$$ = new duration_c(new neg_time_c(locloc(@$)), $4, locloc(@$));} + {$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));} | T_SHARP interval - {$$ = new duration_c(NULL, $2, locloc(@$));} + {$$ = new duration_c(new time_type_name_c(locloc(@1)), NULL, $2, locloc(@$));} | T_SHARP '-' interval - {$$ = new duration_c(new neg_time_c(locloc(@$)), $3, locloc(@$));} + {$$ = new duration_c(new time_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $3, locloc(@$));} +| SAFETIME '#' interval + {$$ = new duration_c(new safetime_type_name_c(locloc(@1)), NULL, $3, locloc(@$));} +| SAFETIME '#' '-' interval + {$$ = new duration_c(new safetime_type_name_c(locloc(@1)), new neg_time_c(locloc(@$)), $4, locloc(@$));} /* ERROR_CHECK_BEGIN */ | TIME interval {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME' and interval in duration."); yynerrs++;} @@ -2106,7 +2181,9 @@ /************************************/ time_of_day: TIME_OF_DAY '#' daytime - {$$ = new time_of_day_c($3, locloc(@$));} + {$$ = new time_of_day_c(new tod_type_name_c(locloc(@1)), $3, locloc(@$));} +| SAFETIME_OF_DAY '#' daytime + {$$ = new time_of_day_c(new safetod_type_name_c(locloc(@1)), $3, locloc(@$));} /* ERROR_CHECK_BEGIN */ | TIME_OF_DAY daytime {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'TIME_OF_DAY' and daytime in time of day."); yynerrs++;} @@ -2153,9 +2230,11 @@ date: DATE '#' date_literal - {$$ = new date_c($3, locloc(@$));} + {$$ = new date_c(new date_type_name_c(locloc(@1)), $3, locloc(@$));} | D_SHARP date_literal - {$$ = new date_c($2, locloc(@$));} + {$$ = new date_c(new date_type_name_c(locloc(@1)), $2, locloc(@$));} +| SAFEDATE '#' date_literal + {$$ = new date_c(new safedate_type_name_c(locloc(@1)), $3, locloc(@$));} /* ERROR_CHECK_BEGIN */ | DATE date_literal {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE' and date literal in date."); yynerrs++;} @@ -2206,7 +2285,9 @@ date_and_time: DATE_AND_TIME '#' date_literal '-' daytime - {$$ = new date_and_time_c($3, $5, locloc(@$));} + {$$ = new date_and_time_c(new dt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} +| SAFEDATE_AND_TIME '#' date_literal '-' daytime + {$$ = new date_and_time_c(new safedt_type_name_c(locloc(@1)), $3, $5, locloc(@$));} /* ERROR_CHECK_BEGIN */ | DATE_AND_TIME date_literal '-' daytime {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'#' missing between 'DATE_AND_TIME' and date literal in date and time."); yynerrs++;} @@ -2251,6 +2332,14 @@ /***********************************/ /* B 1.3.1 - Elementary Data Types */ /***********************************/ + /******************************************************/ + /* SAFExxxx Symbols defined in */ + /* "Safety Software Technical Specification, */ + /* Part 1: Concepts and Function Blocks, */ + /* Version 1.0 – Official Release" */ + /* by PLCopen - Technical Committee 5 - 2006-01-31 */ + /******************************************************/ + elementary_type_name: numeric_type_name | date_type_name @@ -2262,13 +2351,7 @@ * and grouping type definition for reason why BOOL * was added to this definition. */ - /******************************************************/ - /* Symbols defined in */ - /* "Safety Software Technical Specification, */ - /* Part 1: Concepts and Function Blocks, */ - /* Version 1.0 – Official Release" */ - /* by PLCopen - Technical Committee 5 - 2006-01-31 */ - /******************************************************/ +| SAFETIME {$$ = new safetime_type_name_c(locloc(@$));} | SAFEBOOL {$$ = new safebool_type_name_c(locloc(@$));} ; @@ -2283,38 +2366,57 @@ ; signed_integer_type_name: - SINT {$$ = new sint_type_name_c(locloc(@$));} -| INT {$$ = new int_type_name_c(locloc(@$));} -| DINT {$$ = new dint_type_name_c(locloc(@$));} -| LINT {$$ = new lint_type_name_c(locloc(@$));} + SINT {$$ = new sint_type_name_c(locloc(@$));} +| INT {$$ = new int_type_name_c(locloc(@$));} +| DINT {$$ = new dint_type_name_c(locloc(@$));} +| LINT {$$ = new lint_type_name_c(locloc(@$));} +| SAFESINT {$$ = new safesint_type_name_c(locloc(@$));} +| SAFEINT {$$ = new safeint_type_name_c(locloc(@$));} +| SAFEDINT {$$ = new safedint_type_name_c(locloc(@$));} +| SAFELINT {$$ = new safelint_type_name_c(locloc(@$));} ; unsigned_integer_type_name: - USINT {$$ = new usint_type_name_c(locloc(@$));} -| UINT {$$ = new uint_type_name_c(locloc(@$));} -| UDINT {$$ = new udint_type_name_c(locloc(@$));} -| ULINT {$$ = new ulint_type_name_c(locloc(@$));} + USINT {$$ = new usint_type_name_c(locloc(@$));} +| UINT {$$ = new uint_type_name_c(locloc(@$));} +| UDINT {$$ = new udint_type_name_c(locloc(@$));} +| ULINT {$$ = new ulint_type_name_c(locloc(@$));} +| SAFEUSINT {$$ = new safeusint_type_name_c(locloc(@$));} +| SAFEUINT {$$ = new safeuint_type_name_c(locloc(@$));} +| SAFEUDINT {$$ = new safeudint_type_name_c(locloc(@$));} +| SAFEULINT {$$ = new safeulint_type_name_c(locloc(@$));} ; real_type_name: - REAL {$$ = new real_type_name_c(locloc(@$));} -| LREAL {$$ = new lreal_type_name_c(locloc(@$));} + REAL {$$ = new real_type_name_c(locloc(@$));} +| LREAL {$$ = new lreal_type_name_c(locloc(@$));} +| SAFEREAL {$$ = new safereal_type_name_c(locloc(@$));} +| SAFELREAL {$$ = new safelreal_type_name_c(locloc(@$));} ; date_type_name: - DATE {$$ = new date_type_name_c(locloc(@$));} -| TIME_OF_DAY {$$ = new tod_type_name_c(locloc(@$));} -| TOD {$$ = new tod_type_name_c(locloc(@$));} -| DATE_AND_TIME {$$ = new dt_type_name_c(locloc(@$));} -| DT {$$ = new dt_type_name_c(locloc(@$));} + DATE {$$ = new date_type_name_c(locloc(@$));} +| TIME_OF_DAY {$$ = new tod_type_name_c(locloc(@$));} +| TOD {$$ = new tod_type_name_c(locloc(@$));} +| DATE_AND_TIME {$$ = new dt_type_name_c(locloc(@$));} +| DT {$$ = new dt_type_name_c(locloc(@$));} +| SAFEDATE {$$ = new safedate_type_name_c(locloc(@$));} +| SAFETIME_OF_DAY {$$ = new safetod_type_name_c(locloc(@$));} +| SAFETOD {$$ = new safetod_type_name_c(locloc(@$));} +| SAFEDATE_AND_TIME {$$ = new safedt_type_name_c(locloc(@$));} +| SAFEDT {$$ = new safedt_type_name_c(locloc(@$));} ; bit_string_type_name: - BYTE {$$ = new byte_type_name_c(locloc(@$));} -| WORD {$$ = new word_type_name_c(locloc(@$));} -| DWORD {$$ = new dword_type_name_c(locloc(@$));} -| LWORD {$$ = new lword_type_name_c(locloc(@$));} + BYTE {$$ = new byte_type_name_c(locloc(@$));} +| WORD {$$ = new word_type_name_c(locloc(@$));} +| DWORD {$$ = new dword_type_name_c(locloc(@$));} +| LWORD {$$ = new lword_type_name_c(locloc(@$));} +| SAFEBYTE {$$ = new safebyte_type_name_c(locloc(@$));} +| SAFEWORD {$$ = new safeword_type_name_c(locloc(@$));} +| SAFEDWORD {$$ = new safedword_type_name_c(locloc(@$));} +| SAFELWORD {$$ = new safelword_type_name_c(locloc(@$));} /* NOTE: see note under the B 1.2.1 section of token * and grouping type definition for reason why the BOOL * was omitted from this definition. @@ -2333,6 +2435,8 @@ elementary_string_type_name: STRING {$$ = new string_type_name_c(locloc(@$));} | WSTRING {$$ = new wstring_type_name_c(locloc(@$));} +| SAFESTRING {$$ = new safestring_type_name_c(locloc(@$));} +| SAFEWSTRING {$$ = new safewstring_type_name_c(locloc(@$));} ; @@ -6375,7 +6479,7 @@ il_param_instruction: - il_param_assignment ',' eol_list + il_param_assignment ',' eol_list | il_param_out_assignment ',' eol_list /* ERROR_CHECK_BEGIN */ | il_param_assignment ',' error @@ -6591,13 +6695,61 @@ /* any_identifier SENDTO */ sendto_identifier SENDTO {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} +/* The following is not required, as the sendto_identifier_token returned by flex will + * also include the 'ENO' identifier. + * The resulting abstract syntax tree is identical with or without this following rule, + * as both the eno_identifier and the sendto_identifier are stored as + * an identifier_c !! + */ +/* | eno_identifier SENDTO {$$ = new il_assign_out_operator_c(NULL, $1, locloc(@$));} +*/ /*| NOT variable_name SENDTO */ | NOT sendto_identifier SENDTO {$$ = new il_assign_out_operator_c(new not_paramassign_c(locloc(@1)), $2, locloc(@$));} +/* The following is not required, as the sendto_identifier_token returned by flex will + * also include the 'ENO' identifier. + * The resulting abstract syntax tree is identical with or without this following rule, + * as both the eno_identifier and the sendto_identifier are stored as + * an identifier_c !! + * + * NOTE: Removing the following rule also removes a shift/reduce conflict from the parser. + * This conflict is not really an error/ambiguity in the syntax, but rather + * due to the fact that more than a single look-ahead token would be required + * to correctly parse the syntax, something that bison does not support. + * + * The shift/reduce conflict arises because bison does not know whether + * to parse the 'NOT ENO' in the following code + * LD 1 + * funct_name ( + * NOT ENO => bool_var, + * EN := TRUE + * ) + * as either a il_param_assignment (wrong!) or an il_param_out_assignment.(correct). + * The '=>' delimiter (known as SEND_TO in this iec.y file) is a dead giveaway that + * it should be parsed as an il_param_out_assignment, but still, bison gets confused! + * Bison considers the possibility of reducing the 'NOT ENO' as an NOT_operator with + * the 'ENO' operand + * (NOT_operator -> il_simple_operator -> il_simple_operation -> il_simple_instruction -> + * -> simple_instr_list -> il_param_assignment) + * instead of reducing it to an il_param_out_operator. + * ( il_param_out_operator -> il_param_out_assignment) + * + * Note that the shift/reduce conflict only manifests itself in the il_formal_funct_call, + * where both the il_param_out_assignment and il_param_assignment are used! + * + * il_param_out_assignment --+--> il_param_instruction -> il_param_instruction_list --+ + * | | + * il_param_assignment --+ | + * | + * il_formal_funct_call <- il_param_list <-+ + * + */ +/* | NOT eno_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(locf(@1), locl(@1), "invalid parameter defined in parameter out assignment."); yyerrok;} @@ -6838,8 +6990,8 @@ unary_expression: - primary_expression -| '-' primary_expression + non_negative_primary_expression +| '-' non_negative_primary_expression {$$ = new neg_expression_c($2, locloc(@$));} | NOT primary_expression {$$ = new not_expression_c($2, locloc(@$));} @@ -6874,8 +7026,9 @@ * expression<-unary_expression<-constant<-integer * (i.e. the constant 9, preceded by a unary negation) * - * To remove the conlfict, we only allow constants without + * To remove the conflict, we only allow constants without * a preceding '-' to be used in primary_expression + * (i.e. as a parameter to the unary negation operator) */ /* NOTE: We use enumerated_value_without_identifier instead of enumerated_value * in order to remove a reduce/reduce conflict between reducing an @@ -6887,8 +7040,7 @@ * for a variable and an enumerated value, then the variable shall be * considered. */ -primary_expression: -/* constant */ +non_negative_primary_expression: non_negative_constant //| enumerated_value_without_identifier | enumerated_value @@ -6903,6 +7055,22 @@ ; +primary_expression: + constant +//| enumerated_value_without_identifier + enumerated_value +| variable +| '(' expression ')' + {$$ = $2;} +| function_invocation +/* ERROR_CHECK_BEGIN */ +| '(' expression error + {$$ = NULL; print_err_msg(locl(@2), locf(@3), "')' missing at the end of expression in ST expression."); yyerrok;} +/* ERROR_CHECK_END */ +; + + + /* intermediate helper symbol for primary_expression */ /* NOTE: function_name includes the standard function name 'NOT' ! * This introduces a reduce/reduce conflict, as NOT(var) @@ -7122,14 +7290,30 @@ /*| any_identifier SENDTO variable */ | sendto_identifier SENDTO variable {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} +/* The following is not required, as the sendto_identifier_token returned by flex will + * also include the 'ENO' identifier. + * The resulting abstract syntax tree is identical with or without this following rule, + * as both the eno_identifier and the sendto_identifier are stored as + * an identifier_c !! + */ +/* | eno_identifier SENDTO variable {$$ = new output_variable_param_assignment_c(NULL, $1, $3, locloc(@$));} +*/ /*| NOT variable_name SENDTO variable */ /*| NOT any_identifier SENDTO variable*/ | NOT sendto_identifier SENDTO variable {$$ = new output_variable_param_assignment_c(new not_paramassign_c(locloc(@$)), $2, $4, locloc(@$));} +/* The following is not required, as the sendto_identifier_token returned by flex will + * also include the 'ENO' identifier. + * The resulting abstract syntax tree is identical with or without this following rule, + * as both the eno_identifier and the sendto_identifier are stored as + * an identifier_c !! + */ +/* | NOT eno_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; @@ -7149,12 +7333,14 @@ else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} yyerrok; } +/* | eno_identifier SENDTO error {$$ = NULL; if (is_current_syntax_token()) {print_err_msg(locl(@2), locf(@3), "no expression defined in ST formal parameter out assignment.");} else {print_err_msg(locf(@3), locl(@3), "invalid expression in ST formal parameter out assignment."); yyclearin;} yyerrok; } +*/ | NOT SENDTO variable {$$ = NULL; print_err_msg(locl(@1), locf(@2), "no parameter name defined in ST formal parameter out negated assignment."); yynerrs++;} | NOT error SENDTO variable @@ -7165,12 +7351,14 @@ else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} yyerrok; } +/* | NOT eno_identifier SENDTO error {$$ = NULL; if (is_current_syntax_token()) {print_err_msg(locl(@3), locf(@4), "no expression defined in ST formal parameter out negated assignment.");} else {print_err_msg(locf(@4), locl(@4), "invalid expression in ST formal parameter out negated assignment."); yyclearin;} yyerrok; } +*/ /* ERROR_CHECK_END */ ; @@ -7763,6 +7951,11 @@ } /* first parse the standard library file... */ + /* + #if YYDEBUG + yydebug = 1; + #endif + */ yyin = lib_file; allow_function_overloading = true; full_token_loc = full_token_loc_; @@ -7786,11 +7979,11 @@ library_element_symtable.end_value()) library_element_symtable.insert(standard_function_block_names[i], standard_function_block_name_token); -#if YYDEBUG - yydebug = 1; -#endif /* now parse the input file... */ + #if YYDEBUG + yydebug = 1; + #endif yyin = in_file; allow_function_overloading = false; full_token_loc = full_token_loc_;