* data/lalr1.cc (yypush_): Now takes a optional trace message.
Adjust all uses.
+2008-11-07 Akim Demaille <demaille@gostai.com>
+
+ Moving push traces into yypush_.
+ * data/lalr1.cc (yypush_): Now takes a optional trace message.
+ Adjust all uses.
+
2008-11-07 Akim Demaille <demaille@gostai.com>
The single-stack C++ parser is now the standard one.
2008-11-07 Akim Demaille <demaille@gostai.com>
The single-stack C++ parser is now the standard one.
stack_type yystack_;
/// Push a new state on the stack.
stack_type yystack_;
/// Push a new state on the stack.
+ /// \param m a debug message to display
+ /// if null, no trace is output.
+ /// \param s the state entered
+ /// \param v semantic value
+ /// \param l location
/// \warning the contents of \a v is stolen.
/// \warning the contents of \a v is stolen.
- inline void yypush_ (state_type s,
+ inline void yypush_ (const char* m, state_type s,
semantic_type& v, const location_type& l);
/// Pop \a n symbols the three stacks.
semantic_type& v, const location_type& l);
/// Pop \a n symbols the three stacks.
- ]b4_parser_class_name[::yypush_ (state_type s,
+ ]b4_parser_class_name[::yypush_ (const char* m, state_type s,
semantic_type& v, const location_type& l)
{
semantic_type& v, const location_type& l)
{
+ if (m)
+ YY_SYMBOL_PRINT (m, yystos_[s], v, l);
]b4_variant_if(
[[ yystack_.push (data_type (s, semantic_type(), l));
]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]], [build], [v])],
]b4_variant_if(
[[ yystack_.push (data_type (s, semantic_type(), l));
]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]], [build], [v])],
location values to have been already stored, initialize these
stacks with a primary value. */
yystack_ = stack_type (0);
location values to have been already stored, initialize these
stacks with a primary value. */
yystack_ = stack_type (0);
- yypush_ (yystate, yylval, yylloc);
+ yypush_ (0, yystate, yylval, yylloc);
// A new state was pushed on the stack.
// Invariant: yystate == yystack_[0].state, i.e.,
// A new state was pushed on the stack.
// Invariant: yystate == yystack_[0].state, i.e.,
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, yylval, yylloc);
-
/* Discard the token being shifted. */
yychar = yyempty_;
/* Discard the token being shifted. */
yychar = yyempty_;
if (yyerrstatus_)
--yyerrstatus_;
if (yyerrstatus_)
--yyerrstatus_;
+ /* Shift the lookahead token. */
- yypush_ (yystate, yylval, yylloc);
+ yypush_ ("Shifting", yystate, yylval, yylloc);
goto yynewstate;
/*-----------------------------------------------------------.
goto yynewstate;
/*-----------------------------------------------------------.
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
yystate = yytable_[yystate];
else
yystate = yydefgoto_[yyn - yyntokens_];
- yypush_ (yystate, yyval, yyloc);
+ yypush_ (0, yystate, yyval, yyloc);
goto yynewstate;
/*------------------------------------.
goto yynewstate;
/*------------------------------------.
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
/* Shift the error token. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
/* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
- yystack_[0].value, yystack_[0].location);
-
- yypush_ (yystate, yylval, yyloc);
+ yypush_ ("Shifting", yystate, yylval, yyloc);
goto yynewstate;
/* Accept. */
goto yynewstate;
/* Accept. */