+2004-09-16 Akim Demaille <akim@epita.fr>
+
+ * data/lalr1.cc (Stack::Iterator, Stack::ConstIterator): Rename as...
+ (iterator, const_iterator): these, to be more in the C++ spirit.
+ Also, return reverse iterators so that when displaying the stack
+ we display its bottom first.
+ (Parser::stack_print_, Parser::reduce_print_): Match the messages
+ from yacc.c.
+ We should probably use vector here though.
+
2004-09-16 Akim Demaille <akim@epita.fr>
Have more complete shift traces.
void
yy::]b4_parser_class_name[::stack_print_ ()
{
- cdebug_ << "state stack now";
- for (StateStack::ConstIterator i = state_stack_.begin ();
+ cdebug_ << "Stack now";
+ for (StateStack::const_iterator i = state_stack_.begin ();
i != state_stack_.end (); ++i)
cdebug_ << ' ' << *i;
cdebug_ << std::endl;
{
unsigned int yylno = rline_[yyrule];
/* Print the symbols being reduced, and their result. */
- cdebug_ << "Reducing via rule " << n_ - 1 << " (line " << yylno << "), ";
+ cdebug_ << "Reducing stack by rule " << n_ - 1 << " (line " << yylno << "), ";
for (]b4_int_type_for([b4_prhs])[ i = prhs_[n_];
0 <= rhs_[i]; ++i)
cdebug_ << name_[rhs_[i]] << ' ';
{
public:
- typedef typename S::iterator Iterator;
- typedef typename S::const_iterator ConstIterator;
+ // Hide our reversed order.
+ typedef typename S::reverse_iterator iterator;
+ typedef typename S::const_reverse_iterator const_iterator;
Stack () : seq_ ()
{
return seq_.size ();
}
- inline ConstIterator begin () const { return seq_.begin (); }
- inline ConstIterator end () const { return seq_.end (); }
+ inline const_iterator begin () const { return seq_.rbegin (); }
+ inline const_iterator end () const { return seq_.rend (); }
private: