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 |
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 |
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); |
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; |
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 |
|
|
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]; |
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; |
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"); |