/[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.32 by akim, Tue Nov 12 08:45:40 2002 UTC revision 1.33 by akim, Tue Nov 12 09:03:12 2002 UTC
# Line 395  static const ]b4_int_type_for([b4_check] Line 395  static const ]b4_int_type_for([b4_check]
395    ]b4_check[    ]b4_check[
396  };  };
397    
398    /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
399       symbol of state STATE-NUM.  */
400    static const ]b4_int_type_for([b4_stos])[ yystos[] =
401    {
402      ]b4_stos[
403    };
404    
405    
406  /* Prevent warning if -Wmissing-prototypes.  */  /* Prevent warning if -Wmissing-prototypes.  */
407  ]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[  ]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
# Line 451  do {                                           \ Line 458  do {                                           \
458    if (yydebug)                                  \    if (yydebug)                                  \
459      YYFPRINTF Args;                             \      YYFPRINTF Args;                             \
460  } while (0)  } while (0)
461    
462    ]b4_yysymprint_generate([b4_c_ansi_function_def])[
463    
464    # define YYDSYMPRINT(Args)                      \
465    do {                                            \
466      if (yydebug)                                  \
467        yysymprint Args;                            \
468    } while (0)
469    
470  /* Nonzero means print parse trace.  It is left uninitialized so that  /* Nonzero means print parse trace.  It is left uninitialized so that
471     multiple parsers can coexist.  */     multiple parsers can coexist.  */
472  int yydebug;  int yydebug;
473    
474  #else /* !YYDEBUG */  #else /* !YYDEBUG */
475    
476    /* Avoid empty `if' bodies.  */    /* Avoid empty `if' bodies.  */
477  # define YYDPRINTF(Args)  {}  # define YYDPRINTF(Args)   {}
478    # define YYDSYMPRINT(Args) {}
479    
480  #endif /* !YYDEBUG */  #endif /* !YYDEBUG */
481    
482  /* YYINITDEPTH -- initial size of the parser's stacks.  */  /* YYINITDEPTH -- initial size of the parser's stacks.  */
# Line 611  yyuserAction (yyRuleNum yyn, int yyrhsle Line 631  yyuserAction (yyRuleNum yyn, int yyrhsle
631        *yyvalp = yyvsp[1-yyrhslen].yystate.yysemantics.yysval;        *yyvalp = yyvsp[1-yyrhslen].yystate.yysemantics.yysval;
632        *yylocp = yyvsp[1-yyrhslen].yystate.yyloc;        *yylocp = yyvsp[1-yyrhslen].yystate.yyloc;
633      }      }
 # undef yyval  
 # define yyval (*yyvalp)  
634  # undef yyerrok  # undef yyerrok
635  # define yyerrok (yystack->yyerrState = 0)  # define yyerrok (yystack->yyerrState = 0)
636  # undef YYACCEPT  # undef YYACCEPT
# Line 639  yyuserAction (yyRuleNum yyn, int yyrhsle Line 657  yyuserAction (yyRuleNum yyn, int yyrhsle
657       }       }
658    
659     return yyok;     return yyok;
 # undef yyval  
