stage1_2/iec_bison.yy
changeset 1022 0d4d3a502d82
parent 1019 1e3cefbbdee2
child 1031 ce026aee03e0
equal deleted inserted replaced
1008:59435d4c5e0c 1022:0d4d3a502d82
   196  * This is an extension to the standard syntax.
   196  * This is an extension to the standard syntax.
   197  * See comments below for details why we support this!
   197  * See comments below for details why we support this!
   198  */
   198  */
   199 extern bool allow_extensible_function_parameters;
   199 extern bool allow_extensible_function_parameters;
   200 
   200 
   201 /* A global flag used to tell the parser whether to include the full variable location when printing out error messages... */
       
   202 extern bool full_token_loc;
       
   203 
       
   204 /* A global flag used to tell the parser whether to generate conversion function for enumerated data types. */
       
   205 extern bool conversion_functions;
       
   206 
       
   207 /* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */
   201 /* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */
   208 extern bool allow_ref_dereferencing;
   202 extern bool allow_ref_dereferencing;
   209 
   203 
   210 /* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension to IEC 61131-3 v3) */
   204 /* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension to IEC 61131-3 v3) */
   211 extern bool allow_ref_to_any;
   205 extern bool allow_ref_to_any;
   377 %token <ID>	prev_declared_program_type_name_token
   371 %token <ID>	prev_declared_program_type_name_token
   378 %type  <leaf>	prev_declared_derived_function_name
   372 %type  <leaf>	prev_declared_derived_function_name
   379 %type  <leaf>	prev_declared_derived_function_block_name
   373 %type  <leaf>	prev_declared_derived_function_block_name
   380 %type  <leaf>	prev_declared_program_type_name
   374 %type  <leaf>	prev_declared_program_type_name
   381 
   375 
       
   376 /* Tokens used to help resolve a reduce/reduce conflict */
       
   377 /* The mentioned conflict only arises due to a non-standard feature added to matiec.
       
   378  * Namely, the permission to call functions returning VOID as an ST statement.
       
   379  *   e.g.:   FUNCTION foo: VOID
       
   380  *             VAR_INPUT i: INT; END_VAR;
       
   381  *             ...
       
   382  *           END_FUNCTION
       
   383  *
       
   384  *           FUNCTION BAR: BOOL
       
   385  *             VAR b: bool; END_VAR
       
   386  *             foo(i:=42);   <--- Calling foo outside an expression. Function invocation is considered an ST statement!!
       
   387  *           END_FUNCTION
       
   388  *
       
   389  *  The above function invocation may also be reduced to a formal IL function invocation, so we get a 
       
   390  *  reduce/reduce conflict to st_statement_list/instruction_list  (or something equivalent).
       
   391  *
       
   392  *  We solve this by having flex determine if it is ST or IL invocation (ST ends with a ';' !!).
       
   393  *  At the start of a function/FB/program body, flex will tell bison whether to expect ST or IL code!
       
   394  *  This is why we need the following two tokens!
       
   395  *
       
   396  *  NOTE: flex was already determing whther it was parsing ST or IL code as it can only send 
       
   397  *        EOL tokens when parsing IL. However, did this silently without telling bison about this.
       
   398  *        Now, it does
       
   399  */
       
   400 %token          start_ST_body_token
       
   401 %token          start_IL_body_token
   382 
   402 
   383 
   403 
   384 
   404 
   385 /**********************************************************************************/
   405 /**********************************************************************************/
   386 /* B XXX - Things that are missing from the standard, but should have been there! */
   406 /* B XXX - Things that are missing from the standard, but should have been there! */
   653 %token DATE
   673 %token DATE
   654 %token DATE_AND_TIME
   674 %token DATE_AND_TIME
   655 %token DT
   675 %token DT
   656 %token TIME_OF_DAY
   676 %token TIME_OF_DAY
   657 %token TOD
   677 %token TOD
       
   678 
       
   679 /* A non-standard extension! */
       
   680 %token VOID
   658 
   681 
   659 /******************************************************/
   682 /******************************************************/
   660 /* Symbols defined in                                 */
   683 /* Symbols defined in                                 */
   661 /* "Safety Software Technical Specification,          */
   684 /* "Safety Software Technical Specification,          */
   662 /*  Part 1: Concepts and Function Blocks,             */
   685 /*  Part 1: Concepts and Function Blocks,             */
  2571 structure_type_name: identifier;
  2594 structure_type_name: identifier;
  2572 */
  2595 */
  2573 
  2596 
  2574 data_type_declaration:
  2597 data_type_declaration:
  2575   TYPE type_declaration_list END_TYPE
  2598   TYPE type_declaration_list END_TYPE
  2576 	{$$ = new data_type_declaration_c($2, locloc(@$)); if (conversion_functions) include_string((create_enumtype_conversion_functions_c::get_declaration($$)).c_str());}
  2599 	{$$ = new data_type_declaration_c($2, locloc(@$)); if (runtime_options.conversion_functions) include_string((create_enumtype_conversion_functions_c::get_declaration($$)).c_str());}
  2577 /* ERROR_CHECK_BEGIN */
  2600 /* ERROR_CHECK_BEGIN */
  2578 | TYPE END_TYPE
  2601 | TYPE END_TYPE
  2579 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no data type declared in data type(s) declaration."); yynerrs++;}
  2602 	{$$ = NULL; print_err_msg(locl(@1), locf(@2), "no data type declared in data type(s) declaration."); yynerrs++;}
  2580 | TYPE error type_declaration_list END_TYPE
  2603 | TYPE error type_declaration_list END_TYPE
  2581 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'TYPE' in data type(s) declaration."); yyerrok;}
  2604 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unexpected token after 'TYPE' in data type(s) declaration."); yyerrok;}
  4999 	 else                         {print_err_msg(locl(@1), locf(@3), "FUNCTION with no variable declarations and no body."); yynerrs++;}
  5022 	 else                         {print_err_msg(locl(@1), locf(@3), "FUNCTION with no variable declarations and no body."); yynerrs++;}
  5000 	 }
  5023 	 }
  5001 /* POST_PARSING and STANDARD_PARSING: The rules expected to be applied after the preparser has finished. */
  5024 /* POST_PARSING and STANDARD_PARSING: The rules expected to be applied after the preparser has finished. */
  5002 | function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
  5025 | function_name_declaration ':' elementary_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
  5003 	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
  5026 	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
  5004 	 add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5027 	 if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5005 	 variable_name_symtable.pop();
  5028 	 variable_name_symtable.pop();
  5006 	 direct_variable_symtable.pop();
  5029 	 direct_variable_symtable.pop();
  5007 	 library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  5030 	 library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  5008 	}
  5031 	}
  5009 /* | FUNCTION derived_function_name ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
  5032 /* | FUNCTION derived_function_name ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION */
  5010 | function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
  5033 | function_name_declaration ':' derived_type_name io_OR_function_var_declarations_list function_body END_FUNCTION
  5011 	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
  5034 	{$$ = new function_declaration_c($1, $3, $4, $5, locloc(@$));
  5012 	 add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5035 	 if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
       
  5036 	 variable_name_symtable.pop();
       
  5037 	 direct_variable_symtable.pop();
       
  5038 	 library_element_symtable.insert($1, prev_declared_derived_function_name_token);
       
  5039 	}
       
  5040 /* | FUNCTION derived_function_name ':' VOID io_OR_function_var_declarations_list function_body END_FUNCTION */
       
  5041 | function_name_declaration ':' VOID io_OR_function_var_declarations_list function_body END_FUNCTION
       
  5042 	{$$ = new function_declaration_c($1, new void_type_name_c(locloc(@3)), $4, $5, locloc(@$));
       
  5043 	 if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5013 	 variable_name_symtable.pop();
  5044 	 variable_name_symtable.pop();
  5014 	 direct_variable_symtable.pop();
  5045 	 direct_variable_symtable.pop();
  5015 	 library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  5046 	 library_element_symtable.insert($1, prev_declared_derived_function_name_token);
  5016 	}
  5047 	}
  5017 /* ERROR_CHECK_BEGIN */
  5048 /* ERROR_CHECK_BEGIN */
  5176 /* ERROR_CHECK_END */
  5207 /* ERROR_CHECK_END */
  5177 ;
  5208 ;
  5178 
  5209 
  5179 
  5210 
  5180 function_body:
  5211 function_body:
  5181   statement_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
  5212   start_ST_body_token statement_list	{$$ = $2;}
  5182 | instruction_list	{$$ = $1;} /* if we leave it for the default action we get a type clash! */
  5213 | start_IL_body_token instruction_list	{$$ = $2;}
  5183 /*
  5214 /*
  5184 | ladder_diagram
  5215 | ladder_diagram
  5185 | function_block_diagram
  5216 | function_block_diagram
  5186 */
  5217 */
  5187 ;
  5218 ;
  5218 	 else                         {print_err_msg(locl(@1), locf(@3), "FUNCTION_BLOCK with no variable declarations and no body."); yynerrs++;}
  5249 	 else                         {print_err_msg(locl(@1), locf(@3), "FUNCTION_BLOCK with no variable declarations and no body."); yynerrs++;}
  5219 	 }
  5250 	 }
  5220 /* POST_PARSING: The rules expected to be applied after the preparser runs. Will only run if pre-parsing command line option is ON. */
  5251 /* POST_PARSING: The rules expected to be applied after the preparser runs. Will only run if pre-parsing command line option is ON. */
  5221 | FUNCTION_BLOCK prev_declared_derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
  5252 | FUNCTION_BLOCK prev_declared_derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
  5222 	{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$));
  5253 	{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$));
  5223 	 add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5254 	 if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5224 	 /* Clear the variable_name_symtable. Since we have finished parsing the function block,
  5255 	 /* Clear the variable_name_symtable. Since we have finished parsing the function block,
  5225 	  * the variable names are now out of scope, so are no longer valid!
  5256 	  * the variable names are now out of scope, so are no longer valid!
  5226 	  */
  5257 	  */
  5227 	 variable_name_symtable.pop();
  5258 	 variable_name_symtable.pop();
  5228 	 direct_variable_symtable.pop();
  5259 	 direct_variable_symtable.pop();
  5229 	}
  5260 	}
  5230 /* STANDARD_PARSING: The rules expected to be applied in single-phase parsing. Will only run if pre-parsing command line option is OFF. */
  5261 /* STANDARD_PARSING: The rules expected to be applied in single-phase parsing. Will only run if pre-parsing command line option is OFF. */
  5231 | FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
  5262 | FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_FUNCTION_BLOCK
  5232 	{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$));
  5263 	{$$ = new function_block_declaration_c($2, $3, $4, locloc(@$));
  5233 	 library_element_symtable.insert($2, prev_declared_derived_function_block_name_token);
  5264 	 library_element_symtable.insert($2, prev_declared_derived_function_block_name_token);
  5234 	 add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5265 	 if (!runtime_options.disable_implicit_en_eno) add_en_eno_param_decl_c::add_to($$); /* add EN and ENO declarations, if not already there */
  5235 	 /* Clear the variable_name_symtable. Since we have finished parsing the function block,
  5266 	 /* Clear the variable_name_symtable. Since we have finished parsing the function block,
  5236 	  * the variable names are now out of scope, so are no longer valid!
  5267 	  * the variable names are now out of scope, so are no longer valid!
  5237 	  */
  5268 	  */
  5238 	 variable_name_symtable.pop();
  5269 	 variable_name_symtable.pop();
  5239 	 direct_variable_symtable.pop();
  5270 	 direct_variable_symtable.pop();
  5250 /*  Rule already covered by the rule to handle the preparse state!
  5281 /*  Rule already covered by the rule to handle the preparse state!
  5251 | FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK
  5282 | FUNCTION_BLOCK derived_function_block_name END_FUNCTION_BLOCK
  5252 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in function block declaration."); yynerrs++;}
  5283 	{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no variable(s) declared and body defined in function block declaration."); yynerrs++;}
  5253 */
  5284 */
  5254 | FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_OF_INPUT
  5285 | FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations_list function_block_body END_OF_INPUT
  5255 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "no variable(s) declared and body defined in function block declaration."); yynerrs++;}	
  5286 	{$$ = NULL; print_err_msg(locf(@1), locl(@2), "expecting END_FUNCTION_BLOCK before end of file."); yynerrs++;}	
  5256 | FUNCTION_BLOCK error END_FUNCTION_BLOCK
  5287 | FUNCTION_BLOCK error END_FUNCTION_BLOCK
  5257 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function block declaration."); yyerrok;}
  5288 	{$$ = NULL; print_err_msg(locf(@2), locl(@2), "unknown error in function block declaration."); yyerrok;}
  5258 /* ERROR_CHECK_END */
  5289 /* ERROR_CHECK_END */
  5259 ;
  5290 ;
  5260 
  5291 
  5359 ;
  5390 ;
  5360 
  5391 
  5361 
  5392 
  5362 
  5393 
  5363 function_block_body:
  5394 function_block_body:
  5364   statement_list	{$$ = $1;}
  5395   /* NOTE: start_ST_body_token is a dummy token generated by flex when it determines it is starting to parse a POU body in ST
  5365 | instruction_list	{$$ = $1;}
  5396    *       start_IL_body_token is a dummy token generated by flex when it determines it is starting to parse a POU body in IL
  5366 | sequential_function_chart	{$$ = $1;}
  5397    *     These tokens help remove a reduce/reduce conflict in bison, between a formal function invocation in IL, and a
       
  5398    *     function invocation used as a statement (a non-standard extension added to matiec) 
       
  5399    *       e.g: FUNCTION_BLOCK foo
       
  5400    *            VAR ... END_VAR
       
  5401    *              func_returning_void(in1 := 3        
       
  5402    *                                 );               --> only the presence or absence of ';' will determine whether this is a IL or ST 
       
  5403    *                                                      function invocation. (In standard ST this would be ilegal, in matiec we allow it 
       
  5404    *                                                      when activated by a command line option)
       
  5405    *            END_FUNCTION
       
  5406    */
       
  5407   start_ST_body_token statement_list	{$$ = $2;}  
       
  5408 | start_IL_body_token instruction_list	{$$ = $2;}
       
  5409 | sequential_function_chart		{$$ = $1;}
  5367 /*
  5410 /*
  5368 | ladder_diagram
  5411 | ladder_diagram
  5369 | function_block_diagram
  5412 | function_block_diagram
  5370 | <other languages>
  5413 | <other languages>
  5371 */
  5414 */
  7810 /*  function_name '(' [param_assignment_list] ')' */
  7853 /*  function_name '(' [param_assignment_list] ')' */
  7811   function_name_no_NOT_clashes '(' param_assignment_formal_list ')'
  7854   function_name_no_NOT_clashes '(' param_assignment_formal_list ')'
  7812 	{$$ = new function_invocation_c($1, $3, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c
  7855 	{$$ = new function_invocation_c($1, $3, NULL, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c
  7813 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
  7856 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list ')'
  7814 	{$$ = new function_invocation_c($1, NULL, $3, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c
  7857 	{$$ = new function_invocation_c($1, NULL, $3, locloc(@$)); if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR;} // $1 should be a poutype_identifier_c
       
  7858 | function_name_no_NOT_clashes '(' ')'
       
  7859 	{if (NULL == dynamic_cast<poutype_identifier_c*>($1)) ERROR; // $1 should be a poutype_identifier_c
       
  7860 	 if (runtime_options.allow_missing_var_in)
       
  7861 		{$$ = new function_invocation_c($1, NULL, NULL, locloc(@$));}
       
  7862 	 else
       
  7863 		{$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;}
       
  7864 	}
  7815 /* ERROR_CHECK_BEGIN */ 
  7865 /* ERROR_CHECK_BEGIN */ 
  7816 | function_name_no_NOT_clashes param_assignment_formal_list ')'
  7866 | function_name_no_NOT_clashes param_assignment_formal_list ')'
  7817   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;}
  7867   {$$ = NULL; print_err_msg(locl(@1), locf(@2), "'(' missing after function name in ST expression."); yynerrs++;}
  7818 | function_name_no_NOT_clashes '(' ')'
       
  7819   {$$ = NULL; print_err_msg(locl(@2), locf(@3), "no parameter defined in function invocation of ST expression."); yynerrs++;}
       
  7820 | function_name_no_NOT_clashes '(' error ')'
  7868 | function_name_no_NOT_clashes '(' error ')'
  7821   {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter(s) defined in function invocation of ST expression."); yyerrok;}
  7869   {$$ = NULL; print_err_msg(locf(@3), locl(@3), "invalid parameter(s) defined in function invocation of ST expression."); yyerrok;}
  7822 | function_name_no_NOT_clashes '(' param_assignment_formal_list error
  7870 | function_name_no_NOT_clashes '(' param_assignment_formal_list error
  7823   {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;}
  7871   {$$ = NULL; print_err_msg(locl(@3), locf(@4), "')' missing at the end of function invocation in ST expression."); yyerrok;}
  7824 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list error
  7872 | function_name_no_NOT_clashes '(' param_assignment_nonformal_list error
  7855 statement:
  7903 statement:
  7856   assignment_statement
  7904   assignment_statement
  7857 | subprogram_control_statement
  7905 | subprogram_control_statement
  7858 | selection_statement
  7906 | selection_statement
  7859 | iteration_statement
  7907 | iteration_statement
       
  7908 | function_invocation 
       
  7909 	{ /* This is a non-standard extension (calling a function outside an ST expression!) */
       
  7910 	  /* Only allow this if command line option has been selected...                     */
       
  7911 	  $$ = $1; 
       
  7912 	  if (!runtime_options.allow_void_datatype) {
       
  7913 	    print_err_msg(locf(@1), locl(@1), "Function invocation in ST code is not allowed outside an expression. To allow this non-standard syntax, activate the apropriate command line option."); 
       
  7914 	    yynerrs++;
       
  7915 	  }
       
  7916 	}  
  7860 ;
  7917 ;
  7861 
  7918 
  7862 
  7919 
  7863 /*********************************/
  7920 /*********************************/
  7864 /* B 3.2.1 Assignment Statements */
  7921 /* B 3.2.1 Assignment Statements */
  8441  * written code, so we only allow this extra syntax while parsing the 
  8498  * written code, so we only allow this extra syntax while parsing the 
  8442  * 'header' file that declares all the standard IEC 61131-3 functions.
  8499  * 'header' file that declares all the standard IEC 61131-3 functions.
  8443  */
  8500  */
  8444 bool allow_extensible_function_parameters = false;
  8501 bool allow_extensible_function_parameters = false;
  8445 
  8502 
  8446 /* A global flag indicating whether to include the full variable location when printing out error messages... */
       
  8447 bool full_token_loc;
       
  8448 /* A global flag used to tell the parser whether to generate conversion function for enumerated data types. */
       
  8449 bool conversion_functions = false;
       
  8450 /* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */
  8503 /* A global flag used to tell the parser whether to allow use of DREF and '^' operators (defined in IEC 61131-3 v3) */
  8451 bool allow_ref_dereferencing;
  8504 bool allow_ref_dereferencing;
  8452 /* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension) */
  8505 /* A global flag used to tell the parser whether to allow use of REF_TO ANY datatypes (non-standard extension) */
  8453 bool allow_ref_to_any = false;
  8506 bool allow_ref_to_any = false;
  8454 /* A global flag used to tell the parser whether to allow use of REF_TO as a struct or array element (non-standard extension) */
  8507 /* A global flag used to tell the parser whether to allow use of REF_TO as a struct or array element (non-standard extension) */
  8520 
  8573 
  8521   const char *unknown_file = "<unknown_file>";
  8574   const char *unknown_file = "<unknown_file>";
  8522   if (first_filename == NULL) first_filename = unknown_file;
  8575   if (first_filename == NULL) first_filename = unknown_file;
  8523   if ( last_filename == NULL)  last_filename = unknown_file;
  8576   if ( last_filename == NULL)  last_filename = unknown_file;
  8524 
  8577 
  8525   if (full_token_loc) {
  8578   if (runtime_options.full_token_loc) {
  8526     if (first_filename == last_filename)
  8579     if (first_filename == last_filename)
  8527       fprintf(stderr, "%s:%d-%d..%d-%d: error: %s\n", first_filename, first_line, first_column, last_line, last_column, additional_error_msg);
  8580       fprintf(stderr, "%s:%d-%d..%d-%d: error: %s\n", first_filename, first_line, first_column, last_line, last_column, additional_error_msg);
  8528     else
  8581     else
  8529       fprintf(stderr, "%s:%d-%d..%s:%d-%d: error: %s\n", first_filename, first_line, first_column, last_filename, last_line, last_column, additional_error_msg);
  8582       fprintf(stderr, "%s:%d-%d..%s:%d-%d: error: %s\n", first_filename, first_line, first_column, last_filename, last_line, last_column, additional_error_msg);
  8530   } else {
  8583   } else {
  8706     return -1;
  8759     return -1;
  8707   }
  8760   }
  8708 
  8761 
  8709   allow_function_overloading           = true;
  8762   allow_function_overloading           = true;
  8710   allow_extensible_function_parameters = true;
  8763   allow_extensible_function_parameters = true;
  8711   full_token_loc                       = runtime_options.full_token_loc;
       
  8712   conversion_functions                 = runtime_options.conversion_functions;
       
  8713   allow_ref_dereferencing              = runtime_options.ref_standard_extensions;
  8764   allow_ref_dereferencing              = runtime_options.ref_standard_extensions;
  8714   allow_ref_to_any                     = runtime_options.ref_nonstand_extensions;
  8765   allow_ref_to_any                     = runtime_options.ref_nonstand_extensions;
  8715   allow_ref_to_in_derived_datatypes    = runtime_options.ref_nonstand_extensions;
  8766   allow_ref_to_in_derived_datatypes    = runtime_options.ref_nonstand_extensions;
  8716   if (yyparse() != 0) {
  8767   if (yyparse() != 0) {
  8717     fprintf (stderr, "\nParsing failed because of too many consecutive syntax errors in standard library. Bailing out!\n");
  8768     fprintf (stderr, "\nParsing failed because of too many consecutive syntax errors in standard library. Bailing out!\n");
  8743     return -3;
  8794     return -3;
  8744   }
  8795   }
  8745 
  8796 
  8746   allow_function_overloading           = false;
  8797   allow_function_overloading           = false;
  8747   allow_extensible_function_parameters = false;
  8798   allow_extensible_function_parameters = false;
  8748   full_token_loc                       = runtime_options.full_token_loc;
       
  8749   conversion_functions                 = runtime_options.conversion_functions;
       
  8750   allow_ref_dereferencing              = runtime_options.ref_standard_extensions;
  8799   allow_ref_dereferencing              = runtime_options.ref_standard_extensions;
  8751   allow_ref_to_any                     = runtime_options.ref_nonstand_extensions;
  8800   allow_ref_to_any                     = runtime_options.ref_nonstand_extensions;
  8752   allow_ref_to_in_derived_datatypes    = runtime_options.ref_nonstand_extensions;
  8801   allow_ref_to_in_derived_datatypes    = runtime_options.ref_nonstand_extensions;
  8753   //allow_ref_to_any = false;    /* we only allow REF_TO ANY in library functions/FBs, no matter what the user asks for in the command line */
  8802   //allow_ref_to_any = false;    /* we only allow REF_TO ANY in library functions/FBs, no matter what the user asks for in the command line */
  8754 
  8803