# 02110-1301 USA
m4_include(b4_pkgdatadir/[c++.m4])
+
+# The header is mandatory.
+b4_defines_if([],
+ [m4_fatal(b4_skeleton[: using %defines is mandatory])])
+
# Backward compatibility.
m4_define([b4_location_constructors])
m4_include(b4_pkgdatadir/[location.cc])
# We do want M4 expansion after # for CPP macros.
m4_changecom()
m4_divert(0)dnl
-m4_if(b4_defines_flag, 0, [],
+b4_defines_if(
[@output @output_header_name@
-b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
- [2002, 2003, 2004, 2005, 2006])
+b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
+ [2002, 2003, 2004, 2005, 2006])
dnl FIXME: This is wrong, we want computed header guards.
[
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
/* Enabling traces. */
#ifndef YYDEBUG
-# define YYDEBUG ]b4_debug[
+# define YYDEBUG ]b4_debug_flag[
#endif
/* Enabling verbose error messages. */
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
-# define YYERROR_VERBOSE ]b4_error_verbose[
+# define YYERROR_VERBOSE ]b4_error_verbose_flag[
#endif
/* Enabling the token table. */
virtual void yystack_print_ ();
#endif
- /// Convert a scanner token number to a symbol number.
- token_number_type yytranslate_ (int token);
+ /// Convert a scanner token number \a t to a symbol number.
+ token_number_type yytranslate_ (int t);
/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
#endif /* ! defined PARSER_HEADER_H */]
])dnl
@output @output_parser_name@
-b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
- [2002, 2003, 2004, 2005, 2006])
+b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
+ [2002, 2003, 2004, 2005, 2006])
m4_if(b4_prefix, [yy], [],
[
// Take the name prefix into account.
#define yylex b4_prefix[]lex])
-m4_if(b4_defines_flag, 0, [],
-[
+b4_defines_if([
#include @output_header_name@])[
/* User implementation prologue. */
{
std::string yyr = "";
char const *yyp = yystr;
-
+
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
-
+
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
default:
yyr += *yyp;
break;
-
+
case '"':
return yyr;
}
do_not_strip_quotes: ;
}
-
+
return yystr;
}
YYCDEBUG << "Reading a token: ";
yychar = ]b4_c_function_call([yylex], [int],
[[YYSTYPE*], [&yylval]][]dnl
-b4_location_if([, [[location*], [&yylloc]]])dnl
+b4_locations_if([, [[location*], [&yylloc]]])dnl
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
}
YYUSE (yystate);
#if YYERROR_VERBOSE
int yyn = yypact_[yystate];
- if (yypact_ninf_ < yyn && yyn < yylast_)
+ if (yypact_ninf_ < yyn && yyn <= yylast_)
{
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
- int yychecklim = yylast_ - yyn;
+ int yychecklim = yylast_ - yyn + 1;
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
int count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
]b4_parser_class_name[::token_number_type
- ]b4_parser_class_name[::yytranslate_ (int token)
+ ]b4_parser_class_name[::yytranslate_ (int t)
{
static
const token_number_type
{
]b4_translate[
};
- if ((unsigned int) token <= yyuser_token_number_max_)
- return translate_table[token];
+ if ((unsigned int) t <= yyuser_token_number_max_)
+ return translate_table[t];
else
return yyundef_token_;
}
]b4_epilogue
dnl
@output b4_dir_prefix[]stack.hh
-b4_copyright([stack handling for Bison C++ parsers],
+b4_copyright([Stack handling for Bison parsers in C++],
[2002, 2003, 2004, 2005, 2006])[
#ifndef BISON_STACK_HH