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

Diff of /bison/data/glr.c

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

revision 1.52 by eggert, Tue Feb 25 07:56:34 2003 UTC revision 1.53 by akim, Sun Mar 2 13:39:44 2003 UTC
# Line 613  yytokenName (yySymbol yytoken) Line 613  yytokenName (yySymbol yytoken)
613    
614  /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting  /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
615   *  at YYVSP[YYLOW0].yystate.yypred.  Leaves YYVSP[YYLOW1].yystate.yypred   *  at YYVSP[YYLOW0].yystate.yypred.  Leaves YYVSP[YYLOW1].yystate.yypred
616   *  containing the pointer to the next state in the chain. Assumes   *  containing the pointer to the next state in the chain. Assumes
617   *  YYLOW1 < YYLOW0.  For convenience, returns YYLOW1. */   *  YYLOW1 < YYLOW0.  For convenience, returns YYLOW1. */
618  static int  static int
619  yyfill (yyGLRStackItem* yyvsp, int yylow0, int yylow1)  yyfill (yyGLRStackItem* yyvsp, int yylow0, int yylow1)
620  {  {
621    yyGLRState* s;    yyGLRState* s;
622    int i;    int i;
623    s = yyvsp[yylow0].yystate.yypred;    s = yyvsp[yylow0].yystate.yypred;
624    for (i = yylow0-1; i >= yylow1; i -= 1)    for (i = yylow0-1; i >= yylow1; i -= 1)
625      {      {
626        if (! s->yyresolved)        if (! s->yyresolved)
# Line 1022  yyglrShift (yyGLRStack* yystack, int yyk Line 1022  yyglrShift (yyGLRStack* yystack, int yyk
1022  }  }
1023    
1024  /** Shift stack #K of YYSTACK, to a new state corresponding to LR  /** Shift stack #K of YYSTACK, to a new state corresponding to LR
1025   *  state YYLRSTATE, at input position YYPOSN, with the (unresolved)   *  state YYLRSTATE, at input position YYPOSN, with the (unresolved)
1026   *  semantic value of YYRHS under the action for YYRULE. */   *  semantic value of YYRHS under the action for YYRULE. */
1027  static inline void  static inline void
1028  yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState,  yyglrShiftDefer (yyGLRStack* yystack, int yyk, yyStateNum yylrState,
# Line 1597  yyreportSyntaxError (yyGLRStack* yystack Line 1597  yyreportSyntaxError (yyGLRStack* yystack
1597  #if YYERROR_VERBOSE  #if YYERROR_VERBOSE
1598        yySymbol* const yytokenp = yystack->yytokenp;        yySymbol* const yytokenp = yystack->yytokenp;
1599        int yyn;        int yyn;
       const char* yyprefix;  
1600        yyn = yypact[yystack->yytops.yystates[0]->yylrState];        yyn = yypact[yystack->yytops.yystates[0]->yylrState];
1601        if (YYPACT_NINF < yyn && yyn < YYLAST)        if (YYPACT_NINF < yyn && yyn < YYLAST)
1602          {          {
1603            size_t yysize = 0;            size_t yysize = 0;
1604              const char* yyprefix;
1605            char* yymsg;            char* yymsg;
1606            int yyx;            int yyx;
1607    
1608            /* Start YYX at -YYN if negative to avoid negative indexes in            /* Start YYX at -YYN if negative to avoid negative indexes in
1609               YYCHECK.  */               YYCHECK.  */
1610            int yyxbase = yyn < 0 ? -yyn : 0;            int yyxbegin = yyn < 0 ? -yyn : 0;
1611    
1612            /* Stay within bounds of both yycheck and yytname.  */            /* Stay within bounds of both yycheck and yytname.  */
1613            int yychecklim = YYLAST - yyn;            int yychecklim = YYLAST - yyn;
1614            int yynsyms = sizeof (yytname) / sizeof (yytname[0]);            int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
           int yyxlim = yychecklim < yynsyms ? yychecklim : yynsyms;  
1615            int yycount = 0;            int yycount = 0;
1616    
1617            yyprefix = ", expecting ";            yyprefix = ", expecting ";
1618            for (yyx = yyxbase; yyx < yyxlim && yycount < 5; yyx += 1)            for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1619              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)              if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1620                {                {
1621                  yysize += strlen (yytokenName (yyx)) + strlen (yyprefix);                  yysize += strlen (yyprefix) + strlen (yytokenName (yyx));
1622                  yycount += 1;                  yycount += 1;
1623                  if (yycount == 5)                  if (yycount == 5)
1624                    {                    {
# Line 1640  yyreportSyntaxError (yyGLRStack* yystack Line 1639  yyreportSyntaxError (yyGLRStack* yystack
1639                if (yycount < 5)                if (yycount < 5)
1640                  {                  {
1641                    yyprefix = ", expecting ";                    yyprefix = ", expecting ";
1642                    for (yyx = yyxbase; yyx < yyxlim; yyx += 1)                    for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1643                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)                      if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1644                        {                        {
1645                          sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));                          sprintf (yyp, "%s%s", yyprefix, yytokenName (yyx));

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

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