]> git.saurik.com Git - bison.git/blobdiff - data/lalr1.cc
* data/glr.c (yyreportSyntaxError): Fix off-by-one error in
[bison.git] / data / lalr1.cc
index 527a8de796b146e9d9adf8fa50307fefc0f8a386..abcdcd5d604163278d29f19f5b5919ad55cfd556 100644 (file)
@@ -838,14 +838,14 @@ b4_error_verbose_if([, int tok])[)
     YYUSE (yystate);
 #if YYERROR_VERBOSE
     int yyn = yypact_[yystate];
-    if (yypact_ninf_ < yyn && yyn < yylast_)
+    if (yypact_ninf_ < yyn && yyn <= yylast_)
       {
        /* Start YYX at -YYN if negative to avoid negative indexes in
           YYCHECK.  */
        int yyxbegin = yyn < 0 ? -yyn : 0;
 
        /* Stay within bounds of both yycheck and yytname.  */
-       int yychecklim = yylast_ - yyn;
+       int yychecklim = yylast_ - yyn + 1;
        int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
        int count = 0;
        for (int x = yyxbegin; x < yyxend; ++x)