]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
Merge remote-tracking branch 'origin/maint'
[bison.git] / data / lalr1.cc
index 99b8e9e8bb6ca1a23fbf09fa4c890dc0fd35541e..92f93c2c75d6b98a9bdac4d4f10bd5d74a2f19cb 100644 (file)
@@ -126,8 +126,8 @@ b4_defines_if([],
 
 b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
   [# Backward compatibility.
-  m4_define([b4_location_constructors])
-  m4_include(b4_pkgdatadir/[location.cc])])])
+   m4_define([b4_location_constructors])
+   m4_include(b4_pkgdatadir/[location.cc])])])
 m4_include(b4_pkgdatadir/[stack.hh])
 b4_variant_if([m4_include(b4_pkgdatadir/[variant.hh])])
 
@@ -136,12 +136,15 @@ m4_changecom()
 m4_divert_push(0)dnl
 @output(b4_spec_defines_file@)@
 b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
-dnl FIXME: This is wrong, we want computed header guards.
 [
+/**
+ ** \file ]b4_spec_defines_file[
+ ** Define the ]b4_namespace_ref[::parser class.
+ */
+
 /* C++ LALR(1) parser skeleton written by Akim Demaille.  */
 
-#ifndef PARSER_HEADER_H
-# define PARSER_HEADER_H
+]b4_cpp_guard_open([b4_spec_defines_file])[
 
 ]b4_percent_code_get([[requires]])[
 
@@ -358,10 +361,9 @@ b4_public_types_define])[
  /* Redirection for backward compatibility.  */
 # define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type
 #endif
-])
-b4_percent_code_get([[provides]])[]dnl
-
-[#endif /* ! defined PARSER_HEADER_H */]
+])[
+]b4_percent_code_get([[provides]])[
+]b4_cpp_guard_close([b4_spec_defines_file])
 @output(b4_parser_file_name@)@
 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])
 b4_percent_code_get([[top]])[]dnl
@@ -549,11 +551,11 @@ b4_percent_code_get[]dnl
   ]b4_parser_class_name[::yy_destroy_ (const char* yymsg,
                                        symbol_base_type<Exact>& yysym) const
   {
-    int yytype = yysym.type_get ();
     if (yymsg)
       YY_SYMBOL_PRINT (yymsg, yysym);
 
     // User destructor.
+    int yytype = yysym.type_get ();
     switch (yytype)
       {
 ]b4_symbol_foreach([b4_symbol_destructor])dnl
@@ -571,6 +573,8 @@ b4_percent_code_get[]dnl
   ]b4_parser_class_name[::yy_print_ (std::ostream& yyo,
                                      const symbol_base_type<Exact>& yysym) const
   {
+    std::ostream& yyoutput = yyo;
+    YYUSE (yyoutput);
     int yytype = yysym.type_get ();
     yyo << (yytype < yyntokens_ ? "token" : "nterm")
         << ' ' << yytname_[yytype] << " ("]b4_locations_if([