/[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.51 by eggert, Wed Jan 22 06:38:32 2003 UTC revision 1.52 by eggert, Thu Feb 13 07:13:57 2003 UTC
# Line 1039  yyerrlab: Line 1039  yyerrlab:
1039            YYSIZE_T yysize = 0;            YYSIZE_T yysize = 0;
1040            int yytype = YYTRANSLATE (yychar);            int yytype = YYTRANSLATE (yychar);
1041            char *yymsg;            char *yymsg;
1042            int yyx, yycount;            int yyx;
1043    
           yycount = 0;  
1044            /* Start YYX at -YYN if negative to avoid negative indexes in            /* Start YYX at -YYN if negative to avoid negative indexes in
1045               YYCHECK.  */               YYCHECK.  */
1046            for (yyx = yyn < 0 ? -yyn : 0;            int yyxbase = yyn < 0 ? -yyn : 0;
1047                 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)  
1048              /* Stay within bounds of both yycheck and yytname.  */
1049              int yychecklim = YYLAST - yyn;
1050              int yynsyms = sizeof (yytname) / sizeof (yytname[0]);
1051              int yyxlim = yychecklim < yynsyms ? yychecklim : yynsyms;
1052              int yycount = 0;
1053    
1054              for (yyx = yyxbase; yyx < yyxlim; yyx++)
1055              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1056                yysize += yystrlen (yytname[yyx]) + 15, yycount++;                {
1057            yysize += yystrlen ("syntax error, unexpected ") + 1;                  yysize += (! yycount
1058            yysize += yystrlen (yytname[yytype]);                             ? sizeof (", expecting ") - 1
1059                               : sizeof (" or ") - 1);
1060                    yysize += yystrlen (yytname[yyx]);
1061                    yycount++;
1062                    if (yycount == 5)
1063                      {
1064                        yysize = 0;
1065                        break;
1066                      }            
1067                  }
1068              yysize += (sizeof ("syntax error, unexpected ")
1069                         + yystrlen (yytname[yytype]));
1070            yymsg = (char *) YYSTACK_ALLOC (yysize);            yymsg = (char *) YYSTACK_ALLOC (yysize);
1071            if (yymsg != 0)            if (yymsg != 0)
1072              {              {
# Line 1059  yyerrlab: Line 1076  yyerrlab:
1076                if (yycount < 5)                if (yycount < 5)
1077                  {                  {
1078                    yycount = 0;                    yycount = 0;
1079                    for (yyx = yyn < 0 ? -yyn : 0;                    for (yyx = yyxbase; yyx < yyxlim; yyx++)
                        yyx < (int) (sizeof (yytname) / sizeof (char *));  
                        yyx++)  
1080                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1081                        {                        {
1082                          const char *yyq = ! yycount ? ", expecting " : " or ";                          const char *yyq = ! yycount ? ", expecting " : " or ";

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

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