# define YYSTACK_USE_ALLOCA 0
#endif
+/* Realloc WHAT from SIZE to YYSTACKSIZE elements of TYPE.
+ If WHAT was malloc'ed (not the original automatic ARRAY), free it. */
#if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
+# define YYSTACK_REALLOC(Type, What, Array) \
+do { \
+ Type *old = What; \
+ What = (Type *) malloc (yystacksize * sizeof (Type)); \
+ __yy_memcpy ((char *) What, (char *) old, \
+ (size) * (unsigned int) sizeof (Type)); \
+ yyfree_stacks = 1; \
+ if (old != Array) \
+ free (old); \
+} while (0)
#else
-# define YYSTACK_ALLOC malloc
+# define YYSTACK_REALLOC(Type, What, Array) \
+do { \
+ Type *old = What; \
+ What = (Type *) alloca (yystacksize * sizeof (Type)); \
+ __yy_memcpy ((char *) What, (char *) old, \
+ (size) * (unsigned int) sizeof (Type)); \
+} while (0)
#endif
#define YYBISON 1 /* Identify Bison output. */
#ifndef YYERROR_VERBOSE
# define YYERROR_VERBOSE %%verbose
+#else
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
#endif
/* Tokens. */
/* Three stacks and their tools:
`yyss': related to states,
- `yysv': related to semantic values,
+ `yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
if (yyssp >= yyss + yystacksize - 1)
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into memory.
- */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#if YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. */
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ short *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. */
# if YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
+ YYLTYPE *yyls1 = yyls;
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow ("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yyls1, size * sizeof (*yylsp),
+ &yystacksize);
+ yyls = yyls1;
# else
- yyoverflow ("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-# endif
-
- yyss = yyss1; yyvs = yyvs1;
-# if YYLSP_NEEDED
- yyls = yyls1;
+ yyoverflow ("parser stack overflow",
+ &yyss1, size * sizeof (*yyssp),
+ &yyvs1, size * sizeof (*yyvsp),
+ &yystacksize);
# endif
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
-# if !YYSTACK_USE_ALLOCA
- yyfree_stacks = 1;
-# endif
- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1,
- size * (unsigned int) sizeof (*yyssp));
- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1,
- size * (unsigned int) sizeof (*yyvsp));
+
+ YYSTACK_REALLOC (short, yyss, yyssa);
+ YYSTACK_REALLOC (YYSTYPE, yyvs, yyvsa);
# if YYLSP_NEEDED
- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1,
- size * (unsigned int) sizeof (*yylsp));
+ YYSTACK_REALLOC (YYLTYPE, yyls, yylsa);
# endif
#endif /* no yyoverflow */
int x, count;
count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
+ /* Start X at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ for (x = yyn < 0 ? -yyn : 0;
x < (int) (sizeof (yytname) / sizeof (char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen (yytname[x]) + 15, count++;
- size += strlen ("parse error, unexpected `") + 1;
+ size += strlen ("parse error, unexpected ") + 1;
size += strlen (yytname[YYTRANSLATE (yychar)]);
msg = (char *) malloc (size);
if (msg != 0)
{
- strcpy (msg, "parse error, unexpected `");
+ strcpy (msg, "parse error, unexpected ");
strcat (msg, yytname[YYTRANSLATE (yychar)]);
- strcat (msg, "'");
if (count < 5)
{
count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
+ for (x = yyn < 0 ? -yyn : 0;
x < (int) (sizeof (yytname) / sizeof (char *)); x++)
if (yycheck[x + yyn] == x)
{
- strcat (msg, count == 0 ? ", expecting `" : " or `");
+ strcat (msg, count == 0 ? ", expecting " : " or ");
strcat (msg, yytname[x]);
- strcat (msg, "'");
count++;
}
}
free (msg);
}
else
- yyerror ("parse error; also virtual memory exceeded");
+ yyerror ("parse error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */