]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
Fix Doxygen comment.
[bison.git] / data / lalr1.cc
index cb770252dd211b2f81d66ba1dfb0feb70be67ea4..99b8e9e8bb6ca1a23fbf09fa4c890dc0fd35541e 100644 (file)
@@ -1,6 +1,6 @@
 # C++ skeleton for Bison
 
 # C++ skeleton for Bison
 
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 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
 
 # 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
@@ -115,7 +115,7 @@ m4_popdef([b4_dollar_dollar])dnl
 
 
 m4_pushdef([b4_copyright_years],
 
 
 m4_pushdef([b4_copyright_years],
-           [2002-2011])
+           [2002-2012])
 
 m4_define([b4_parser_class_name],
           [b4_percent_define_get([[parser_class_name]])])
 
 m4_define([b4_parser_class_name],
           [b4_percent_define_get([[parser_class_name]])])
@@ -157,6 +157,8 @@ dnl FIXME: This is wrong, we want computed header guards.
 b4_variant_define
 b4_namespace_close])[
 
 b4_variant_define
 b4_namespace_close])[
 
+]b4_null_define[
+
 /* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG ]b4_parse_trace_if([1], [0])[
 /* Enabling traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG ]b4_parse_trace_if([1], [0])[
@@ -209,6 +211,9 @@ b4_namespace_close])[
     /// \param msg    a description of the syntax error.
     virtual void error (]b4_locations_if([const location_type& loc, ])[const std::string& msg);
 
     /// \param msg    a description of the syntax error.
     virtual void error (]b4_locations_if([const location_type& loc, ])[const std::string& msg);
 
+    /// Report a syntax error.
+    void error (const syntax_error& err);
+
   private:
     /// State numbers.
     typedef int state_type;
   private:
     /// State numbers.
     typedef int state_type;
@@ -441,7 +446,7 @@ b4_percent_code_get[]dnl
 #else /* !YYDEBUG */
 
 # define YYCDEBUG if (false) std::cerr
 #else /* !YYDEBUG */
 
 # define YYCDEBUG if (false) std::cerr
-# define YY_SYMBOL_PRINT(Title, Symbol)  static_cast<void>(0)
+# define YY_SYMBOL_PRINT(Title, Symbol)  YYUSE(Symbol)
 # define YY_REDUCE_PRINT(Rule)           static_cast<void>(0)
 # define YY_STACK_PRINT()                static_cast<void>(0)
 
 # define YY_REDUCE_PRINT(Rule)           static_cast<void>(0)
 # define YY_STACK_PRINT()                static_cast<void>(0)
 
@@ -545,7 +550,6 @@ b4_percent_code_get[]dnl
                                        symbol_base_type<Exact>& yysym) const
   {
     int yytype = yysym.type_get ();
                                        symbol_base_type<Exact>& yysym) const
   {
     int yytype = yysym.type_get ();
-    YYUSE (yymsg);
     if (yymsg)
       YY_SYMBOL_PRINT (yymsg, yysym);
 
     if (yymsg)
       YY_SYMBOL_PRINT (yymsg, yysym);
 
@@ -711,7 +715,7 @@ m4_popdef([b4_at_dollar])])dnl
        location values to have been already stored, initialize these
        stacks with a primary value.  */
     yystack_ = stack_type (0);
        location values to have been already stored, initialize these
        stacks with a primary value.  */
     yystack_ = stack_type (0);
-    yypush_ (0, 0, yyla);
+    yypush_ (YY_NULL, 0, yyla);
 
     // A new symbol was pushed on the stack.
   yynewstate:
 
     // A new symbol was pushed on the stack.
   yynewstate:
@@ -735,13 +739,21 @@ m4_popdef([b4_at_dollar])])dnl
     if (yyempty)
       {
         YYCDEBUG << "Reading a token: ";
     if (yyempty)
       {
         YYCDEBUG << "Reading a token: ";
+        try
+        {
 ]b4_lex_symbol_if(
 ]b4_lex_symbol_if(
-[        yyla = b4_c_function_call([yylex], [symbol_type],
-                                   m4_ifdef([b4_lex_param], b4_lex_param));],
-[        yyla.type = yytranslate_ (b4_c_function_call([yylex], [int],
+[          yyla = b4_c_function_call([yylex], [symbol_type],
+                                     m4_ifdef([b4_lex_param], b4_lex_param));],
+[          yyla.type = yytranslate_ (b4_c_function_call([yylex], [int],
                                      [[YYSTYPE*], [&yyla.value]][]dnl
 b4_locations_if([, [[location*], [&yyla.location]]])dnl
 m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
                                      [[YYSTYPE*], [&yyla.value]][]dnl
 b4_locations_if([, [[location*], [&yyla.location]]])dnl
 m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
+        }
+        catch (const syntax_error& yyexc)
+        {
+          error (yyexc);
+          goto yyerrlab1;
+        }
         yyempty = false;
       }
     YY_SYMBOL_PRINT ("Next token is", yyla);
         yyempty = false;
       }
     YY_SYMBOL_PRINT ("Next token is", yyla);
@@ -824,8 +836,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
     }
     catch (const syntax_error& yyexc)
     {
     }
     catch (const syntax_error& yyexc)
     {
-      error (]b4_args(b4_locations_if([yyexc.location]),
-                      [[yyexc.what()]])[);
+      error (yyexc);
       YYERROR;
     }
     YY_SYMBOL_PRINT ("-> $$ =", yylhs);
       YYERROR;
     }
     YY_SYMBOL_PRINT ("-> $$ =", yylhs);
@@ -842,14 +853,14 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
       // in the debug trace, it's possibly junk.  Hence yymsg = 0.
       // Besides, that keeps exactly the same traces as with the other
       // Bison skeletons.
       // in the debug trace, it's possibly junk.  Hence yymsg = 0.
       // Besides, that keeps exactly the same traces as with the other
       // Bison skeletons.
-      yy_destroy_ (0, yystack_[i]);]])[
+      yy_destroy_ (YY_NULL, yystack_[i]);]])[
 
     yypop_ (yylen);
     yylen = 0;
     YY_STACK_PRINT ();
 
     /* Shift the result of the reduction.  */
 
     yypop_ (yylen);
     yylen = 0;
     YY_STACK_PRINT ();
 
     /* Shift the result of the reduction.  */
-    yypush_ (0, yylhs);
+    yypush_ (YY_NULL, yylhs);
     goto yynewstate;
 
   /*--------------------------------------.
     goto yynewstate;
 
   /*--------------------------------------.
@@ -972,6 +983,13 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
     return yyresult;
   }
 
     return yyresult;
   }
 
+  void
+  ]b4_parser_class_name[::error (const syntax_error& yyexc)
+  {
+    error (]b4_args(b4_locations_if([yyexc.location]),
+                    [[yyexc.what()]])[);
+  }
+
   // Generate an error message.
   std::string
   ]b4_parser_class_name[::yysyntax_error_ (]dnl
   // Generate an error message.
   std::string
   ]b4_parser_class_name[::yysyntax_error_ (]dnl
@@ -1040,7 +1058,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
           }
       }
 
           }
       }
 
-    char const* yyformat = 0;
+    char const* yyformat = YY_NULL;
     switch (yycount)
       {
 #define YYCASE_(N, S)                         \
     switch (yycount)
       {
 #define YYCASE_(N, S)                         \