]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
Fix %error-verbose for conflicts resolved by %nonassoc.
[bison.git] / data / lalr1.cc
index 2a9316de82cf1720be01c3ff7d9b54be9e864ad6..1e4c856ac794a4541347d646e11c2569f914ce38 100644 (file)
@@ -954,7 +954,8 @@ b4_error_verbose_if([state_type yystate, int yytoken],
     if (yypact_ninf_ < yyn && yyn <= yylast_)
       {
        /* 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.  */
@@ -970,7 +971,8 @@ b4_error_verbose_if([state_type yystate, int yytoken],
         char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
         yyarg[yycount++] = yytname_[yytoken];
        for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
-         if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_)
+         if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
+             && yytable_[yyx + yyn] != yytable_ninf_)
           {
             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
             {