mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
* data/lalr1.cc (Parser::stack_print_, YY_STACK_PRINT): New.
Use them.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2003-08-25 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* data/lalr1.cc (Parser::stack_print_, YY_STACK_PRINT): New.
|
||||||
|
Use them.
|
||||||
|
|
||||||
2003-08-25 Akim Demaille <akim@epita.fr>
|
2003-08-25 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* data/lalr1.cc (Parser::reduce_print_): New.
|
* data/lalr1.cc (Parser::reduce_print_): New.
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ namespace yy
|
|||||||
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);
|
virtual void reduce_print_ (int yyrule);
|
||||||
|
virtual void stack_print_ ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Even more tables. */
|
/* Even more tables. */
|
||||||
@@ -328,9 +329,15 @@ do { \
|
|||||||
if (debug_) \
|
if (debug_) \
|
||||||
reduce_print_ (Rule); \
|
reduce_print_ (Rule); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
# define YY_STACK_PRINT() \
|
||||||
|
do { \
|
||||||
|
if (debug_) \
|
||||||
|
stack_print_ (); \
|
||||||
|
} while (0)
|
||||||
#else /* !YYDEBUG */
|
#else /* !YYDEBUG */
|
||||||
# define YYCDEBUG if (0) cdebug_
|
# define YYCDEBUG if (0) cdebug_
|
||||||
# define YY_REDUCE_PRINT(Rule)
|
# define YY_REDUCE_PRINT(Rule)
|
||||||
|
# define YY_STACK_PRINT()
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !YYDEBUG */
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
#define YYACCEPT goto yyacceptlab
|
||||||
@@ -497,16 +504,7 @@ b4_syncline([@oline@], [@ofile@])[
|
|||||||
semantic_stack_.pop (len_);
|
semantic_stack_.pop (len_);
|
||||||
location_stack_.pop (len_);
|
location_stack_.pop (len_);
|
||||||
|
|
||||||
#if YYDEBUG
|
YY_STACK_PRINT ();
|
||||||
if (debug_)
|
|
||||||
{
|
|
||||||
YYCDEBUG << "state stack now";
|
|
||||||
for (StateStack::ConstIterator i = state_stack_.begin ();
|
|
||||||
i != state_stack_.end (); ++i)
|
|
||||||
YYCDEBUG << ' ' << *i;
|
|
||||||
YYCDEBUG << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
semantic_stack_.push (yyval);
|
semantic_stack_.push (yyval);
|
||||||
location_stack_.push (yyloc);
|
location_stack_.push (yyloc);
|
||||||
@@ -663,17 +661,7 @@ yyerrlab1:
|
|||||||
semantic_stack_.pop ();
|
semantic_stack_.pop ();
|
||||||
location_stack_.pop ();
|
location_stack_.pop ();
|
||||||
state_ = state_stack_[0];
|
state_ = state_stack_[0];
|
||||||
|
YY_STACK_PRINT ();
|
||||||
#if YYDEBUG
|
|
||||||
if (debug_)
|
|
||||||
{
|
|
||||||
YYCDEBUG << "Error: state stack now";
|
|
||||||
for (StateStack::ConstIterator i = state_stack_.begin ();
|
|
||||||
i != state_stack_.end (); ++i)
|
|
||||||
YYCDEBUG << ' ' << *i;
|
|
||||||
YYCDEBUG << std::endl;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_ == final_)
|
if (n_ == final_)
|
||||||
@@ -821,6 +809,18 @@ yy::]b4_parser_class_name[::rline_[] =
|
|||||||
]b4_rline[
|
]b4_rline[
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Print the state stack from its BOTTOM up to its TOP (included). */
|
||||||
|
|
||||||
|
void
|
||||||
|
yy::]b4_parser_class_name[::stack_print_ ()
|
||||||
|
{
|
||||||
|
cdebug_ << "state stack now";
|
||||||
|
for (StateStack::ConstIterator i = state_stack_.begin ();
|
||||||
|
i != state_stack_.end (); ++i)
|
||||||
|
cdebug_ << ' ' << *i;
|
||||||
|
cdebug_ << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
/** Report that the YYRULE is going to be reduced. */
|
/** Report that the YYRULE is going to be reduced. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user