]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
Regen.
[bison.git] / data / lalr1.cc
index 48cfe3eb6da799c8367cb28f656331a0f37ad263..eb4376c04965df0d1fa9b23b2f57f01258b6d1f1 100644 (file)
@@ -1,6 +1,6 @@
 m4_divert(-1)
 # C++ skeleton for Bison
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
 # 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
@@ -17,8 +17,6 @@ m4_divert(-1)
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307  USA
 
-m4_include([c.m4])
-
 ## ---------------- ##
 ## Default values.  ##
 ## ---------------- ##
@@ -89,9 +87,10 @@ m4_define([b4_constructor],
 # We do want M4 expansion after # for CPP macros.
 m4_changecom()
 m4_divert(0)dnl
-@output @output_header_name@
+m4_if(b4_defines_flag, 0, [],
+[@output @output_header_name@
 b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
-             [2002])[
+             [2002, 2003])[
 /* FIXME: This is wrong, we want computed header guards.
    I don't know why the macros are missing now. :( */
 #ifndef PARSER_HEADER_H
@@ -111,7 +110,7 @@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
 /* Copy the first part of user declarations.  */
 ]b4_pre_prologue[
 
-]/* Line __line__ of __file__.  */
+]/* Line __line__ of lalr1.cc.  */
 b4_syncline([@oline@], [@ofile@])[
 
 /* Enabling traces.  */
@@ -128,7 +127,7 @@ b4_syncline([@oline@], [@ofile@])[
 ]m4_ifdef([b4_stype],
 [b4_syncline([b4_stype_line], [b4_filename])
 typedef union b4_stype yystype;
-/* Line __line__ of __file__.  */
+/* Line __line__ of lalr1.cc.  */
 b4_syncline([@oline@], [@ofile@])],
 [typedef int yystype;])[
 # define YYSTYPE yystype
@@ -137,12 +136,11 @@ b4_syncline([@oline@], [@ofile@])],
 /* Copy the second part of user declarations.  */
 ]b4_post_prologue[
 
-]/* Line __line__ of __file__.  */
+]/* Line __line__ of lalr1.cc.  */
 b4_syncline([@oline@], [@ofile@])[
 #ifndef YYLLOC_DEFAULT
 # define YYLLOC_DEFAULT(Current, Rhs, N) \
-   Current.last_line = Rhs[N].last_line; \
-   Current.last_column = Rhs[N].last_column;
+   Current.last = Rhs[N].last;
 #endif
 
 namespace yy
@@ -284,12 +282,12 @@ namespace yy
 }
 
 #endif /* ! defined PARSER_HEADER_H */]
-dnl
+])dnl
 @output @output_parser_name@
 b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
-             [2002])[
+             [2002, 2003])
 
-#include @output_header_name@
+m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -304,7 +302,10 @@ yy::]b4_parser_class_name[::parse ()
   int nerrs = 0;
   int errstatus = 0;
 
-  /* Initialize stack.  */
+  /* Initialize the stacks.  The initial state will be pushed in
+     yynewstate, since the latter expects the semantical and the
+     location values to have been already stored, initialize these
+     stacks with a primary value.  */
   state_stack_ = StateStack (0);
   semantic_stack_ = SemanticStack (1);
   location_stack_ = LocationStack (1);
@@ -383,8 +384,10 @@ yy::]b4_parser_class_name[::parse ()
     goto yyacceptlab;
 
   /* Shift the lookahead token.  */
+#if YYDEBUG
   YYCDEBUG << "Shifting token " << looka_
-        << " (" << name_[ilooka_] << "), ";
+           << " (" << name_[ilooka_] << "), ";
+#endif
 
   /* Discard the token being shifted unless it is eof.  */
   if (looka_ != eof_)
@@ -445,7 +448,7 @@ yy::]b4_parser_class_name[::parse ()
       ]b4_actions[
     }
 
-]/* Line __line__ of __file__.  */
+]/* Line __line__ of lalr1.cc.  */
 b4_syncline([@oline@], [@ofile@])[
 
   state_stack_.pop (len_);
@@ -547,7 +550,7 @@ b4_syncline([@oline@], [@ofile@])[
        }
 
       /* Pop the current state because it cannot handle the error token.  */
-      if (!state_stack_.height ())
+      if (state_stack_.height () == 1)
        goto yyabortlab;
 
 #if YYDEBUG
@@ -765,7 +768,7 @@ const yy::]b4_parser_class_name[::TokenNumberType yy::]b4_parser_class_name[::un
 ]b4_epilogue
 dnl
 @output stack.hh
-b4_copyright([2002])[
+b4_copyright([2002, 2003])[
 
 #ifndef BISON_STACK_HH
 # define BISON_STACK_HH
@@ -862,7 +865,7 @@ namespace yy
 #endif // not BISON_STACK_HH]
 dnl
 @output location.hh
-b4_copyright([2002])[
+b4_copyright([2002, 2003])[
 
 #ifndef BISON_LOCATION_HH
 # define BISON_LOCATION_HH