From: Akim Demaille Date: Mon, 3 Mar 2003 09:00:12 +0000 (+0000) Subject: Regen. X-Git-Tag: BISON-2_0~364 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/650aa2cfbfa9f0f94fcc644bb1c306a5f15f5d4c?hp=d2ffe11637313569116e8a9f891785b842ddb1e9 Regen. --- diff --git a/src/parse-gram.c b/src/parse-gram.c index 9273f9f2..c69b294c 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -1659,32 +1659,30 @@ yyerrlab: { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); + const char* yyprefix; char *yymsg; int yyx; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ - int yyxbase = yyn < 0 ? -yyn : 0; + int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; - int yynsyms = sizeof (yytname) / sizeof (yytname[0]); - int yyxlim = yychecklim < yynsyms ? yychecklim : yynsyms; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 0; - for (yyx = yyxbase; yyx < yyxlim; yyx++) + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yysize += (! yycount - ? sizeof (", expecting ") - 1 - : sizeof (" or ") - 1); - yysize += yystrlen (yytname[yyx]); - yycount++; + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; if (yycount == 5) { yysize = 0; break; - } + } } yysize += (sizeof ("syntax error, unexpected ") + yystrlen (yytname[yytype])); @@ -1696,14 +1694,13 @@ yyerrlab: if (yycount < 5) { - yycount = 0; - for (yyx = yyxbase; yyx < yyxlim; yyx++) + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; + yyprefix = " or "; } } yyerror (yymsg); diff --git a/src/parse-gram.h b/src/parse-gram.h index 69dc51bc..31946928 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -133,7 +133,7 @@ typedef union YYSTYPE { assoc assoc; uniqstr uniqstr; } YYSTYPE; -/* Line 1255 of yacc.c. */ +/* Line 1252 of yacc.c. */ #line 138 "y.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1