mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 03:03:02 +00:00
* data/lalr1.cc (Parser::reduce_print_): New.
Use it.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2003-08-25 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* data/lalr1.cc (Parser::reduce_print_): New.
|
||||||
|
Use it.
|
||||||
|
|
||||||
2003-08-25 Akim Demaille <akim@epita.fr>
|
2003-08-25 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
Have lalr1.cc catch with Paul Eggert's patch to fix the infinite
|
Have lalr1.cc catch with Paul Eggert's patch to fix the infinite
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ namespace yy
|
|||||||
static const ]b4_int_type_for([b4_rline])[ rline_[];
|
static const ]b4_int_type_for([b4_rline])[ rline_[];
|
||||||
static const ]b4_int_type_for([b4_stos])[ stos_[];
|
static const ]b4_int_type_for([b4_stos])[ stos_[];
|
||||||
static const ]b4_int_type_for([b4_toknum])[ token_number_[];
|
static const ]b4_int_type_for([b4_toknum])[ token_number_[];
|
||||||
|
virtual void reduce_print_ (int yyrule);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Even more tables. */
|
/* Even more tables. */
|
||||||
@@ -322,8 +323,14 @@ m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[
|
|||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
# define YYCDEBUG if (debug_) cdebug_
|
# define YYCDEBUG if (debug_) cdebug_
|
||||||
|
# define YY_REDUCE_PRINT(Rule) \
|
||||||
|
do { \
|
||||||
|
if (debug_) \
|
||||||
|
reduce_print_ (Rule); \
|
||||||
|
} while (0)
|
||||||
#else /* !YYDEBUG */
|
#else /* !YYDEBUG */
|
||||||
# define YYCDEBUG if (0) cdebug_
|
# define YYCDEBUG if (0) cdebug_
|
||||||
|
# define YY_REDUCE_PRINT(Rule)
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !YYDEBUG */
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
#define YYACCEPT goto yyacceptlab
|
||||||
@@ -472,28 +479,12 @@ yy::]b4_parser_class_name[::parse ()
|
|||||||
yyloc = location_stack_[0];
|
yyloc = location_stack_[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG
|
|
||||||
if (debug_)
|
|
||||||
{
|
|
||||||
// Short files will use "unsigned char" for line numbers,
|
|
||||||
// in which case they will be output as character litterals
|
|
||||||
// by "<<".
|
|
||||||
unsigned yylno = rline_[n_];
|
|
||||||
YYCDEBUG << "Reducing via rule " << n_ - 1
|
|
||||||
<< " (line " << yylno << "), ";
|
|
||||||
for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_];
|
|
||||||
0 <= rhs_[i]; ++i)
|
|
||||||
YYCDEBUG << name_[rhs_[i]] << ' ';
|
|
||||||
YYCDEBUG << "-> " << name_[r1_[n_]] << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (len_)
|
if (len_)
|
||||||
{
|
{
|
||||||
Slice< LocationType, LocationStack > slice (location_stack_, len_);
|
Slice< LocationType, LocationStack > slice (location_stack_, len_);
|
||||||
YYLLOC_DEFAULT (yyloc, slice, len_);
|
YYLLOC_DEFAULT (yyloc, slice, len_);
|
||||||
}
|
}
|
||||||
|
YY_REDUCE_PRINT (n_);
|
||||||
switch (n_)
|
switch (n_)
|
||||||
{
|
{
|
||||||
]b4_actions[
|
]b4_actions[
|
||||||
@@ -715,6 +706,7 @@ yy::]b4_parser_class_name[::lex_ ()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
STATE-NUM. */
|
STATE-NUM. */
|
||||||
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) yy::b4_parser_class_name::pact_ninf_ = b4_pact_ninf[;
|
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) yy::b4_parser_class_name::pact_ninf_ = b4_pact_ninf[;
|
||||||
@@ -828,7 +820,22 @@ yy::]b4_parser_class_name[::rline_[] =
|
|||||||
{
|
{
|
||||||
]b4_rline[
|
]b4_rline[
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
/** Report that the YYRULE is going to be reduced. */
|
||||||
|
|
||||||
|
void
|
||||||
|
yy::]b4_parser_class_name[::reduce_print_ (int yyrule)
|
||||||
|
{
|
||||||
|
int yyi;
|
||||||
|
unsigned int yylno = rline_[yyrule];
|
||||||
|
/* Print the symbols being reduced, and their result. */
|
||||||
|
cdebug_ << "Reducing via rule " << n_ - 1 << " (line " << yylno << "), ";
|
||||||
|
for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_];
|
||||||
|
0 <= rhs_[i]; ++i)
|
||||||
|
cdebug_ << name_[rhs_[i]] << ' ';
|
||||||
|
cdebug_ << "-> " << name_[r1_[n_]] << std::endl;
|
||||||
|
}
|
||||||
|
#endif // YYDEBUG
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
yy::]b4_parser_class_name[::TokenNumberType
|
yy::]b4_parser_class_name[::TokenNumberType
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ do { \
|
|||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
||||||
| TOP (cinluded). |
|
| TOP (included). |
|
||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_stack_print], [static void],
|
]b4_c_function_def([yy_stack_print], [static void],
|
||||||
|
|||||||
Reference in New Issue
Block a user