X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/d4bdb9167769a7247ac7c93c03fbe9ff7c238d34..2de160e12ea0b0313a3a4f2120b30a3eeaad0c76:/data/lalr1.cc

diff --git a/data/lalr1.cc b/data/lalr1.cc
index 5246e0df..342d87cf 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -1,33 +1,29 @@
 # 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, 2009
+# 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 <http://www.gnu.org/licenses/>.
 
 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([],
-              [b4_fatal([b4_skeleton[: @gettext<using %%defines is mandatory@>]])])
+              [b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
 
 # Backward compatibility.
 m4_define([b4_location_constructors])
@@ -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, 2009])
 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 <iostream>
 #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.
@@ -201,7 +197,7 @@ b4_error_verbose_if([, int tok])[);
     static const ]b4_int_type_for([b4_pact])[ yypact_[];
     static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
 
-    /// For a state, default rule to reduce.
+    /// For a state, default reduction number.
     /// Unless\a  yytable_ specifies something else to do.
     /// Zero means the default is an error.
     static const ]b4_int_type_for([b4_defact])[ yydefact_[];
@@ -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, 2009])
 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;
@@ -889,9 +889,9 @@ b4_error_verbose_if([, int tok])[)
     ]b4_pact[
   };
 
-  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
-     doesn't specify something else to do.  Zero means the default is an
-     error.  */
+  /* YYDEFACT[S] -- default reduction number in state S.  Performed when
+     YYTABLE doesn't specify something else to do.  Zero means the
+     default is an error.  */
   const ]b4_int_type_for([b4_defact])[
   ]b4_parser_class_name[::yydefact_[] =
   {
@@ -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, 2009])[
 
 #ifndef BISON_STACK_HH
 # define BISON_STACK_HH
 
 #include <deque>
 
-namespace ]b4_namespace[
-{
+]b4_namespace_open[
   template <class T, class S = std::deque<T> >
   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)