/[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.14 by eggert, Sat Sep 7 06:32:24 2002 UTC revision 1.15 by eggert, Fri Oct 11 20:53:39 2002 UTC
# Line 648  m4_map([b4_symbol_actions], m4_defn([b4_ Line 648  m4_map([b4_symbol_actions], m4_defn([b4_
648  #endif /* YYDEBUG. */  #endif /* YYDEBUG. */
649    
650    
 /*----------------------------------------------------------.  
 | yyreport_parse_error -- report a parse error in YYSTATE.  |  
 `----------------------------------------------------------*/  
   
 b4_c_function([yyreport_parse_error],  
               [static void],  
               [[int],     [yystate]],  
               [[int],     [yychar]],  
               [[YYSTYPE], [yyvalue]]b4_location_if([,  
               [[YYLTYPE], [yylloc]]]))  
 [{  
 #if YYERROR_VERBOSE  
   int yyn = yypact[yystate];  
   
   if (YYPACT_NINF < yyn && yyn < YYLAST)  
     {  
       YYSIZE_T yysize = 0;  
       int yytype = YYTRANSLATE (yychar);  
       char *yymsg;  
       int yyx, yycount;  
   
       yycount = 0;  
       /* Start YYX at -YYN if negative to avoid negative indexes in  
          YYCHECK.  */  
       for (yyx = yyn < 0 ? -yyn : 0;  
            yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)  
         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)  
           yysize += yystrlen (yytname[yyx]) + 15, yycount++;  
       yysize += yystrlen ("parse error, unexpected ") + 1;  
       yysize += yystrlen (yytname[yytype]);  
       yymsg = (char *) YYSTACK_ALLOC (yysize);  
       if (yymsg != 0)  
         {  
           char *yyp = yystpcpy (yymsg, "parse error, unexpected ");  
           yyp = yystpcpy (yyp, yytname[yytype]);  
   
           if (yycount < 5)  
             {  
               yycount = 0;  
               for (yyx = yyn < 0 ? -yyn : 0;  
                    yyx < (int) (sizeof (yytname) / sizeof (char *));  
                    yyx++)  
                 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)  
                   {  
                     const char *yyq = ! yycount ? ", expecting " : " or ";  
                     yyp = yystpcpy (yyp, yyq);  
                     yyp = yystpcpy (yyp, yytname[yyx]);  
                     yycount++;  
                   }  
             }  
           yyerror (yymsg);  
           YYSTACK_FREE (yymsg);  
         }  
       else  
         yyerror ("parse error; also virtual memory exhausted");  
     }  
   else  
 #endif /* YYERROR_VERBOSE */  
     yyerror ("parse error");  
   
   /* Pacify ``unused variable'' warnings.  */  
   (void) yystate;  
   (void) yychar;  
   (void) yyvalue;  
   ]b4_location_if([(void) yylloc;])[  
 }]  
   
   
651  /*-----------------------------------------------.  /*-----------------------------------------------.
652  | Release the memory associated to this symbol.  |  | Release the memory associated to this symbol.  |
653  `-----------------------------------------------*/  `-----------------------------------------------*/
# Line 1127  yyerrlab: Line 1059  yyerrlab:
1059    if (!yyerrstatus)    if (!yyerrstatus)
1060      {      {
1061        ++yynerrs;        ++yynerrs;
1062        yyreport_parse_error (yystate, yychar, yylval]b4_location_if([, yylloc])[);  #if YYERROR_VERBOSE
1063          yyn = yypact[yystate];
1064    
1065          if (YYPACT_NINF < yyn && yyn < YYLAST)
1066            {
1067              YYSIZE_T yysize = 0;
1068              int yytype = YYTRANSLATE (yychar);
1069              char *yymsg;
1070              int yyx, yycount;
1071    
1072              yycount = 0;
1073              /* Start YYX at -YYN if negative to avoid negative indexes in
1074                 YYCHECK.  */
1075              for (yyx = yyn < 0 ? -yyn : 0;
1076                   yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1077                if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1078                  yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1079              yysize += yystrlen ("parse error, unexpected ") + 1;
1080              yysize += yystrlen (yytname[yytype]);
1081              yymsg = (char *) YYSTACK_ALLOC (yysize);
1082              if (yymsg != 0)
1083                {
1084                  char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1085                  yyp = yystpcpy (yyp, yytname[yytype]);
1086    
1087                  if (yycount < 5)
1088                    {
1089                      yycount = 0;
1090                      for (yyx = yyn < 0 ? -yyn : 0;
1091                           yyx < (int) (sizeof (yytname) / sizeof (char *));
1092                           yyx++)
1093                        if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1094                          {
1095                            const char *yyq = ! yycount ? ", expecting " : " or ";
1096                            yyp = yystpcpy (yyp, yyq);
1097                            yyp = yystpcpy (yyp, yytname[yyx]);
1098                            yycount++;
1099                          }
1100                    }
1101                  yyerror (yymsg);
1102                  YYSTACK_FREE (yymsg);
1103                }
1104              else
1105                yyerror ("parse error; also virtual memory exhausted");
1106            }
1107          else
1108    #endif /* YYERROR_VERBOSE */
1109            yyerror ("parse error");
1110      }      }
1111    goto yyerrlab1;    goto yyerrlab1;
1112    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

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