X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/5f340b4884a158f9d05e9325c4cfde2751f3e660..c19178bfaf07d8c56af805e310573595ad67cee9:/data/lalr1.cc diff --git a/data/lalr1.cc b/data/lalr1.cc index 2d53bf9c..603786e5 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -1,29 +1,25 @@ # C++ skeleton for Bison -# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, -# Inc. +# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -# This program is free software; you can redistribute it and/or modify +# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. - +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. - +# # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301 USA +# along with this program. If not, see . m4_include(b4_pkgdatadir/[c++.m4]) m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])]) -m4_define([b4_namespace], - [b4_percent_define_get([[namespace]])]) # The header is mandatory. b4_defines_if([], @@ -37,9 +33,9 @@ m4_include(b4_pkgdatadir/[location.cc]) m4_changecom() m4_divert_push(0)dnl b4_defines_if( -[@output(b4_spec_defines_file@) +[@output(b4_spec_defines_file@)@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++], - [2002, 2003, 2004, 2005, 2006]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008]) dnl FIXME: This is wrong, we want computed header guards. [ /* C++ LALR(1) parser skeleton written by Akim Demaille. */ @@ -53,11 +49,10 @@ dnl FIXME: This is wrong, we want computed header guards. #include #include "stack.hh" -namespace ]b4_namespace[ -{ +]b4_namespace_open[ class position; class location; -} +]b4_namespace_close[ #include "location.hh" @@ -98,8 +93,7 @@ do { \ } while (false) #endif -namespace ]b4_namespace[ -{ +]b4_namespace_open[ /// A Bison parser. class ]b4_parser_class_name[ @@ -136,6 +130,7 @@ b4_user_stype /// \returns 0 iff parsing succeeded. virtual int parse (); +#if YYDEBUG /// The current debugging stream. std::ostream& debug_stream () const; /// Set the current debugging stream. @@ -147,6 +142,7 @@ b4_user_stype debug_level_type debug_level () const; /// Set the current debugging level. void set_debug_level (debug_level_type l); +#endif private: /// Report a syntax error. @@ -288,23 +284,23 @@ b4_error_verbose_if([, int tok])[); static const token_number_type yyundef_token_; ]b4_parse_param_vars[ }; -} +]b4_namespace_close[ -]m4_ifval(b4_percent_define_get([[global_tokens_and_yystype]]), +]b4_percent_define_flag_if([[global_tokens_and_yystype]], [b4_token_defines(b4_tokens) #ifndef YYSTYPE /* Redirection for backward compatibility. */ -# define YYSTYPE b4_namespace::b4_parser_class_name::semantic_type +# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type #endif ]) b4_percent_code_get([[provides]])[]dnl [#endif /* ! defined PARSER_HEADER_H */] ])dnl -@output(b4_parser_file_name@) +@output(b4_parser_file_name@)@ b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++], - [2002, 2003, 2004, 2005, 2006]) + [2002, 2003, 2004, 2005, 2006, 2007, 2008]) b4_percent_code_get([[top]])[]dnl m4_if(b4_prefix, [yy], [], [ @@ -373,12 +369,15 @@ do { \ #endif /* !YYDEBUG */ +#define yyerrok (yyerrstatus_ = 0) +#define yyclearin (yychar = yyempty_) + #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYRECOVERING() (!!yyerrstatus_) -namespace ]b4_namespace[ -{ +]b4_namespace_open[ #if YYERROR_VERBOSE /* Return YYSTR after stripping away unnecessary quotes and @@ -540,7 +539,7 @@ namespace ]b4_namespace[ /// Location of the lookahead. location_type yylloc; /// The locations where the error started and ended. - location yyerror_range[2]; + location_type yyerror_range[2]; /// $$. semantic_type yyval; @@ -677,7 +676,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[; switch (yyn) { ]b4_user_actions[ - default: break; + default: + break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); @@ -795,7 +795,7 @@ b4_error_verbose_if([, yytoken])[)); /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], - &yysemantic_stack_[0], &yylocation_stack_[0]); + &yysemantic_stack_[0], &yylocation_stack_[0]); yystate = yyn; goto yynewstate; @@ -1051,21 +1051,20 @@ b4_error_verbose_if([, int tok])[) const unsigned int ]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[; const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[; -} // namespace ]b4_namespace[ +]b4_namespace_close[ ]b4_epilogue dnl -@output(b4_dir_prefix[]stack.hh@) +@output(b4_dir_prefix[]stack.hh@)@ b4_copyright([Stack handling for Bison parsers in C++], - [2002, 2003, 2004, 2005, 2006])[ + [2002, 2003, 2004, 2005, 2006, 2007, 2008])[ #ifndef BISON_STACK_HH # define BISON_STACK_HH #include -namespace ]b4_namespace[ -{ +]b4_namespace_open[ template > class stack { @@ -1151,7 +1150,8 @@ namespace ]b4_namespace[ const S& stack_; unsigned int range_; }; -} +]b4_namespace_close[ -#endif // not BISON_STACK_HH] +#endif // not BISON_STACK_HH[]dnl +] m4_divert_pop(0)