[2002, 2003, 2004, 2005])
dnl FIXME: This is wrong, we want computed header guards.
[
+/* C++ LALR(1) parser skeleton written by Akim Demaille. */
+
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H
b4_error_verbose_if([, int tok])[);
#if YYDEBUG
+ /// \brief Report a symbol value on the debug stream.
+ /// \param yytype The token type.
+ /// \param yyvaluep Its semantic value.
+ /// \param yylocationp Its location.
+ virtual void yy_symbol_value_print_ (int yytype,
+ const semantic_type* yyvaluep,
+ const location_type* yylocationp);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.
/// \param yylocationp Its location.
- virtual void yysymprint_ (int yytype,
- const semantic_type* yyvaluep,
- const location_type* yylocationp);
+ virtual void yy_symbol_print_ (int yytype,
+ const semantic_type* yyvaluep,
+ const location_type* yylocationp);
#endif /* ! YYDEBUG */
[b4_token_defines(b4_tokens)
#ifndef YYSTYPE
- /* Redirection for backward compatibility. */
+ /* Redirection for backward compatibility. */
# define YYSTYPE yy::b4_parser_class_name::semantic_type
#endif
])[
#endif
/* Suppress unused-variable warnings by "using" E. */
-#define YYUSE(e) do {;} while (false && (e))
+#define YYUSE(e) ((void) (e))
-/* A pseudo ostream that takes yydebug_ into account. */
+/* A pseudo ostream that takes yydebug_ into account. */
# define YYCDEBUG \
for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
(*yycdebug_)
if (yydebug_) \
{ \
*yycdebug_ << Title << ' '; \
- yysymprint_ ((Type), (Value), (Location)); \
+ yy_symbol_print_ ((Type), (Value), (Location)); \
*yycdebug_ << std::endl; \
} \
} while (false)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
- void
- ]b4_parser_class_name[::yysymprint_ (int yytype,
+ inline void
+ ]b4_parser_class_name[::yy_symbol_value_print_ (int yytype,
const semantic_type* yyvaluep, const location_type* yylocationp)
{
- /* Backward compatibility, but should be removed eventually. */
- std::ostream& cdebug_ = *yycdebug_;
-
- YYUSE (!&cdebug_);
YYUSE (yylocationp);
YYUSE (yyvaluep);
-
- *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
- << ' ' << yytname_[yytype] << " ("
- << *yylocationp << ": ";
switch (yytype)
{
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
[ default:
break;
}
+ }
+
+
+ void
+ ]b4_parser_class_name[::yy_symbol_print_ (int yytype,
+ const semantic_type* yyvaluep, const location_type* yylocationp)
+ {
+ *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
+ << ' ' << yytname_[yytype] << " ("
+ << *yylocationp << ": ";
+ yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
*yycdebug_ << ')';
}
#endif /* ! YYDEBUG */
/* State. */
int yyn;
- int yylen;
+ int yylen = 0;
int yystate = 0;
- /* Error handling. */
+ /* Error handling. */
int yynerrs_ = 0;
int yyerrstatus_ = 0;
]m4_ifdef([b4_initial_action], [
m4_pushdef([b4_at_dollar], [yylloc])dnl
m4_pushdef([b4_dollar_dollar], [yylval])dnl
- /* User initialization code. */
+ /* User initialization code. */
b4_initial_action
m4_popdef([b4_dollar_dollar])dnl
m4_popdef([b4_at_dollar])dnl
`-----------------------------*/
yyreduce:
yylen = yyr2_[yyn];
- /* If LEN_ is nonzero, implement the default value of the action:
+ /* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'. Otherwise, use the top of the stack.
Otherwise, the following line sets YYVAL to garbage.
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- ]b4_actions[
+ ]b4_actions
+ /* Line __line__ of lalr1.cc. */
+b4_syncline([@oline@], [@ofile@])[
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
- /* Line __line__ of lalr1.cc. */
-]b4_syncline([@oline@], [@ofile@])[
yypop_ (yylen);
-
+ yylen = 0;
YY_STACK_PRINT ();
yysemantic_stack_.push (yyval);
goto yyerrorlab;
yyerror_range[0] = yylocation_stack_[yylen - 1];
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
yypop_ (yylen);
+ yylen = 0;
yystate = yystate_stack_[0];
goto yyerrlab1;
yysemantic_stack_.push (yylval);
yylocation_stack_.push (yyloc);
- /* Shift the error token. */
+ /* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
&yysemantic_stack_[0], &yylocation_stack_[0]);
if (yychar != yyeof_ && yychar != yyempty_)
yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ yypop_ (yylen);
while (yystate_stack_.height () != 1)
{
yydestruct_ ("Cleanup: popping",
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at \a yyntokens_, nonterminals. */
+ First, the terminals, then, starting at \a yyntokens_, nonterminals. */
const char*
const ]b4_parser_class_name[::yytname_[] =
{
#endif
#if YYDEBUG
- /* YYRHS -- A `-1'-separated list of the rules' RHS. */
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
const ]b4_parser_class_name[::rhs_number_type
]b4_parser_class_name[::yyrhs_[] =
{