Implement --trace=m4.

* src/getargs.c (trace_types, trace_args): Accept trace_m4.
* src/output.c (output_skeleton): When set, pass -dV to m4.
Factor the handling of flags in m4.
* src/output.c (prepare): Rename the muscle names debug, defines,
error_verbose to debug_flag, defines_flag, error_verbose_flag.
* data/c.m4: Adjust.
(_b4_define_flag_if, b4_define_flag_if, b4_defines_if): New.
Use b4_define_flag_if to define other b4_FLAG_if macros.
(b4_location_if): As a consequence, rename as...
(b4_locations_if): this, for consistency.
Adjust all the skeletons.
This commit is contained in:
Akim Demaille
2006-05-14 20:40:35 +00:00
parent ba9ecd1910
commit 327afc7c84
9 changed files with 153 additions and 126 deletions

View File

@@ -1,3 +1,19 @@
2006-05-14 Akim Demaille <akim@lrde.epita.fr>
Implement --trace=m4.
* src/getargs.c (trace_types, trace_args): Accept trace_m4.
* src/output.c (output_skeleton): When set, pass -dV to m4.
Factor the handling of flags in m4.
* src/output.c (prepare): Rename the muscle names debug, defines,
error_verbose to debug_flag, defines_flag, error_verbose_flag.
* data/c.m4: Adjust.
(_b4_define_flag_if, b4_define_flag_if, b4_defines_if): New.
Use b4_define_flag_if to define other b4_FLAG_if macros.
(b4_location_if): As a consequence, rename as...
(b4_locations_if): this, for consistency.
Adjust all the skeletons.
2006-05-14 Akim Demaille <akim@lrde.epita.fr> 2006-05-14 Akim Demaille <akim@lrde.epita.fr>
* etc/bench.pm: Shorten bench names. * etc/bench.pm: Shorten bench names.

View File