660  # undef yyerrok  # undef yyerrok
661  # undef YYABORT  # undef YYABORT
662  # undef YYACCEPT  # undef YYACCEPT
# Line 669  yyuserMerge (int yyn, YYSTYPE* yy0, YYST Line 686  yyuserMerge (int yyn, YYSTYPE* yy0, YYST
686  [  [
687                                /* Bison grammar-table manipulation.  */                                /* Bison grammar-table manipulation.  */
688    
689    ]b4_yydestruct_generate([b4_c_ansi_function_def])[
690    
691  /** Number of symbols composing the right hand side of rule #RULE. */  /** Number of symbols composing the right hand side of rule #RULE. */
692  static inline int  static inline int
693  yyrhsLength (yyRuleNum yyrule)  yyrhsLength (yyRuleNum yyrule)
# Line 1621  yyrecoverParseError (yyGLRStack* yystack Line 1640  yyrecoverParseError (yyGLRStack* yystack
1640      while (yytrue)      while (yytrue)
1641        {        {
1642          if (*yytokenp == YYEOF)          if (*yytokenp == YYEOF)
1643            yyFail (yystack][]b4_lpure_args[, NULL);            {
1644                /* Now pop stack until we find a state that shifts the
1645                   error token.  */
1646                while (yystack->yytops.yystates[0] != NULL)
1647                  {
1648                    yyGLRState *yys = yystack->yytops.yystates[0];
1649                    YYDPRINTF ((stderr, "Error: popping "));
1650                    YYDSYMPRINT ((stderr,
1651                                  yystos[yys->yylrState],
1652                                  &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[));
1653                    YYDPRINTF ((stderr, "\n"));
1654                    yydestruct (yystos[yys->yylrState],
1655                                &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
1656                    yystack->yytops.yystates[0] = yys->yypred;
1657                    yystack->yynextFree -= 1;
1658                    yystack->yyspaceLeft += 1;
1659                  }
1660                yyFail (yystack][]b4_lpure_args[, NULL);
1661              }
1662          if (*yytokenp != YYEMPTY)          if (*yytokenp != YYEMPTY)
1663            YYDPRINTF ((stderr, "Discarding token %s\n",            {
1664                        yytokenName (*yytokenp)));              YYDPRINTF ((stderr, "Discarding token %s\n",
1665                            yytokenName (*yytokenp)));
1666                yydestruct (*yytokenp, yylvalp]b4_location_if([, yyllocp])[);
1667              }
1668          YYDPRINTF ((stderr, "Reading a token: "));          YYDPRINTF ((stderr, "Reading a token: "));
1669          yychar = YYLEX;          yychar = YYLEX;
1670          *yytokenp = YYTRANSLATE (yychar);          *yytokenp = YYTRANSLATE (yychar);
# Line 1657  yyrecoverParseError (yyGLRStack* yystack Line 1697  yyrecoverParseError (yyGLRStack* yystack
1697    /* Now pop stack until we find a state that shifts the error token. */    /* Now pop stack until we find a state that shifts the error token. */
1698    while (yystack->yytops.yystates[0] != NULL)    while (yystack->yytops.yystates[0] != NULL)
1699      {      {
1700        yyj = yypact[yystack->yytops.yystates[0]->yylrState];        yyGLRState *yys = yystack->yytops.yystates[0];
1701          yyj = yypact[yys->yylrState];
1702        if (! yyis_pact_ninf (yyj))        if (! yyis_pact_ninf (yyj))
1703          {          {
1704            yyj += YYTERROR;            yyj += YYTERROR;
1705            if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR            if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
1706                && yyisShiftAction (yytable[yyj]))                && yyisShiftAction (yytable[yyj]))
1707              {              {
1708                  YYDPRINTF ((stderr, "Shifting error token, "));
1709                yyglrShift (yystack, 0, yytable[yyj],                yyglrShift (yystack, 0, yytable[yyj],
1710                            yystack->yytops.yystates[0]->yyposn,                            yys->yyposn, *yylvalp, yyllocp]b4_user_args[);
                           *yylvalp, yyllocp]b4_user_args[);  
1711                break;                break;
1712              }              }
1713          }          }
1714        yystack->yytops.yystates[0] = yystack->yytops.yystates[0]->yypred;        YYDPRINTF ((stderr, "Error: popping "));
1715          YYDSYMPRINT ((stderr,
1716                        yystos[yys->yylrState],
1717                        &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[));
1718          YYDPRINTF ((stderr, "\n"));
1719          yydestruct (yystos[yys->yylrState],
1720                      &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
1721          yystack->yytops.yystates[0] = yys->yypred;
1722        yystack->yynextFree -= 1;        yystack->yynextFree -= 1;
1723        yystack->yyspaceLeft += 1;        yystack->yyspaceLeft += 1;
1724      }      }

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

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