]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
TODO: statistics.
[bison.git] / data / lalr1.cc
index 36c8d581eba55622b5955af443473c84516d807d..ac2fa35bc6e294d3778511b053d65a0ce8b4caee 100644 (file)
@@ -147,6 +147,7 @@ dnl FIXME: This is wrong, we want computed header guards.
 ]b4_percent_code_get([[requires]])[
 
 ]b4_parse_assert_if([#include <cassert>])[
+#include <stdexcept>
 #include <string>
 #include <iostream>
 #include "stack.hh"
@@ -668,7 +669,7 @@ b4_percent_code_get[]dnl
   inline bool
   ]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
   {
-    return yyvalue == 0 || yyvalue == yytable_ninf_;
+    return yyvalue == yytable_ninf_;
   }
 
   int
@@ -814,12 +815,21 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
 
     // Perform the reduction.
     YY_REDUCE_PRINT (yyn);
-    switch (yyn)
+    try
+    {
+      switch (yyn)
       {
 ]b4_user_actions[
        default:
           break;
       }
+    }
+    catch (const syntax_error& yyexc)
+    {
+      error (]b4_args(b4_locations_if([yyexc.location]),
+                      [[yyexc.what()]])[);
+      YYERROR;
+    }
     YY_SYMBOL_PRINT ("-> $$ =", yylhs);
 ]b4_variant_if([[
     // Destroy the rhs symbols.