/[bison]/bison/data/yacc.c
ViewVC logotype

Diff of /bison/data/yacc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.53 by eggert, Tue Feb 25 07:57:48 2003 UTC revision 1.54 by akim, Sun Mar 2 13:39:44 2003 UTC
# Line 1038  yyerrlab: Line 1038  yyerrlab:
1038          {          {
1039            YYSIZE_T yysize = 0;            YYSIZE_T yysize = 0;
1040            int yytype = YYTRANSLATE (yychar);            int yytype = YYTRANSLATE (yychar);
1041              const char* yyprefix;
1042            char *yymsg;            char *yymsg;
1043            int yyx;            int yyx;
1044    
1045            /* Start YYX at -YYN if negative to avoid negative indexes in            /* Start YYX at -YYN if negative to avoid negative indexes in
1046               YYCHECK.  */               YYCHECK.  */
1047            int yyxbase = yyn < 0 ? -yyn : 0;            int yyxbegin = yyn < 0 ? -yyn : 0;
1048    
1049            /* Stay within bounds of both yycheck and yytname.  */            /* Stay within bounds of both yycheck and yytname.  */
1050            int yychecklim = YYLAST - yyn;            int yychecklim = YYLAST - yyn;
1051            int yynsyms = sizeof (yytname) / sizeof (yytname[0]);            int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
           int yyxlim = yychecklim < yynsyms ? yychecklim : yynsyms;  
1052            int yycount = 0;            int yycount = 0;
1053    
1054            for (yyx = yyxbase; yyx < yyxlim; yyx++)            yyprefix = ", expecting ";
1055              for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1056              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1057                {                {
1058                  yysize += (! yycount                  yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1059                             ? sizeof (", expecting ") - 1                  yycount += 1;
                            : sizeof (" or ") - 1);  
                 yysize += yystrlen (yytname[yyx]);  
                 yycount++;  
1060                  if (yycount == 5)                  if (yycount == 5)
1061                    {                    {
1062                      yysize = 0;                      yysize = 0;
1063                      break;                      break;
1064                    }                                }
1065                }                }
1066            yysize += (sizeof ("syntax error, unexpected ")            yysize += (sizeof ("syntax error, unexpected ")
1067                       + yystrlen (yytname[yytype]));                       + yystrlen (yytname[yytype]));
# Line 1075  yyerrlab: Line 1073  yyerrlab:
1073    
1074                if (yycount < 5)                if (yycount < 5)
1075                  {                  {
1076                    yycount = 0;                    yyprefix = ", expecting ";
1077                    for (yyx = yyxbase; yyx < yyxlim; yyx++)                    for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1078                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1079                        {                        {
1080                          const char *yyq = ! yycount ? ", expecting " : " or ";                          yyp = yystpcpy (yyp, yyprefix);
                         yyp = yystpcpy (yyp, yyq);  
1081                          yyp = yystpcpy (yyp, yytname[yyx]);                          yyp = yystpcpy (yyp, yytname[yyx]);
1082                          yycount++;                          yyprefix = " or ";
1083                        }                        }
1084                  }                  }
1085                yyerror (]b4_yyerror_args[yymsg);                yyerror (]b4_yyerror_args[yymsg);

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26