X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/a85284cfbd1334c940e65b59c44ada379029e074..4517da37570b39a3d4b3f523dd373abe7c622bb0:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index d9d9af9d..94fc9183 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -32,12 +32,7 @@ m4_if(b4_defines_flag, 0, [], b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], [2002, 2003, 2004, 2005]) dnl FIXME: This is wrong, we want computed header guards. -[/* As a special exception, when this parser skeleton is copied by - Bison into a Bison output file, you may use that output file - without restriction. This special exception was added by the Free - Software Foundation for C++ LALR(1) parsers in version 2.2 of - Bison. */ - +[ /* C++ LALR(1) parser skeleton written by Akim Demaille. */ #ifndef PARSER_HEADER_H @@ -158,13 +153,20 @@ b4_syncline([@oline@], [@ofile@])], b4_error_verbose_if([, int tok])[); #if YYDEBUG + /// \brief Report a symbol value on the debug stream. + /// \param yytype The token type. + /// \param yyvaluep Its semantic value. + /// \param yylocationp Its location. + virtual void yy_symbol_value_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); /// \brief Report a symbol on the debug stream. /// \param yytype The token type. /// \param yyvaluep Its semantic value. /// \param yylocationp Its location. - virtual void yysymprint_ (int yytype, - const semantic_type* yyvaluep, - const location_type* yylocationp); + virtual void yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, + const location_type* yylocationp); #endif /* ! YYDEBUG */ @@ -285,7 +287,7 @@ b4_error_verbose_if([, int tok])[); [b4_token_defines(b4_tokens) #ifndef YYSTYPE - /* Redirection for backward compatibility. */ + /* Redirection for backward compatibility. */ # define YYSTYPE yy::b4_parser_class_name::semantic_type #endif ])[ @@ -323,7 +325,7 @@ b4_syncline([@oline@], [@ofile@])[ /* Suppress unused-variable warnings by "using" E. */ #define YYUSE(e) ((void) (e)) -/* A pseudo ostream that takes yydebug_ into account. */ +/* A pseudo ostream that takes yydebug_ into account. */ # define YYCDEBUG \ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ (*yycdebug_) @@ -336,7 +338,7 @@ do { \ if (yydebug_) \ { \ *yycdebug_ << Title << ' '; \ - yysymprint_ ((Type), (Value), (Location)); \ + yy_symbol_print_ ((Type), (Value), (Location)); \ *yycdebug_ << std::endl; \ } \ } while (false) @@ -424,26 +426,29 @@ namespace yy | Print this symbol on YYOUTPUT. | `--------------------------------*/ - void - ]b4_parser_class_name[::yysymprint_ (int yytype, + inline void + ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype, const semantic_type* yyvaluep, const location_type* yylocationp) { - /* Backward compatibility, but should be removed eventually. */ - std::ostream& cdebug_ = *yycdebug_; - - YYUSE (!&cdebug_); YYUSE (yylocationp); YYUSE (yyvaluep); - - *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") - << ' ' << yytname_[yytype] << " (" - << *yylocationp << ": "; switch (yytype) { ]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl [ default: break; } + } + + + void + ]b4_parser_class_name[::yy_symbol_print_ (int yytype, + const semantic_type* yyvaluep, const location_type* yylocationp) + { + *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") + << ' ' << yytname_[yytype] << " (" + << *yylocationp << ": "; + yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); *yycdebug_ << ')'; } #endif /* ! YYDEBUG */ @@ -512,7 +517,7 @@ namespace yy int yylen = 0; int yystate = 0; - /* Error handling. */ + /* Error handling. */ int yynerrs_ = 0; int yyerrstatus_ = 0; @@ -535,7 +540,7 @@ namespace yy ]m4_ifdef([b4_initial_action], [ m4_pushdef([b4_at_dollar], [yylloc])dnl m4_pushdef([b4_dollar_dollar], [yylval])dnl - /* User initialization code. */ + /* User initialization code. */ b4_initial_action m4_popdef([b4_dollar_dollar])dnl m4_popdef([b4_at_dollar])dnl @@ -732,7 +737,7 @@ b4_error_verbose_if([, yytoken])[)); yyerror_range[0] = yylocation_stack_[yylen - 1]; /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ + this YYERROR. */ yypop_ (yylen); yylen = 0; yystate = yystate_stack_[0]; @@ -781,7 +786,7 @@ b4_error_verbose_if([, yytoken])[)); yysemantic_stack_.push (yylval); yylocation_stack_.push (yyloc); - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], &yysemantic_stack_[0], &yylocation_stack_[0]); @@ -803,7 +808,7 @@ b4_error_verbose_if([, yytoken])[)); yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ + this YYABORT or YYACCEPT. */ yypop_ (yylen); while (yystate_stack_.height () != 1) { @@ -950,7 +955,7 @@ b4_error_verbose_if([, int tok])[) #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at \a yyntokens_, nonterminals. */ + First, the terminals, then, starting at \a yyntokens_, nonterminals. */ const char* const ]b4_parser_class_name[::yytname_[] = { @@ -959,7 +964,7 @@ b4_error_verbose_if([, int tok])[) #endif #if YYDEBUG - /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ const ]b4_parser_class_name[::rhs_number_type ]b4_parser_class_name[::yyrhs_[] = {