/[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.60 by eggert, Fri Jun 20 22:52:12 2003 UTC revision 1.61 by eggert, Fri Jul 25 07:10:14 2003 UTC
# Line 219  static YYLTYPE yyloc_default; Line 219  static YYLTYPE yyloc_default;
219  ]/* Line __line__ of glr.c.  */  ]/* Line __line__ of glr.c.  */
220  b4_syncline([@oline@], [@ofile@])  b4_syncline([@oline@], [@ofile@])
221  [  [
222    #ifndef YYFREE
223    # define YYFREE free
224    #endif
225    #ifndef YYMALLOC
226    # define YYMALLOC malloc
227    #endif
228    #ifndef YYREALLOC
229    # define YYREALLOC realloc
230    #endif
231    
232  #ifdef __cplusplus  #ifdef __cplusplus
233     typedef bool yybool;     typedef bool yybool;
234  #else  #else
# Line 865  yyinitStateSet (yyGLRStateSet* yyset) Line 875  yyinitStateSet (yyGLRStateSet* yyset)
875  {  {
876    yyset->yysize = 1;    yyset->yysize = 1;
877    yyset->yycapacity = 16;    yyset->yycapacity = 16;
878    yyset->yystates = (yyGLRState**) malloc (16 * sizeof (yyset->yystates[0]));    yyset->yystates = YYMALLOC (16 * sizeof yyset->yystates[0]);
879    yyset->yystates[0] = NULL;    yyset->yystates[0] = NULL;
880  }  }
881    
882  static void yyfreeStateSet (yyGLRStateSet* yyset)  static void yyfreeStateSet (yyGLRStateSet* yyset)
883  {  {
884    free (yyset->yystates);    YYFREE (yyset->yystates);
885  }  }
886    
887  /** Initialize STACK to a single empty stack, with total maximum  /** Initialize STACK to a single empty stack, with total maximum
# Line 884  yyinitGLRStack (yyGLRStack* yystack, siz Line 894  yyinitGLRStack (yyGLRStack* yystack, siz
894    yynerrs = 0;    yynerrs = 0;
895    yystack->yyspaceLeft = yysize;    yystack->yyspaceLeft = yysize;
896    yystack->yynextFree = yystack->yyitems =    yystack->yynextFree = yystack->yyitems =
897      (yyGLRStackItem*) malloc (yysize * sizeof (yystack->yynextFree[0]));      YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
898    yystack->yysplitPoint = NULL;    yystack->yysplitPoint = NULL;
899    yystack->yylastDeleted = NULL;    yystack->yylastDeleted = NULL;
900    yyinitStateSet (&yystack->yytops);    yyinitStateSet (&yystack->yytops);
# Line 948  yyexpandGLRStack (yyGLRStack* yystack]b4 Line 958  yyexpandGLRStack (yyGLRStack* yystack]b4
958        yystack->yytops.yystates[yyn] =        yystack->yytops.yystates[yyn] =
959          YYRELOC (yystack->yyitems, yynewStack.yyitems,          YYRELOC (yystack->yyitems, yynewStack.yyitems,
960                   yystack->yytops.yystates[yyn], yystate);                   yystack->yytops.yystates[yyn], yystate);
961    free (yystack->yyitems);    YYFREE (yystack->yyitems);
962    yystack->yyitems = yynewStack.yyitems;    yystack->yyitems = yynewStack.yyitems;
963    yystack->yynextFree = yynewStack.yynextFree + yysize;    yystack->yynextFree = yynewStack.yynextFree + yysize;
964    yystack->yyspaceLeft = yynewStack.yyspaceLeft - yysize;    yystack->yyspaceLeft = yynewStack.yyspaceLeft - yysize;
# Line 962  yyexpandGLRStack (yyGLRStack* yystack]b4 Line 972  yyexpandGLRStack (yyGLRStack* yystack]b4
972  static void  static void
973  yyfreeGLRStack (yyGLRStack* yystack)  yyfreeGLRStack (yyGLRStack* yystack)
974  {  {
975    free (yystack->yyitems);    YYFREE (yystack->yyitems);
976    yyfreeStateSet (&yystack->yytops);    yyfreeStateSet (&yystack->yytops);
977  }  }
978    
# Line 1231  yysplitStack (yyGLRStack* yystack, int y Line 1241  yysplitStack (yyGLRStack* yystack, int y
1241      {      {
1242        yystack->yytops.yycapacity *= 2;        yystack->yytops.yycapacity *= 2;
1243        yystack->yytops.yystates =        yystack->yytops.yystates =
1244          (yyGLRState**) realloc (yystack->yytops.yystates,          YYREALLOC (yystack->yytops.yystates,
1245                                  yystack->yytops.yycapacity                     (yystack->yytops.yycapacity
1246                                  * sizeof (yyGLRState*));                      * sizeof yystack->yytops.yystates[0]));
1247      }      }
1248    yystack->yytops.yystates[yystack->yytops.yysize]    yystack->yytops.yystates[yystack->yytops.yysize]
1249      = yystack->yytops.yystates[yyk];      = yystack->yytops.yystates[yyk];
# Line 1644  yyreportSyntaxError (yyGLRStack* yystack Line 1654  yyreportSyntaxError (yyGLRStack* yystack
1654                }                }
1655            yysize += (sizeof ("syntax error, unexpected ")            yysize += (sizeof ("syntax error, unexpected ")
1656                       + strlen (yytokenName (*yytokenp)));                       + strlen (yytokenName (*yytokenp)));
1657            yymsg = (char*) malloc (yysize);            yymsg = YYMALLOC (yysize);
1658            if (yymsg != 0)            if (yymsg != 0)
1659              {              {
1660                char* yyp = yymsg;                char* yyp = yymsg;
# Line 1663  yyreportSyntaxError (yyGLRStack* yystack Line 1673  yyreportSyntaxError (yyGLRStack* yystack
1673                        }                        }
1674                  }                  }
1675                yyerror (]b4_lyyerror_args[yymsg);                yyerror (]b4_lyyerror_args[yymsg);
1676                free (yymsg);                YYFREE (yymsg);
1677              }              }
1678            else            else
1679              yyerror (]b4_lyyerror_args["syntax error; also virtual memory exhausted");              yyerror (]b4_lyyerror_args["syntax error; also virtual memory exhausted");

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

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