]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
Fix %error-verbose for conflicts resolved by %nonassoc.
[bison.git] / data / yacc.c
index 3c7c602fec666498950eecde9e797c47297ec3f1..c12dfdaa85aaf0d09c473ae26293d0771324b2c7 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check the value of %define api.push_pull.
-b4_percent_define_default([[api.push_pull]], [[pull]])
-b4_percent_define_check_values([[[[api.push_pull]],
+# Check the value of %define api.push-pull.
+b4_percent_define_default([[api.push-pull]], [[pull]])
+b4_percent_define_check_values([[[[api.push-pull]],
                                [[pull]], [[push]], [[both]]]])
 b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
 b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
-m4_case(b4_percent_define_get([[api.push_pull]]),
+m4_case(b4_percent_define_get([[api.push-pull]]),
         [pull], [m4_define([b4_push_flag], [[0]])],
         [push], [m4_define([b4_pull_flag], [[0]])])
 
@@ -154,9 +154,9 @@ m4_define([b4_rhs_location],
 m4_changecom()
 m4_divert_push(0)dnl
 @output(b4_parser_file_name@)@
-b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
-  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-   2009])[
+b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],
+             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005,
+              2006, 2007, 2008, 2009])[
 
 /* C LALR(1) parser skeleton written by Richard Stallman, by
    simplifying the original so-called "semantic" parser.  */
@@ -586,6 +586,12 @@ static const ]b4_int_type_for([b4_table])[ yytable[] =
   ]b4_table[
 };
 
+#define yyis_pact_ninf(yystate) \
+  ]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
+
+#define yyis_table_ninf(yytable_value) \
+  ]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
+
 static const ]b4_int_type_for([b4_check])[ yycheck[] =
 {
   ]b4_check[
@@ -934,7 +940,8 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
       char const *yyprefix = yyexpecting;
 
       /* Start YYX at -YYN if negative to avoid negative indexes in
-        YYCHECK.  */
+        YYCHECK.  In other words, skip the first -YYN actions for this
+        state because they are default actions.  */
       int yyxbegin = yyn < 0 ? -yyn : 0;
 
       /* Stay within bounds of both yycheck and yytname.  */
@@ -946,7 +953,8 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
       yyfmt = yystpcpy (yyformat, yyunexpected);
 
       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+           && !yyis_table_ninf (yytable[yyx + yyn]))
          {
            if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
              {
@@ -1347,7 +1355,7 @@ yybackup:
 
   /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
+  if (yyis_pact_ninf (yyn))
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
@@ -1397,7 +1405,7 @@ yyread_pushed_token:]])[
   yyn = yytable[yyn];
   if (yyn <= 0)
     {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
+      if (yyn == 0 || yyis_table_ninf (yyn))
        goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
@@ -1581,7 +1589,7 @@ yyerrlab1:
   for (;;)
     {
       yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
+      if (!yyis_pact_ninf (yyn))
        {
          yyn += YYTERROR;
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -1676,9 +1684,9 @@ yypushreturn:
 ]b4_epilogue
 b4_defines_if(
 [@output(b4_spec_defines_file@)@
-b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
-  [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-   2009])
+b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],
+             [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005,
+              2006, 2007, 2008, 2009])
 
 b4_percent_code_get([[requires]])[]dnl