## ------------------------ ##
+# b4_user_formals
+# ---------------
+# This is specific to GLR because it relies on ISO C formal argument
+# declarations.
+m4_define([b4_user_formals],
+[m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])])
+
+
# b4_lex_param
# ------------
# Accumule in b4_lex_param all the yylex arguments.
m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
-# b4_user_formals
-# ---------------
-m4_define([b4_user_formals],
-[m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])])
-
-
# b4_yyerror_args
# ---------------
# Arguments passed to yyerror: user args plus yylloc.
#define yynerrs b4_prefix[]nerrs
#define yylloc b4_prefix[]lloc])
-b4_token_enums_defines(b4_tokens)
+b4_token_enums(b4_tokens)
/* Copy the first part of user declarations. */
b4_pre_prologue[
# endif
#endif
+/* Suppress unused-variable warnings by "using" E. */
+#define YYUSE(e) do {;} while (/*CONSTCOND*/ yyfalse && (e))
+
#ifndef YYFREE
# define YYFREE free
#endif
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
- while (0)
+ while (/*CONSTCOND*/ 0)
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
#define YYCHK(YYE) \
do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
- while (0)
+ while (/*CONSTCOND*/ 0)
#if YYDEBUG
do { \
if (yydebug) \
YYFPRINTF Args; \
-} while (0)
+} while (/*CONSTCOND*/ 0)
]b4_yysymprint_generate([b4_c_ansi_function_def])[
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Type, Value]b4_location_if([, Location])[); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yysymprint (stderr, \
+ Type, Value]b4_location_if([, Location])[]b4_user_args[); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (/*CONSTCOND*/ 0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
- * containing the pointer to the next state in the chain. Assumes
- * YYLOW1 < YYLOW0. */
+ * containing the pointer to the next state in the chain. */
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
static void
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
}
/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
- YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
- For convenience, always return YYLOW1. */
+ * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
+ * For convenience, always return YYLOW1. */
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
__attribute__ ((__unused__));
static inline int
static void
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
{
- /* `Use' the arguments. */
- (void) yy0;
- (void) yy1;
+ YYUSE (yy0);
+ YYUSE (yy1);
switch (yyn)
{
}
static void
-yydestroyGLRState (char const *yymsg, yyGLRState *yys)
+yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
{
if (yys->yyresolved)
yydestruct (yymsg, yystos[yys->yylrState],
- &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
+ &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[]b4_user_args[);
else
{
#if YYDEBUG
{
YYFPRINTF (stderr, "%s unresolved ", yymsg);
yysymprint (stderr, yystos[yys->yylrState],
- &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[);
+ &yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[]b4_user_args[);
YYFPRINTF (stderr, "\n");
}
#endif
for (yyrh = yyoption->yystate, yyn = yyrhsLength (yyoption->yyrule);
yyn > 0;
yyrh = yyrh->yypred, yyn -= 1)
- yydestroyGLRState (yymsg, yyrh);
+ yydestroyGLRState (yymsg, yyrh]b4_user_args[);
}
}
}
}
else
{
+ /* At present, doAction is never called in nondeterministic
+ * mode, so this branch is never taken. It is here in
+ * anticipation of a future feature that will allow immediate
+ * evaluation of selected actions in nondeterministic mode. */
int yyi;
yyGLRState* yys;
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
- = yystack->yytops.yystates[yyk];
+ = yystack->yytops.yystates[yyk];]b4_location_if([[
+ if (yynrhs == 0)
+ /* Set default location. */
+ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[
for (yyi = 0; yyi < yynrhs; yyi += 1)
{
yys = yys->yypred;
do { \
if (yydebug) \
yy_reduce_print (K, Rule); \
-} while (0)
+} while (/*CONSTCOND*/ 0)
/*----------------------------------------------------------.
| Report that the RULE is going to be reduced on stack #K. |
yynrhs = yyrhsLength (yyopt->yyrule);
YYCHK (yyresolveStates (yyopt->yystate, yynrhs, yystack]b4_user_args[));
- yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;
+ yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;]b4_location_if([[
+ if (yynrhs == 0)
+ /* Set default location. */
+ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
return yyuserAction (yyopt->yyrule, yynrhs,
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1,
yyvalp, yylocp, yystack]b4_user_args[);
yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
yyGLRStack* yystack]b4_pure_formals[)
{
- /* `Unused' warnings. */
- (void) yyx0;
- (void) yyx1;
+ YYUSE (yyx0);
+ YYUSE (yyx1);
#if YYDEBUG
YYFPRINTF (stderr, "Ambiguity detected.\n");
yyreportSyntaxError (yyGLRStack* yystack,
YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
{
- /* `Unused' warnings. */
- (void) yylvalp;
- (void) yyllocp;
+ YYUSE (yylvalp);
+ YYUSE (yyllocp);
if (yystack->yyerrState == 0)
{
yyerror_range[2].yystate.yyloc = *yyllocp;
YYLLOC_DEFAULT (yys->yyloc, yyerror_range, 2);]])[
yydestruct ("Error: discarding",
- *yytokenp, yylvalp]b4_location_if([, yyllocp])[);
+ *yytokenp, yylvalp]b4_location_if([, yyllocp])[]b4_user_args[);
}
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
}
]b4_location_if([[ yystack->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
- yydestroyGLRState ("Error: popping", yys);
+ yydestroyGLRState ("Error: popping", yys]b4_user_args[);
yystack->yytops.yystates[0] = yys->yypred;
yystack->yynextFree -= 1;
yystack->yyspaceLeft += 1;
default: \
goto yybuglab; \
} \
- } while (0)
+ } while (/*CONSTCOND*/ 0)
/*----------.
yyreturn:
if (yytoken != YYEOF && yytoken != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
- yytoken, yylvalp]b4_location_if([, yyllocp])[);
+ yytoken, yylvalp]b4_location_if([, yyllocp])[]b4_user_args[);
/* If the stack is well-formed, pop the stack until it is empty,
destroying its entries as we go. But free the stack regardless
{
yyGLRState *yys = yystates[0];
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
-)[ yydestroyGLRState ("Cleanup: popping", yys);
+)[ yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[0] = yys->yypred;
yystack.yynextFree -= 1;
yystack.yyspaceLeft += 1;
b4_copyright([Skeleton parser for GLR parsing with Bison],
[2002, 2003, 2004, 2005])
-b4_token_enums_defines(b4_tokens)
+b4_token_enums(b4_tokens)
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
m4_ifdef([b4_stype],