/[bison]/bison/src/bison.simple
ViewVC logotype

Diff of /bison/src/bison.simple

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

revision 1.73 by akim, Wed Nov 14 14:57:44 2001 UTC revision 1.74 by akim, Mon Nov 19 10:27:52 2001 UTC
# Line 833  yyerrlab: Line 833  yyerrlab:
833            int x, count;            int x, count;
834    
835            count = 0;            count = 0;
836            /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */            /* Start X at -YYN if negative to avoid negative indexes in
837            for (x = (yyn < 0 ? -yyn : 0);               YYCHECK.  */
838              for (x = yyn < 0 ? -yyn : 0;
839                 x < (int) (sizeof (yytname) / sizeof (char *)); x++)                 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
840              if (yycheck[x + yyn] == x)              if (yycheck[x + yyn] == x)
841                size += strlen (yytname[x]) + 15, count++;                size += strlen (yytname[x]) + 15, count++;
842            size += strlen ("parse error, unexpected `") + 1;            size += strlen ("parse error, unexpected ") + 1;
843            size += strlen (yytname[YYTRANSLATE (yychar)]);            size += strlen (yytname[YYTRANSLATE (yychar)]);
844            msg = (char *) malloc (size);            msg = (char *) malloc (size);
845            if (msg != 0)            if (msg != 0)
846              {              {
847                strcpy (msg, "parse error, unexpected `");                strcpy (msg, "parse error, unexpected ");
848                strcat (msg, yytname[YYTRANSLATE (yychar)]);                strcat (msg, yytname[YYTRANSLATE (yychar)]);
               strcat (msg, "'");  
849    
850                if (count < 5)                if (count < 5)
851                  {                  {
852                    count = 0;                    count = 0;
853                    for (x = (yyn < 0 ? -yyn : 0);                    for (x = yyn < 0 ? -yyn : 0;
854                           x < (int) (sizeof (yytname) / sizeof (char *)); x++)                           x < (int) (sizeof (yytname) / sizeof (char *)); x++)
855                      if (yycheck[x + yyn] == x)                      if (yycheck[x + yyn] == x)
856                        {                        {
857                          strcat (msg, count == 0 ? ", expecting `" : " or `");                          strcat (msg, count == 0 ? ", expecting " : " or ");
858                          strcat (msg, yytname[x]);                          strcat (msg, yytname[x]);
                         strcat (msg, "'");  
859                          count++;                          count++;
860                        }                        }
861                  }                  }
# Line 864  yyerrlab: Line 863  yyerrlab:
863                free (msg);                free (msg);
864              }              }
865            else            else
866              yyerror ("parse error; also virtual memory exceeded");              yyerror ("parse error; also virtual memory exhausted");
867          }          }
868        else        else
869  #endif /* YYERROR_VERBOSE */  #endif /* YYERROR_VERBOSE */

Legend:
Removed from v.1.73  
changed lines
  Added in v.1.74

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