X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/95f22ad2a777be59535616142910f8914dac6f26..43d3b66471774fc5ec562ba35416f5ee5bae98c0:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index c613b3c8..18388c34 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -16,8 +16,8 @@ m4_divert(-1) # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -# 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA ## ---------------- ## ## Default values. ## @@ -115,7 +115,7 @@ m4_divert(0)dnl m4_if(b4_defines_flag, 0, [], [@output @output_header_name@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], - [2002, 2003, 2004])[ + [2002, 2003, 2004, 2005])[ /* FIXME: This is wrong, we want computed header guards. I don't know why the macros are missing now. :( */ #ifndef PARSER_HEADER_H @@ -408,7 +408,7 @@ namespace yy ])dnl @output @output_parser_name@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], - [2002, 2003, 2004]) + [2002, 2003, 2004, 2005]) m4_if(b4_prefix[], [yy], [], [ // Take the name prefix into account. @@ -417,6 +417,11 @@ m4_if(b4_defines_flag, 0, [], [ #include @output_header_name@])[ +/* INFRINGES ON USER NAME SPACE */ +#ifndef _ +# define _(msgid) msgid +#endif + /* A pseudo ostream that takes yydebug_ into account. */ # define YYCDEBUG \ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ @@ -544,7 +549,9 @@ yy::]b4_parser_class_name[::set_debug_level (debug_level_type l) int yy::]b4_parser_class_name[::parse () { - YYCDEBUG << "Starting parse" << std::endl; + int yyresult_; + + YYCDEBUG << _("Starting parse") << std::endl; yynerrs_ = 0; yyerrstatus_ = 0; @@ -576,7 +583,7 @@ b4_syncline([@oline@], [@ofile@])])dnl /* New state. */ yynewstate: yystate_stack_.push (yystate_); - YYCDEBUG << "Entering state " << yystate_ << std::endl; + YYCDEBUG << _("Entering state ") << yystate_ << std::endl; goto yybackup; /* Backup. */ @@ -595,12 +602,12 @@ yybackup: if (yylooka_ <= yyeof_) { yylooka_ = yyilooka_ = yyeof_; - YYCDEBUG << "Now at end of input." << std::endl; + YYCDEBUG << _("Now at end of input.") << std::endl; } else { yyilooka_ = yytranslate_ (yylooka_); - YY_SYMBOL_PRINT ("Next token is", yyilooka_, &yylval, &yylloc); + YY_SYMBOL_PRINT (_("Next token is"), yyilooka_, &yylval, &yylloc); } /* If the proper action on seeing token ILOOKA_ is to reduce or to @@ -629,7 +636,7 @@ yybackup: goto yyacceptlab; /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yyilooka_, &yylval, &yylloc); + YY_SYMBOL_PRINT (_("Shifting"), yyilooka_, &yylval, &yylloc); /* Discard the token being shifted unless it is eof. */ if (yylooka_ != yyeof_) @@ -727,7 +734,7 @@ yyerrlab: yypop_ (); if (yystate_stack_.height () == 1) YYABORT; - yydestruct_ ("Error: popping", + yydestruct_ (_("Error: popping"), yystos_[yystate_stack_[0]], &yysemantic_stack_[0], &yylocation_stack_[0]); @@ -735,7 +742,7 @@ yyerrlab: } else { - yydestruct_ ("Error: discarding", yyilooka_, &yylval, &yylloc); + yydestruct_ (_("Error: discarding"), yyilooka_, &yylval, &yylloc); yylooka_ = yyempty_; } } @@ -786,7 +793,7 @@ yyerrlab1: YYABORT; yyerror_range_[0] = yylocation_stack_[0]; - yydestruct_ ("Error: popping", + yydestruct_ (_("Error: popping"), yystos_[yystate_], &yysemantic_stack_[0], &yylocation_stack_[0]); yypop_ (); @@ -805,7 +812,7 @@ yyerrlab1: yylocation_stack_.push (yyloc); /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos_[yyn_], + YY_SYMBOL_PRINT (_("Shifting"), yystos_[yyn_], &yysemantic_stack_[0], &yylocation_stack_[0]); yystate_ = yyn_; @@ -813,20 +820,24 @@ yyerrlab1: /* Accept. */ yyacceptlab: - return 0; + yyresult_ = 0; + goto yyreturn; /* Abort. */ yyabortlab: - /* Free the lookahead. */ - yydestruct_ ("Error: discarding lookahead", yyilooka_, &yylval, &yylloc); - yylooka_ = yyempty_; - return 1; + yyresult_ = 1; + goto yyreturn; + +yyreturn: + if (yylooka_ != yyeof_ && yylooka_ != yyempty_) + yydestruct_ (_("Error: discarding lookahead"), yyilooka_, &yylval, &yylloc); + return yyresult_; } void yy::]b4_parser_class_name[::yylex_ () { - YYCDEBUG << "Reading a token: "; + YYCDEBUG << _("Reading a token: "); #if YYLSP_NEEDED yylooka_ = yylex (&yylval, &yylloc); #else @@ -859,7 +870,7 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ () if (yycheck_[x + yyn_] == x && x != yyterror_) ++count; - message = "syntax error, unexpected "; + message = _("syntax error, unexpected "); message += yyname_[yyilooka_]; if (count < 5) { @@ -867,14 +878,14 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ () for (int x = yyxbegin; x < yyxend; ++x) if (yycheck_[x + yyn_] == x && x != yyterror_) { - message += (!count++) ? ", expecting " : " or "; + message += (!count++) ? _(", expecting ") : _(" or "); message += yyname_[x]; } } } else #endif - message = "syntax error"; + message = _("syntax error"); error (yylloc, message); } } @@ -998,7 +1009,7 @@ yy::]b4_parser_class_name[::yyrline_[] = void yy::]b4_parser_class_name[::yystack_print_ () { - *yycdebug_ << "Stack now"; + *yycdebug_ << _("Stack now"); for (state_stack_type::const_iterator i = yystate_stack_.begin (); i != yystate_stack_.end (); ++i) *yycdebug_ << ' ' << *i; @@ -1011,8 +1022,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]] << ' '; @@ -1051,7 +1062,7 @@ const yy::]b4_parser_class_name[::token_number_type yy::]b4_parser_class_name[:: ]b4_epilogue dnl @output stack.hh -b4_copyright([stack handling for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([stack handling for Bison C++ parsers], [2002, 2003, 2004, 2005])[ #ifndef BISON_STACK_HH # define BISON_STACK_HH @@ -1150,7 +1161,7 @@ namespace yy #endif // not BISON_STACK_HH] dnl @output position.hh -b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([Position class for Bison C++ parsers], [2002, 2003, 2004, 2005])[ /** ** \file position.hh @@ -1263,7 +1274,7 @@ namespace yy } #endif // not BISON_POSITION_HH] @output location.hh -b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004])[ +b4_copyright([Location class for Bison C++ parsers], [2002, 2003, 2004, 2005])[ /** ** \file location.hh