@@ -74,7 +74,7 @@ m4_define([b4_identification],
[#]define YYSKELETON_NAME b4_skeleton [#]define YYSKELETON_NAME b4_skeleton
/* Pure parsers. */ /* Pure parsers. */
[#]define YYPURE b4_pure [#]define YYPURE b4_pure_flag
/* Using locations. */ /* Using locations. */
[#]define YYLSP_NEEDED b4_locations_flag [#]define YYLSP_NEEDED b4_locations_flag
@@ -171,32 +171,42 @@ m4_define([b4_int_type_for],
## Decoding options. ## ## Decoding options. ##
## ------------------ ## ## ------------------ ##
# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
# b4_error_verbose_if(IF-TRUE, IF-FALSE) # -----------------------------------
# -------------------------------------- # Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
# Expand IF-TRUE, if errors are verbose, IF-FALSE otherwise. m4_define([b4_flag_if],
m4_define([b4_error_verbose_if], [m4_case(b4_$1_flag,
[m4_if(b4_error_verbose, [1], [0], [$3],
[$1], [1], [$2],
[$2])]) [m4_fatal([invalid $1 value: ]$1)])])
# b4_location_if(IF-TRUE, IF-FALSE) # b4_define_flag_if(FLAG)
# --------------------------------- # -----------------------
# Expand IF-TRUE, if locations are used, IF-FALSE otherwise. # Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
m4_define([b4_location_if], # value of the Boolean FLAG.
[m4_if(b4_locations_flag, [1], m4_define([b4_define_flag_if],
[$1], [_b4_define_flag_if($[1], $[2], [$1])])
[$2])])
# _b4_define_flag_if($1, $2, FLAG)
# --------------------------------
# This macro works around the impossibility to define macros
# inside macros, because issuing `[$1]' is not possible in M4 :(.
# This sucks hard, GNU M4 should really provide M5 like $$1.
m4_define([_b4_define_flag_if],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
m4_define([b4_$3_if],
[b4_flag_if([$3], [$1], [$2])])])
# b4_pure_if(IF-TRUE, IF-FALSE) # b4_FLAG_if(IF-TRUE, IF-FALSE)
# ----------------------------- # -----------------------------
# Expand IF-TRUE, if %pure-parser, IF-FALSE otherwise. # Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
m4_define([b4_pure_if], b4_define_flag_if([defines]) # Whether headers are requested.
[m4_if(b4_pure, [1], b4_define_flag_if([error_verbose]) # Wheter error are verbose.
[$1], b4_define_flag_if([locations]) # Whether locations are tracked.
[$2])]) b4_define_flag_if([pure]) # Whether the interface is pure.
@@ -393,8 +403,7 @@ m4_define([b4_c_arg],
# b4_syncline(LINE, FILE) # b4_syncline(LINE, FILE)
# ----------------------- # -----------------------
m4_define([b4_syncline], m4_define([b4_syncline],
[m4_if(b4_synclines_flag, 1, [b4_flag_if([synclines], [[#]line $1 $2])])
[[#]line $1 $2])])
@@ -436,11 +445,11 @@ m4_define_default([b4_yydestruct_generate],
[[const char *yymsg], [yymsg]], [[const char *yymsg], [yymsg]],
[[int yytype], [yytype]], [[int yytype], [yytype]],
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl [[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
b4_location_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[ m4_ifset([b4_parse_param], [, b4_parse_param]))[
{ {
YYUSE (yyvaluep); YYUSE (yyvaluep);
]b4_location_if([ YYUSE (yylocationp); ]b4_locations_if([ YYUSE (yylocationp);
])dnl ])dnl
b4_parse_param_use[]dnl b4_parse_param_use[]dnl
[ [
@@ -475,12 +484,12 @@ m4_define_default([b4_yy_symbol_print_generate],
[[FILE *yyoutput], [yyoutput]], [[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]], [[int yytype], [yytype]],
[[const YYSTYPE * const yyvaluep], [yyvaluep]][]dnl [[const YYSTYPE * const yyvaluep], [yyvaluep]][]dnl
b4_location_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl b4_locations_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[ m4_ifset([b4_parse_param], [, b4_parse_param]))[
{ {
if (!yyvaluep) if (!yyvaluep)
return; return;
]b4_location_if([ YYUSE (yylocationp); ]b4_locations_if([ YYUSE (yylocationp);
])dnl ])dnl
b4_parse_param_use[]dnl b4_parse_param_use[]dnl
[# ifdef YYPRINT [# ifdef YYPRINT
@@ -507,7 +516,7 @@ b4_parse_param_use[]dnl
[[FILE *yyoutput], [yyoutput]], [[FILE *yyoutput], [yyoutput]],
[[int yytype], [yytype]], [[int yytype], [yytype]],
[[const YYSTYPE * const yyvaluep], [yyvaluep]][]dnl [[const YYSTYPE * const yyvaluep], [yyvaluep]][]dnl
b4_location_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl b4_locations_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl
m4_ifset([b4_parse_param], [, b4_parse_param]))[ m4_ifset([b4_parse_param], [, b4_parse_param]))[
{ {
if (yytype < YYNTOKENS) if (yytype < YYNTOKENS)
@@ -515,11 +524,11 @@ m4_ifset([b4_parse_param], [, b4_parse_param]))[
else else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
]b4_location_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp); ]b4_locations_if([ YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": "); YYFPRINTF (yyoutput, ": ");
])dnl ])dnl
[ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl [ yy_symbol_value_print (yyoutput, yytype, yyvaluep]dnl
b4_location_if([, yylocationp])[]b4_user_args[); b4_locations_if([, yylocationp])[]b4_user_args[);
YYFPRINTF (yyoutput, ")"); YYFPRINTF (yyoutput, ")");
}]dnl }]dnl
]) ])

View File

@@ -52,7 +52,7 @@ m4_define([b4_user_formals],
# Yes, this is quite ugly... # Yes, this is quite ugly...
m4_define([b4_lex_param], m4_define([b4_lex_param],
m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
b4_location_if([, [[YYLTYPE *], [&yylloc]]])])dnl b4_locations_if([, [[YYLTYPE *], [&yylloc]]])])dnl
m4_ifdef([b4_lex_param], [, ]b4_lex_param))) m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
@@ -61,7 +61,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)))
# Optional effective arguments passed to yyerror: user args plus yylloc, and # Optional effective arguments passed to yyerror: user args plus yylloc, and
# a trailing comma. # a trailing comma.
m4_define([b4_yyerror_args], m4_define([b4_yyerror_args],
[b4_pure_if([b4_location_if([yylocp, ])])dnl [b4_pure_if([b4_locations_if([yylocp, ])])dnl
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
@@ -69,7 +69,7 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
# ---------------- # ----------------
# Same as above, but on the look-ahead, hence &yylloc instead of yylocp. # Same as above, but on the look-ahead, hence &yylloc instead of yylocp.
m4_define([b4_lyyerror_args], m4_define([b4_lyyerror_args],
[b4_pure_if([b4_location_if([&yylloc, ])])dnl [b4_pure_if([b4_locations_if([&yylloc, ])])dnl
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
@@ -77,21 +77,21 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
# ------------ # ------------
# Same as b4_yyerror_args, but with a leading comma. # Same as b4_yyerror_args, but with a leading comma.
m4_define([b4_pure_args], m4_define([b4_pure_args],
[b4_pure_if([b4_location_if([, yylocp])])[]b4_user_args]) [b4_pure_if([b4_locations_if([, yylocp])])[]b4_user_args])
# b4_lpure_args # b4_lpure_args
# ------------- # -------------
# Same as above, but on the look-ahead, hence &yylloc instead of yylocp. # Same as above, but on the look-ahead, hence &yylloc instead of yylocp.
m4_define([b4_lpure_args], m4_define([b4_lpure_args],
[b4_pure_if([b4_location_if([, &yylloc])])[]b4_user_args]) [b4_pure_if([b4_locations_if([, &yylloc])])[]b4_user_args])
# b4_pure_formals # b4_pure_formals
# --------------- # ---------------
# Arguments passed to yyerror: user formals plus yylocp. # Arguments passed to yyerror: user formals plus yylocp.
m4_define([b4_pure_formals], m4_define([b4_pure_formals],
[b4_pure_if([b4_location_if([, YYLTYPE *yylocp])])[]b4_user_formals]) [b4_pure_if([b4_locations_if([, YYLTYPE *yylocp])])[]b4_user_formals])
## ----------------- ## ## ----------------- ##
@@ -186,7 +186,7 @@ b4_syncline([@oline@], [@ofile@])
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE typedef struct YYLTYPE
{ {
]b4_location_if([ ]b4_locations_if([
int first_line; int first_line;
int first_column; int first_column;
int last_line; int last_line;
@@ -200,13 +200,12 @@ typedef struct YYLTYPE
#endif #endif
]]) ]])
m4_if(b4_defines_flag, 0, b4_defines_if([#include @output_header_name@],
[b4_shared_declarations], [b4_shared_declarations])[
[#include @output_header_name@])[
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG ]b4_debug[ # define YYDEBUG ]b4_debug_flag[
#endif #endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
@@ -214,7 +213,7 @@ m4_if(b4_defines_flag, 0,
# undef YYERROR_VERBOSE # undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1 # define YYERROR_VERBOSE 1
#else #else
# define YYERROR_VERBOSE ]b4_error_verbose[ # define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif #endif
/* Enabling the token table. */ /* Enabling the token table. */
@@ -308,7 +307,7 @@ b4_syncline([@oline@], [@ofile@])
# endif # endif
#endif #endif
]b4_location_if([#define YYOPTIONAL_LOC(Name) Name],[ ]b4_locations_if([#define YYOPTIONAL_LOC(Name) Name],[
#ifdef __cplusplus #ifdef __cplusplus
# define YYOPTIONAL_LOC(Name) /* empty */ # define YYOPTIONAL_LOC(Name) /* empty */
#else #else
@@ -486,7 +485,7 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
If N is 0, then set CURRENT to the empty location which ends If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */ the previous symbol: RHS[0] (always defined). */
]b4_location_if([[ ]b4_locations_if([[
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc) #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
@@ -581,7 +580,7 @@ do { \
{ \ { \
YYFPRINTF (stderr, "%s ", Title); \ YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, Type, \ yy_symbol_print (stderr, Type, \
Value]b4_location_if([, Location])[]b4_user_args[); \ Value]b4_locations_if([, Location])[]b4_user_args[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (YYID (0))
@@ -622,7 +621,7 @@ int yydebug;
#ifndef YYSTACKEXPANDABLE #ifndef YYSTACKEXPANDABLE
# if (! defined __cplusplus \ # if (! defined __cplusplus \
|| (]b4_location_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)) && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))
# define YYSTACKEXPANDABLE 1 # define YYSTACKEXPANDABLE 1
# else # else
@@ -794,7 +793,7 @@ union yyGLRStackItem {
struct yyGLRStack { struct yyGLRStack {
int yyerrState; int yyerrState;
]b4_location_if([[ /* To compute the location of the error token. */ ]b4_locations_if([[ /* To compute the location of the error token. */
yyGLRStackItem yyerror_range[3];]])[ yyGLRStackItem yyerror_range[3];]])[
]b4_pure_if( ]b4_pure_if(
[ [
@@ -923,7 +922,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
else else
*yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval; *yyvalp = yyvsp[YYFILL (1-yyrhslen)].yystate.yysemantics.yysval;
YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen); YYLLOC_DEFAULT ((*yylocp), (yyvsp - yyrhslen), yyrhslen);
]b4_location_if([[ yystackp->yyerror_range[1].yystate.yyloc = *yylocp; ]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = *yylocp;
]])[ ]])[
switch (yyn) switch (yyn)
{ {
@@ -973,7 +972,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
{ {
if (yys->yyresolved) if (yys->yyresolved)
yydestruct (yymsg, yystos[yys->yylrState], yydestruct (yymsg, yystos[yys->yylrState],
&yys->yysemantics.yysval]b4_location_if([, &yys->yyloc])[]b4_user_args[); &yys->yysemantics.yysval]b4_locations_if([, &yys->yyloc])[]b4_user_args[);
else else
{ {
#if YYDEBUG #if YYDEBUG
@@ -984,7 +983,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
else else
YYFPRINTF (stderr, "%s incomplete ", yymsg); YYFPRINTF (stderr, "%s incomplete ", yymsg);
yy_symbol_print (stderr, yystos[yys->yylrState], yy_symbol_print (stderr, yystos[yys->yylrState],
NULL]b4_location_if([, &yys->yyloc])[]b4_user_args[); NULL]b4_locations_if([, &yys->yyloc])[]b4_user_args[);
YYFPRINTF (stderr, "\n"); YYFPRINTF (stderr, "\n");
} }
#endif #endif
@@ -1392,7 +1391,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
yyGLRState* yys; yyGLRState* yys;
yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1]; yyGLRStackItem yyrhsVals[YYMAXRHS + YYMAXLEFT + 1];
yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred yys = yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred
= yystackp->yytops.yystates[yyk];]b4_location_if([[ = yystackp->yytops.yystates[yyk];]b4_locations_if([[
if (yynrhs == 0) if (yynrhs == 0)
/* Set default location. */ /* Set default location. */
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yys->yyloc;]])[
@@ -1443,7 +1442,7 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
fprintf (stderr, " $%d = ", yyi + 1); fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&]b4_rhs_value(yynrhs, yyi + 1)[ &]b4_rhs_value(yynrhs, yyi + 1)[
]b4_location_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
b4_user_args[); b4_user_args[);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
} }
@@ -1716,7 +1715,7 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
return yyflag; return yyflag;
} }
yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;]b4_location_if([[ yyrhsVals[YYMAXRHS + YYMAXLEFT].yystate.yypred = yyopt->yystate;]b4_locations_if([[
if (yynrhs == 0) if (yynrhs == 0)
/* Set default location. */ /* Set default location. */
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[ yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].yystate.yyloc = yyopt->yystate->yyloc;]])[
@@ -1929,7 +1928,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
{ {
yydestruct ("Cleanup: discarding incompletely merged value for", yydestruct ("Cleanup: discarding incompletely merged value for",
yystos[yys->yylrState], yystos[yys->yylrState],
&yysval]b4_location_if([, yylocp])[]b4_user_args[); &yysval]b4_locations_if([, yylocp])[]b4_user_args[);
break; break;
} }
yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other); yyuserMerge (yymerger[yyp->yyrule], &yysval, &yysval_other);
@@ -2189,7 +2188,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
if (yychar == YYEOF) if (yychar == YYEOF)
yyFail (yystackp][]b4_lpure_args[, NULL); yyFail (yystackp][]b4_lpure_args[, NULL);
if (yychar != YYEMPTY) if (yychar != YYEMPTY)
{]b4_location_if([[ {]b4_locations_if([[
/* We throw away the lookahead, but the error range /* We throw away the lookahead, but the error range
of the shifted error token must take it into account. */ of the shifted error token must take it into account. */
yyGLRState *yys = yystackp->yytops.yystates[0]; yyGLRState *yys = yystackp->yytops.yystates[0];
@@ -2199,7 +2198,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[ YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
yytoken = YYTRANSLATE (yychar); yytoken = YYTRANSLATE (yychar);
yydestruct ("Error: discarding", yydestruct ("Error: discarding",
yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
} }
YYDPRINTF ((stderr, "Reading a token: ")); YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX; yychar = YYLEX;
@@ -2242,7 +2241,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
&& yyisShiftAction (yytable[yyj])) && yyisShiftAction (yytable[yyj]))
{ {
/* Shift the error token having adjusted its location. */ /* Shift the error token having adjusted its location. */
YYLTYPE yyerrloc;]b4_location_if([[ YYLTYPE yyerrloc;]b4_locations_if([[
yystackp->yyerror_range[2].yystate.yyloc = yylloc; yystackp->yyerror_range[2].yystate.yyloc = yylloc;
YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[ YYLLOC_DEFAULT (yyerrloc, (yystackp->yyerror_range), 2);]])[
YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]], YY_SYMBOL_PRINT ("Shifting", yystos[yytable[yyj]],
@@ -2253,7 +2252,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
break; break;
} }
} }
]b4_location_if([[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[ ]b4_locations_if([[ yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
yydestroyGLRState ("Error: popping", yys]b4_user_args[); yydestroyGLRState ("Error: popping", yys]b4_user_args[);
yystackp->yytops.yystates[0] = yys->yypred; yystackp->yytops.yystates[0] = yys->yypred;
yystackp->yynextFree -= 1; yystackp->yynextFree -= 1;
@@ -2295,7 +2294,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
yychar = YYEMPTY; yychar = YYEMPTY;
yylval = yyval_default; yylval = yyval_default;
]b4_location_if([ ]b4_locations_if([
#if YYLTYPE_IS_TRIVIAL #if YYLTYPE_IS_TRIVIAL
yylloc.first_line = yylloc.last_line = 1; yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 0; yylloc.first_column = yylloc.last_column = 0;
@@ -2344,7 +2343,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
yyrule = yydefaultAction (yystate); yyrule = yydefaultAction (yystate);
if (yyrule == 0) if (yyrule == 0)
{ {
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2377,7 +2376,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
} }
else if (yyisErrorAction (yyaction)) else if (yyisErrorAction (yyaction))
{ {
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2423,7 +2422,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error")); yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
YYCHK1 (yyresolveStack (&yystack]b4_user_args[)); YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
YYDPRINTF ((stderr, "Returning to deterministic operation.\n")); YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[ ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
yyreportSyntaxError (&yystack]b4_user_args[); yyreportSyntaxError (&yystack]b4_user_args[);
goto yyuser_error; goto yyuser_error;
} }
@@ -2488,7 +2487,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
YYTRANSLATE (yychar), YYTRANSLATE (yychar),
&yylval]b4_location_if([, &yylloc])[]b4_user_args[); &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
/* If the stack is well-formed, pop the stack until it is empty, /* If the stack is well-formed, pop the stack until it is empty,
destroying its entries as we go. But free the stack regardless destroying its entries as we go. But free the stack regardless
@@ -2506,7 +2505,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
while (yystates[yyk]) while (yystates[yyk])
{ {
yyGLRState *yys = yystates[yyk]; yyGLRState *yys = yystates[yyk];
]b4_location_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]] ]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
)[ yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[); )[ yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
yystates[yyk] = yys->yypred; yystates[yyk] = yys->yypred;
yystack.yynextFree -= 1; yystack.yynextFree -= 1;
@@ -2595,7 +2594,7 @@ yypdumpstack (yyGLRStack* yystackp)
] ]
b4_epilogue b4_epilogue
m4_if(b4_defines_flag, 0, [], b4_defines_if(
[@output @output_header_name@ [@output @output_header_name@
b4_copyright([Skeleton interface for Bison GLR parsers in C], b4_copyright([Skeleton interface for Bison GLR parsers in C],
[2002, 2003, 2004, 2005, 2006]) [2002, 2003, 2004, 2005, 2006])
@@ -2604,7 +2603,7 @@ b4_shared_declarations
extern YYSTYPE b4_prefix[]lval; extern YYSTYPE b4_prefix[]lval;
b4_location_if([b4_pure_if([], b4_locations_if([b4_pure_if([],
[extern YYLTYPE b4_prefix[]lloc;]) [extern YYLTYPE b4_prefix[]lloc;])
]) ])
]) ])

View File

@@ -49,7 +49,7 @@ m4_divert(-1) -*- C -*-
# We require a pure interface using locations. # We require a pure interface using locations.
m4_define([b4_location_flag], [1]) m4_define([b4_location_flag], [1])
m4_define([b4_pure], [1]) m4_define([b4_pure_flag], [1])
m4_include(b4_pkgdatadir/[c++.m4]) m4_include(b4_pkgdatadir/[c++.m4])
m4_include(b4_pkgdatadir/[location.cc]) m4_include(b4_pkgdatadir/[location.cc])
@@ -80,7 +80,7 @@ m4_define([b4_yy_symbol_print_generate],
b4_parse_param)[ b4_parse_param)[
{ {
]b4_parse_param_use[]dnl ]b4_parse_param_use[]dnl
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_location_if([, yylocationp])[); [ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
} }
]]) ]])
@@ -243,7 +243,7 @@ b4_syncline([@oline@], [@ofile@])[
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG ]b4_debug[ # define YYDEBUG ]b4_debug_flag[
#endif #endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
@@ -251,7 +251,7 @@ b4_syncline([@oline@], [@ofile@])[
# undef YYERROR_VERBOSE # undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1 # define YYERROR_VERBOSE 1
#else #else
# define YYERROR_VERBOSE ]b4_error_verbose[ # define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif #endif
/* Enabling the token table. */ /* Enabling the token table. */

View File

@@ -27,7 +27,7 @@ m4_include(b4_pkgdatadir/[location.cc])
# We do want M4 expansion after # for CPP macros. # We do want M4 expansion after # for CPP macros.
m4_changecom() m4_changecom()
m4_divert(0)dnl m4_divert(0)dnl
m4_if(b4_defines_flag, 0, [], b4_defines_if(
[@output @output_header_name@ [@output @output_header_name@
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++], b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
[2002, 2003, 2004, 2005, 2006]) [2002, 2003, 2004, 2005, 2006])
@@ -59,7 +59,7 @@ b4_syncline([@oline@], [@ofile@])[
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG ]b4_debug[ # define YYDEBUG ]b4_debug_flag[
#endif #endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
@@ -67,7 +67,7 @@ b4_syncline([@oline@], [@ofile@])[
# undef YYERROR_VERBOSE # undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1 # define YYERROR_VERBOSE 1
#else #else
# define YYERROR_VERBOSE ]b4_error_verbose[ # define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif #endif
/* Enabling the token table. */ /* Enabling the token table. */
@@ -303,8 +303,7 @@ m4_if(b4_prefix, [yy], [],
[ [
// Take the name prefix into account. // Take the name prefix into account.
#define yylex b4_prefix[]lex]) #define yylex b4_prefix[]lex])
m4_if(b4_defines_flag, 0, [], b4_defines_if([
[
#include @output_header_name@])[ #include @output_header_name@])[
/* User implementation prologue. */ /* User implementation prologue. */
@@ -580,7 +579,7 @@ b4_syncline([@oline@], [@ofile@])])dnl
YYCDEBUG << "Reading a token: "; YYCDEBUG << "Reading a token: ";
yychar = ]b4_c_function_call([yylex], [int], yychar = ]b4_c_function_call([yylex], [int],
[[YYSTYPE*], [&yylval]][]dnl [[YYSTYPE*], [&yylval]][]dnl
b4_location_if([, [[location*], [&yylloc]]])dnl b4_locations_if([, [[location*], [&yylloc]]])dnl
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[; m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
} }

View File

@@ -49,7 +49,7 @@ m4_define([b4_yacc_pure_if],
# --------------- # ---------------
# Arguments passed to yyerror: user args plus yylloc. # Arguments passed to yyerror: user args plus yylloc.
m4_define([b4_yyerror_args], m4_define([b4_yyerror_args],
[b4_yacc_pure_if([b4_location_if([&yylloc, ])])dnl [b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
@@ -59,7 +59,7 @@ m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
# b4_lex_param arrives quoted twice, but we want to keep only one level. # b4_lex_param arrives quoted twice, but we want to keep only one level.
m4_define([b4_lex_param], m4_define([b4_lex_param],
m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl
b4_location_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl b4_locations_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl
m4_ifdef([b4_lex_param], b4_lex_param))) m4_ifdef([b4_lex_param], b4_lex_param)))
@@ -135,7 +135,7 @@ m4_define([b4_rhs_location],
m4_changecom() m4_changecom()
m4_divert(0)dnl m4_divert(0)dnl
@output @output_parser_name@ @output @output_parser_name@
b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C], b4_copyright([Skeleton implementation for Bison's Yacc-like parsers in C],dnl '
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[ [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])[
/* C LALR(1) parser skeleton written by Richard Stallman, by /* C LALR(1) parser skeleton written by Richard Stallman, by
@@ -158,7 +158,7 @@ m4_if(b4_prefix, [yy], [],
#define yychar b4_prefix[]char #define yychar b4_prefix[]char
#define yydebug b4_prefix[]debug #define yydebug b4_prefix[]debug
#define yynerrs b4_prefix[]nerrs #define yynerrs b4_prefix[]nerrs
b4_location_if([#define yylloc b4_prefix[]lloc])])[ b4_locations_if([#define yylloc b4_prefix[]lloc])])[
]b4_token_enums_defines(b4_tokens)[ ]b4_token_enums_defines(b4_tokens)[
@@ -167,7 +167,7 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG ]b4_debug[ # define YYDEBUG ]b4_debug_flag[
#endif #endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
@@ -175,7 +175,7 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
# undef YYERROR_VERBOSE # undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1 # define YYERROR_VERBOSE 1
#else #else
# define YYERROR_VERBOSE ]b4_error_verbose[ # define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif #endif
/* Enabling the token table. */ /* Enabling the token table. */
@@ -196,7 +196,7 @@ b4_syncline([@oline@], [@ofile@])
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
#endif #endif
]b4_location_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED ]b4_locations_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE typedef struct YYLTYPE
{ {
int first_line; int first_line;
@@ -359,7 +359,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \ #if (! defined yyoverflow \
&& (! defined __cplusplus \ && (! defined __cplusplus \
|| (]b4_location_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ || (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) && ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
@@ -367,7 +367,7 @@ union yyalloc
{ {
yytype_int16 yyss; yytype_int16 yyss;
YYSTYPE yyvs; YYSTYPE yyvs;
]b4_location_if([ YYLTYPE yyls; ]b4_locations_if([ YYLTYPE yyls;
])dnl ])dnl
[}; [};
@@ -376,7 +376,7 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with /* The size of an array large to enough to hold all stacks, each with
N elements. */ N elements. */
]b4_location_if( ]b4_locations_if(
[# define YYSTACK_BYTES(N) \ [# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)], + 2 * YYSTACK_GAP_MAXIMUM)],
@@ -633,7 +633,7 @@ while (YYID (0))
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM #ifdef YYLEX_PARAM
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM) # define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
#else #else
# define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
#endif #endif
@@ -658,7 +658,7 @@ do { \
{ \ { \
YYFPRINTF (stderr, "%s ", Title); \ YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \ yy_symbol_print (stderr, \
Type, Value]b4_location_if([, Location])[]b4_user_args[); \ Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (YYID (0)) } while (YYID (0))
@@ -693,7 +693,7 @@ do { \
]b4_c_function_def([yy_reduce_print], [static void], ]b4_c_function_def([yy_reduce_print], [static void],
[[YYSTYPE *yyvsp], [yyvsp]], [[YYSTYPE *yyvsp], [yyvsp]],
b4_location_if([[[YYLTYPE *yylsp], [yylsp]],]) b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],])
[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,]) [[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,])
b4_parse_param)[ b4_parse_param)[
{ {
@@ -708,7 +708,7 @@ do { \
fprintf (stderr, " $%d = ", yyi + 1); fprintf (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&]b4_rhs_value(yynrhs, yyi + 1)[ &]b4_rhs_value(yynrhs, yyi + 1)[
]b4_location_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
b4_user_args[); b4_user_args[);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
} }
@@ -717,7 +717,7 @@ do { \
# define YY_REDUCE_PRINT(Rule) \ # define YY_REDUCE_PRINT(Rule) \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (yyvsp, ]b4_location_if([yylsp, ])[Rule]b4_user_args[); \ yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
} while (YYID (0)) } while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
@@ -971,7 +971,7 @@ int yychar;
YYSTYPE yylval; YYSTYPE yylval;
/* Number of syntax errors so far. */ /* Number of syntax errors so far. */
int yynerrs;b4_location_if([ int yynerrs;b4_locations_if([
/* Location data for the look-ahead symbol. */ /* Location data for the look-ahead symbol. */
YYLTYPE yylloc;]) YYLTYPE yylloc;])
]) ])
@@ -1024,7 +1024,7 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvs = yyvsa;
YYSTYPE *yyvsp; YYSTYPE *yyvsp;
]b4_location_if( ]b4_locations_if(
[[ /* The location stack. */ [[ /* The location stack. */
YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls = yylsa; YYLTYPE *yyls = yylsa;
@@ -1032,14 +1032,14 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
/* The locations where the error started and ended. */ /* The locations where the error started and ended. */
YYLTYPE yyerror_range[2];]])[ YYLTYPE yyerror_range[2];]])[
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_location_if([, yylsp -= (N)])[) #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
YYSIZE_T yystacksize = YYINITDEPTH; YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
]b4_location_if([ YYLTYPE yyloc;])[ ]b4_locations_if([ YYLTYPE yyloc;])[
/* The number of symbols on the RHS of the reduced rule. /* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */ Keep to zero when no symbol should be popped. */
@@ -1059,7 +1059,7 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
yyssp = yyss; yyssp = yyss;
yyvsp = yyvs; yyvsp = yyvs;
]b4_location_if([[ yylsp = yyls; ]b4_locations_if([[ yylsp = yyls;
#if YYLTYPE_IS_TRIVIAL #if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */ /* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1; yylloc.first_line = yylloc.last_line = 1;
@@ -1105,7 +1105,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
memory. */ memory. */
YYSTYPE *yyvs1 = yyvs; YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss; yytype_int16 *yyss1 = yyss;
]b4_location_if([ YYLTYPE *yyls1 = yyls;])[ ]b4_locations_if([ YYLTYPE *yyls1 = yyls;])[
/* Each stack pointer address is followed by the size of the /* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a data in use in that stack, in bytes. This used to be a
@@ -1114,9 +1114,9 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
yyoverflow (YY_("memory exhausted"), yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp), &yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp), &yyvs1, yysize * sizeof (*yyvsp),
]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ ]b4_locations_if([ &yyls1, yysize * sizeof (*yylsp),])[
&yystacksize); &yystacksize);
]b4_location_if([ yyls = yyls1;])[ ]b4_locations_if([ yyls = yyls1;])[
yyss = yyss1; yyss = yyss1;
yyvs = yyvs1; yyvs = yyvs1;
} }
@@ -1139,7 +1139,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
goto yyexhaustedlab; goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyvs);
]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ ]b4_locations_if([ YYSTACK_RELOCATE (yyls);])[
# undef YYSTACK_RELOCATE # undef YYSTACK_RELOCATE
if (yyss1 != yyssa) if (yyss1 != yyssa)
YYSTACK_FREE (yyss1); YYSTACK_FREE (yyss1);
@@ -1149,7 +1149,7 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
yyssp = yyss + yysize - 1; yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1; yyvsp = yyvs + yysize - 1;
]b4_location_if([ yylsp = yyls + yysize - 1;])[ ]b4_locations_if([ yylsp = yyls + yysize - 1;])[
YYDPRINTF ((stderr, "Stack size increased to %lu\n", YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize)); (unsigned long int) yystacksize));
@@ -1226,7 +1226,7 @@ yybackup:
yystate = yyn; yystate = yyn;
*++yyvsp = yylval; *++yyvsp = yylval;
]b4_location_if([ *++yylsp = yylloc;])[ ]b4_locations_if([ *++yylsp = yylloc;])[
goto yynewstate; goto yynewstate;
@@ -1257,7 +1257,7 @@ yyreduce:
GCC warning that YYVAL may be used uninitialized. */ GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen]; yyval = yyvsp[1-yylen];
]b4_location_if( ]b4_locations_if(
[[ /* Default location. */ [[ /* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[
YY_REDUCE_PRINT (yyn); YY_REDUCE_PRINT (yyn);
@@ -1275,7 +1275,7 @@ b4_syncline([@oline@], [@ofile@])[
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval; *++yyvsp = yyval;
]b4_location_if([ *++yylsp = yyloc;])[ ]b4_locations_if([ *++yylsp = yyloc;])[
/* Now `shift' the result of the reduction. Determine what state /* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule that goes to, based on the state we popped back to and the rule
@@ -1337,7 +1337,7 @@ yyerrlab:
#endif #endif
} }
]b4_location_if([[ yyerror_range[0] = yylloc;]])[ ]b4_locations_if([[ yyerror_range[0] = yylloc;]])[
if (yyerrstatus == 3) if (yyerrstatus == 3)
{ {
@@ -1353,7 +1353,7 @@ yyerrlab:
else else
{ {
yydestruct ("Error: discarding", yydestruct ("Error: discarding",
yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
yychar = YYEMPTY; yychar = YYEMPTY;
} }
} }
@@ -1374,7 +1374,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0) if (/*CONSTCOND*/ 0)
goto yyerrorlab; goto yyerrorlab;
]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; ]b4_locations_if([[ yyerror_range[0] = yylsp[1-yylen];
]])[ /* Do not reclaim the symbols of the rule which action triggered ]])[ /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */ this YYERROR. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@@ -1408,9 +1408,9 @@ yyerrlab1:
if (yyssp == yyss) if (yyssp == yyss)
YYABORT; YYABORT;
]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ ]b4_locations_if([[ yyerror_range[0] = *yylsp;]])[
yydestruct ("Error: popping", yydestruct ("Error: popping",
yystos[yystate], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
YYPOPSTACK (1); YYPOPSTACK (1);
yystate = *yyssp; yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
@@ -1420,7 +1420,7 @@ yyerrlab1:
YYACCEPT; YYACCEPT;
*++yyvsp = yylval; *++yyvsp = yylval;
]b4_location_if([[ ]b4_locations_if([[
yyerror_range[1] = yylloc; yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of /* Using YYLLOC is tempting, but would change the location of
the look-ahead. YYLOC is available though. */ the look-ahead. YYLOC is available though. */
@@ -1461,7 +1461,7 @@ yyexhaustedlab:
yyreturn: yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY) if (yychar != YYEOF && yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@@ -1469,7 +1469,7 @@ yyreturn:
while (yyssp != yyss) while (yyssp != yyss)
{ {
yydestruct ("Cleanup: popping", yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
YYPOPSTACK (1); YYPOPSTACK (1);
} }
#ifndef yyoverflow #ifndef yyoverflow
@@ -1485,9 +1485,9 @@ yyreturn:
b4_epilogue b4_epilogue
m4_if(b4_defines_flag, 0, [], b4_defines_if(
[@output @output_header_name@ [@output @output_header_name@
b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C], b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
[1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006]) [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
b4_token_enums_defines(b4_tokens) b4_token_enums_defines(b4_tokens)
@@ -1508,7 +1508,7 @@ b4_syncline([@oline@], [@ofile@])
b4_pure_if([], b4_pure_if([],
[extern YYSTYPE b4_prefix[]lval;]) [extern YYSTYPE b4_prefix[]lval;])
b4_location_if( b4_locations_if(
[#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED [#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE typedef struct YYLTYPE
{ {
@@ -1522,7 +1522,7 @@ typedef struct YYLTYPE
# define YYLTYPE_IS_TRIVIAL 1 # define YYLTYPE_IS_TRIVIAL 1
#endif #endif
m4_if(b4_pure, [0], b4_pure_if([],
[extern YYLTYPE b4_prefix[]lloc;]) [extern YYLTYPE b4_prefix[]lloc;])
]) ])dnl b4_locations_if
]) ])dnl b4_defines_if

View File

@@ -84,7 +84,8 @@ static const char * const trace_args[] =
"grammar - reading, reducing of the grammar", "grammar - reading, reducing of the grammar",
"resource - memory consumption (where available)", "resource - memory consumption (where available)",
"sets - grammar sets: firsts, nullable etc.", "sets - grammar sets: firsts, nullable etc.",
"tools - m4 invocation and preserve the temporary file", "tools - m4 invocation",
"m4 - m4 traces",
"skeleton - skeleton postprocessing", "skeleton - skeleton postprocessing",
"time - time consumption", "time - time consumption",
"all - all of the above", "all - all of the above",
@@ -102,6 +103,7 @@ static const int trace_types[] =
trace_resource, trace_resource,
trace_sets, trace_sets,
trace_tools, trace_tools,
trace_m4,
trace_skeleton, trace_skeleton,
trace_time, trace_time,
trace_all trace_all

View File

@@ -73,6 +73,7 @@ enum trace
trace_grammar = 1 << 7, trace_grammar = 1 << 7,
trace_time = 1 << 8, trace_time = 1 << 8,
trace_skeleton = 1 << 9, trace_skeleton = 1 << 9,
trace_m4 = 1 << 10,
trace_all = ~0 trace_all = ~0
}; };
extern int trace_flag; extern int trace_flag;

View File

@@ -501,7 +501,7 @@ output_skeleton (void)
FILE *in; FILE *in;
FILE *out; FILE *out;
int filter_fd[2]; int filter_fd[2];
char const *argv[5]; char const *argv[6];
pid_t pid; pid_t pid;
/* Compute the names of the package data dir and skeleton file. /* Compute the names of the package data dir and skeleton file.
@@ -538,7 +538,8 @@ output_skeleton (void)
argv[1] = full_m4sugar; argv[1] = full_m4sugar;
argv[2] = "-"; argv[2] = "-";
argv[3] = full_skeleton; argv[3] = full_skeleton;
argv[4] = NULL; argv[4] = trace_flag & trace_m4 ? "-dV" : NULL;
argv[5] = NULL;
init_subpipe (); init_subpipe ();
pid = create_subpipe (argv, filter_fd); pid = create_subpipe (argv, filter_fd);
@@ -582,11 +583,11 @@ static void
prepare (void) prepare (void)
{ {
/* Flags. */ /* Flags. */
MUSCLE_INSERT_BOOL ("debug", debug_flag); MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag); MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
MUSCLE_INSERT_BOOL ("error_verbose", error_verbose); MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
MUSCLE_INSERT_BOOL ("locations_flag", locations_flag); MUSCLE_INSERT_BOOL ("locations_flag", locations_flag);
MUSCLE_INSERT_BOOL ("pure", pure_parser); MUSCLE_INSERT_BOOL ("pure_flag", pure_parser);
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
/* File names. */ /* File names. */