# define YYERROR_VERBOSE ]b4_error_verbose[
#endif
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE ]b4_token_table[
+#endif
+
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
};
#endif
-#if (YYDEBUG) || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
# endif
# endif
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static size_t
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ size_t yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return strlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
#endif /* !YYERROR_VERBOSE */
/** State numbers, as in LALR(1) machine */
yystack->yyerrState = 0;
yynerrs = 0;
yystack->yyspaceLeft = yysize;
- yystack->yynextFree = yystack->yyitems =
+ yystack->yyitems =
(yyGLRStackItem*) YYMALLOC (yysize * sizeof yystack->yynextFree[0]);
+ if (!yystack->yyitems)
+ return yyfalse;
+ yystack->yynextFree = yystack->yyitems;
yystack->yysplitPoint = NULL;
yystack->yylastDeleted = NULL;
- return yyinitStateSet (&yystack->yytops) && yystack->yyitems;
+ return yyinitStateSet (&yystack->yytops);
}
#define YYRELOC(YYFROMITEMS,YYTOITEMS,YYX,YYTYPE) \
yyn = yypact[yystack->yytops.yystates[0]->yylrState];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
- size_t yysize0 = strlen (yytokenName (*yytokenp));
+ size_t yysize0 = yytnamerr (NULL, yytokenName (*yytokenp));
size_t yysize = yysize0;
size_t yysize1;
yybool yysize_overflow = yyfalse;
break;
}
yyarg[yycount++] = yytokenName (yyx);
- yysize1 = yysize + strlen (yytokenName (yyx));
+ yysize1 = yysize + yytnamerr (NULL, yytokenName (yyx));
yysize_overflow |= yysize1 < yysize;
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
- yyp = yystpcpy (yyp, yyarg[yyi++]);
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
yydestruct ("Error: discarding lookahead",
yytoken, yylvalp]b4_location_if([, yyllocp])[);
- /* Now pop stack until empty, destroying its entries as we go. */
- {
- yyGLRState** yystates = yystack.yytops.yystates;
- if (yystates)
- while (yystates[0])
- {
- yyGLRState *yys = yystates[0];
+ /* If the stack is well-formed, pop the stack until it is empty,
+ destroying its entries as we go. But free the stack regardless
+ of whether it is well-formed. */
+ if (yystack.yyitems)
+ {
+ yyGLRState** yystates = yystack.yytops.yystates;
+ if (yystates)
+ while (yystates[0])
+ {
+ yyGLRState *yys = yystates[0];
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
-)[ yydestruct ("Error: popping",
- yystos[yys->yylrState],
- &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
- yystates[0] = yys->yypred;
- yystack.yynextFree -= 1;
- yystack.yyspaceLeft += 1;
- }
- }
+)[ yydestruct ("Error: popping",
+ yystos[yys->yylrState],
+ &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
+ yystates[0] = yys->yypred;
+ yystack.yynextFree -= 1;
+ yystack.yyspaceLeft += 1;
+ }
+ yyfreeGLRStack (&yystack);
+ }
- yyfreeGLRStack (&yystack);
return yyresult;
}