X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/ad7458633d2f1f20da411de4cfe2e1975198e22e..9662b512840eb42db61d041580bbdc326f4ebd55:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index eef5a13c..e42a2e5d 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -417,6 +417,18 @@ m4_if(b4_defines_flag, 0, [], [ #include @output_header_name@])[ +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include /* FIXME: INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + /* A pseudo ostream that takes yydebug_ into account. */ # define YYCDEBUG \ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ @@ -833,11 +845,10 @@ void yy::]b4_parser_class_name[::yylex_ () { YYCDEBUG << "Reading a token: "; -#if YYLSP_NEEDED - yylooka_ = yylex (&yylval, &yylloc); -#else - yylooka_ = yylex (&yylval); -#endif + yylooka_ = ]b4_c_function_call([yylex], [int], +[[YYSTYPE*], [&yylval]][]dnl +b4_location_if([, [[location*], [&yylloc]]])dnl +m4_ifdef([b4_lex_param], [, ]b4_lex_param))[; } // Generate an error message, and invoke error. @@ -865,6 +876,14 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ () if (yycheck_[x + yyn_] == x && x != yyterror_) ++count; + // FIXME: This method of building the message is not compatible + // with internationalization. It should work like yacc.c does it. + // That is, first build a string that looks like this: + // "syntax error, unexpected %s or %s or %s" + // Then, invoke YY_ on this string. + // Finally, use the string as a format to output + // yyname_[yyilooka_], etc. + // Until this gets fixed, this message appears in English only. message = "syntax error, unexpected "; message += yyname_[yyilooka_]; if (count < 5) @@ -880,7 +899,7 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ () } else #endif - message = "syntax error"; + message = YY_("syntax error"); error (yylloc, message); } } @@ -1017,8 +1036,8 @@ yy::]b4_parser_class_name[::yyreduce_print_ (int yyrule) { unsigned int yylno = yyrline_[yyrule]; /* Print the symbols being reduced, and their result. */ - *yycdebug_ << "Reducing stack by rule " << yyn_ - 1 - << " (line " << yylno << "), "; + *yycdebug_ << "Reducing stack by rule " << yyn_ - 1 + << " (line " << yylno << "), "; for (]b4_int_type_for([b4_prhs])[ i = yyprhs_[yyn_]; 0 <= yyrhs_[i]; ++i) *yycdebug_ << yyname_[yyrhs_[i]] << ' ';