mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
When yydebug, report semantic and location values for reductions.
* data/glr.c (yy_reduce_print): Report the semantic values and the locations. (YY_REDUCE_PRINT): Adjust. (yyglrReduce): Use them. (b4_rhs_value, b4_rhs_location): Remove m4_eval invocations. * data/c.m4 (b4_yysymprint_generate): Specify the const arguments. * tests/calc.at (_AT_CHECK_CALC_ERROR): Remove the reduction traces.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -1,3 +1,15 @@
|
|||||||
|
2005-11-11 Akim <akim@epita.fr>
|
||||||
|
|
||||||
|
When yydebug, report semantic and location values for reductions.
|
||||||
|
* data/glr.c (yy_reduce_print): Report the semantic values and the
|
||||||
|
locations.
|
||||||
|
(YY_REDUCE_PRINT): Adjust.
|
||||||
|
(yyglrReduce): Use them.
|
||||||
|
(b4_rhs_value, b4_rhs_location): Remove m4_eval invocations.
|
||||||
|
* data/c.m4 (b4_yysymprint_generate): Specify the const arguments.
|
||||||
|
* tests/calc.at (_AT_CHECK_CALC_ERROR): Remove the reduction
|
||||||
|
traces.
|
||||||
|
|
||||||
2005-11-10 Akim Demaille <akim@epita.fr>
|
2005-11-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* data/glr.c (yynewGLRStackItem, YY_RESERVE_GLRSTACK): New.
|
* data/glr.c (yynewGLRStackItem, YY_RESERVE_GLRSTACK): New.
|
||||||
|
|||||||
@@ -413,10 +413,10 @@ m4_define_default([b4_yysymprint_generate],
|
|||||||
|
|
||||||
]$1([yysymprint],
|
]$1([yysymprint],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[YYSTYPE *yyvaluep], [yyvaluep]][]dnl
|
[[const YYSTYPE * const yyvaluep], [yyvaluep]][]dnl
|
||||||
b4_location_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
b4_location_if([, [[const YYLTYPE * const yylocationp], [yylocationp]]])[]dnl
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
{
|
{
|
||||||
YYUSE (yyvaluep);
|
YYUSE (yyvaluep);
|
||||||
|
|||||||
48
data/glr.c
48
data/glr.c
@@ -113,7 +113,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
|
[(((yyGLRStackItem const *)yyvsp)@{YYFILL ($2 - $1)@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ m4_define([b4_lhs_location],
|
|||||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc)])
|
[(((yyGLRStackItem const *)yyvsp)@{YYFILL ($2 - $1)@}.yystate.yyloc)])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
# We do want M4 expansion after # for CPP macros.
|
||||||
m4_changecom()
|
m4_changecom()
|
||||||
@@ -956,9 +956,9 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define yyis_pact_ninf(yystate) \
|
#define yyis_pact_ninf(yystate) \
|
||||||
]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), 1,
|
]m4_if(m4_eval(b4_pact_ninf < b4_pact_min), [1],
|
||||||
0,
|
[0],
|
||||||
((yystate) == YYPACT_NINF))[
|
[((yystate) == YYPACT_NINF)])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
@@ -976,9 +976,9 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define yyis_table_ninf(yytable_value) \
|
#define yyis_table_ninf(yytable_value) \
|
||||||
]m4_if(m4_eval(b4_table_ninf < b4_table_min), 1,
|
]m4_if(m4_eval(b4_table_ninf < b4_table_min), [1],
|
||||||
0,
|
[0],
|
||||||
((yytable_value) == YYTABLE_NINF))[
|
[((yytable_value) == YYTABLE_NINF)])[
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -1328,12 +1328,12 @@ yydoAction (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !YYDEBUG
|
#if !YYDEBUG
|
||||||
# define YY_REDUCE_PRINT(K, Rule)
|
# define YY_REDUCE_PRINT(Args)
|
||||||
#else
|
#else
|
||||||
# define YY_REDUCE_PRINT(K, Rule) \
|
# define YY_REDUCE_PRINT(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (K, Rule); \
|
yy_reduce_print Args; \
|
||||||
} while (/*CONSTCOND*/ 0)
|
} while (/*CONSTCOND*/ 0)
|
||||||
|
|
||||||
/*----------------------------------------------------------.
|
/*----------------------------------------------------------.
|
||||||
@@ -1341,16 +1341,29 @@ do { \
|
|||||||
`----------------------------------------------------------*/
|
`----------------------------------------------------------*/
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
yy_reduce_print (size_t yyk, yyRuleNum yyrule)
|
yy_reduce_print (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
|
||||||
|
YYSTYPE* yyvalp, YYLTYPE* yylocp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
|
yybool yynormal __attribute__ ((__unused__)) =
|
||||||
|
(yystack->yysplitPoint == NULL);
|
||||||
|
yyGLRStackItem* yyvsp = (yyGLRStackItem*) yystack->yytops.yystates[yyk];
|
||||||
|
int yylow = 1;
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu), ",
|
YYFPRINTF (stderr, "Reducing stack %lu by rule %d (line %lu):\n",
|
||||||
(unsigned long int) yyk, yyrule - 1,
|
(unsigned long int) yyk, yyrule - 1,
|
||||||
(unsigned long int) yyrline[yyrule]);
|
(unsigned long int) yyrline[yyrule]);
|
||||||
/* Print the symbols being reduced, and their result. */
|
/* Print the symbols being reduced, and their result. */
|
||||||
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
|
//for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
|
||||||
YYFPRINTF (stderr, "%s ", yytokenName (yyrhs[yyi]));
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
YYFPRINTF (stderr, "-> %s\n", yytokenName (yyr1[yyrule]));
|
{
|
||||||
|
fprintf (stderr, " $%d = ", yyi);
|
||||||
|
yysymprint (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
|
&]b4_rhs_value(yynrhs, yyi)[
|
||||||
|
]b4_location_if([, &]b4_rhs_location(yynrhs, yyi))[]dnl
|
||||||
|
b4_user_args[);
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1376,8 +1389,9 @@ yyglrReduce (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
|
|||||||
YYSTYPE yysval;
|
YYSTYPE yysval;
|
||||||
YYLTYPE yyloc;
|
YYLTYPE yyloc;
|
||||||
|
|
||||||
YY_REDUCE_PRINT (yyk, yyrule);
|
YY_REDUCE_PRINT ((yystack, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
|
||||||
YYCHK (yydoAction (yystack, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
|
YYCHK (yydoAction (yystack, yyk, yyrule, &yysval, &yyloc]b4_user_args[));
|
||||||
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
||||||
yyglrShift (yystack, yyk,
|
yyglrShift (yystack, yyk,
|
||||||
yyLRgotoState (yystack->yytops.yystates[yyk]->yylrState,
|
yyLRgotoState (yystack->yytops.yystates[yyk]->yylrState,
|
||||||
yylhsNonterm (yyrule)),
|
yylhsNonterm (yyrule)),
|
||||||
|
|||||||
@@ -409,6 +409,7 @@ sed '/^Starting/d
|
|||||||
/^Error:/d
|
/^Error:/d
|
||||||
/^Next/d
|
/^Next/d
|
||||||
/^Discarding/d
|
/^Discarding/d
|
||||||
|
/ \$[[0-9$]]* = /d
|
||||||
/^yydestructor:/d' stderr >at-stderr
|
/^yydestructor:/d' stderr >at-stderr
|
||||||
mv at-stderr stderr
|
mv at-stderr stderr
|
||||||
# 2. Create the reference error message.
|
# 2. Create the reference error message.
|
||||||
|
|||||||
Reference in New Issue
Block a user