# define YYDEBUG ]b4_debug[
#endif
-/* Enabling verbose error message. */
-#ifndef YYERROR_VERBOSE
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
# define YYERROR_VERBOSE ]b4_error_verbose[
#endif
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE ]b4_token_table[
+#endif
+
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_filename])
/// For a rule, its RHS length.
static const ]b4_int_type_for([b4_r2])[ yyr2_[];
-#if YYDEBUG || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
- static const char* const yyname_[];
+ static const char* const yytname_[];
+#endif
+
+#if YYERROR_VERBOSE
+ /// Convert the symbol name \a n to a form suitable for a diagnostic.
+ virtual std::string yytnamerr_ (const char *n);
#endif
#if YYDEBUG
[
#include @output_header_name@])[
-/* INFRINGES ON USER NAME SPACE */
-#ifndef _
-# define _(msgid) msgid
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
#endif
/* A pseudo ostream that takes yydebug_ into account. */
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
+#if YYERROR_VERBOSE
+
+/* Return YYSTR after stripping away unnecessary quotes and
+ backslashes, so that it's suitable for yyerror. The heuristic is
+ that double-quoting is unnecessary unless the string contains an
+ apostrophe, a comma, or backslash (other than backslash-backslash).
+ YYSTR is taken from yytname. */
+std::string
+yy::]b4_parser_class_name[::yytnamerr_ (const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ 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;
+ /* Fall through. */
+ default:
+ yyr += *yyp;
+ break;
+
+ case '"':
+ return yyr;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ return yystr;
+}
+
+#endif
+
#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
(void) cdebug_;
*yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
- << ' ' << yyname_[yytype] << " ("
+ << ' ' << yytname_[yytype] << " ("
<< *yylocationp << ": ";
switch (yytype)
{
{
int yyresult_;
- YYCDEBUG << _("Starting parse") << std::endl;
+ YYCDEBUG << "Starting parse" << std::endl;
yynerrs_ = 0;
yyerrstatus_ = 0;
/* New state. */
yynewstate:
yystate_stack_.push (yystate_);
- YYCDEBUG << _("Entering state ") << yystate_ << std::endl;
+ YYCDEBUG << "Entering state " << yystate_ << std::endl;
goto yybackup;
/* Backup. */
if (yylooka_ <= yyeof_)
{
yylooka_ = yyilooka_ = yyeof_;
- YYCDEBUG << _("Now at end of input.") << std::endl;
+ YYCDEBUG << "Now at end of input." << std::endl;
}
else
{
yyilooka_ = yytranslate_ (yylooka_);
- YY_SYMBOL_PRINT (_("Next token is"), yyilooka_, &yylval, &yylloc);
+ YY_SYMBOL_PRINT ("Next token is", yyilooka_, &yylval, &yylloc);
}
/* If the proper action on seeing token ILOOKA_ is to reduce or to
goto yyacceptlab;
/* Shift the look-ahead token. */
- YY_SYMBOL_PRINT (_("Shifting"), yyilooka_, &yylval, &yylloc);
+ YY_SYMBOL_PRINT ("Shifting", yyilooka_, &yylval, &yylloc);
/* Discard the token being shifted unless it is eof. */
if (yylooka_ != yyeof_)
/* If just tried and failed to reuse look-ahead token after an
error, discard it. */
- /* Return failure if at end of input. */
if (yylooka_ <= yyeof_)
{
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
+ /* Return failure if at end of input. */
if (yylooka_ == yyeof_)
- for (;;)
- {
- yyerror_range_[0] = yylocation_stack_[0];
- yypop_ ();
- if (yystate_stack_.height () == 1)
- YYABORT;
- yydestruct_ (_("Error: popping"),
- yystos_[yystate_stack_[0]],
- &yysemantic_stack_[0],
- &yylocation_stack_[0]);
- }
+ YYABORT;
}
else
{
- yydestruct_ (_("Error: discarding"), yyilooka_, &yylval, &yylloc);
+ yydestruct_ ("Error: discarding", yyilooka_, &yylval, &yylloc);
yylooka_ = yyempty_;
}
}
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (false)
- goto yyerrorlab;
+ goto yyerrorlab;
yyerror_range_[0] = yylocation_stack_[yylen_ - 1];
yypop_ (yylen_);
YYABORT;
yyerror_range_[0] = yylocation_stack_[0];
- yydestruct_ (_("Error: popping"),
+ yydestruct_ ("Error: popping",
yystos_[yystate_],
&yysemantic_stack_[0], &yylocation_stack_[0]);
yypop_ ();
yylocation_stack_.push (yyloc);
/* Shift the error token. */
- YY_SYMBOL_PRINT (_("Shifting"), yystos_[yyn_],
+ YY_SYMBOL_PRINT ("Shifting", yystos_[yyn_],
&yysemantic_stack_[0], &yylocation_stack_[0]);
yystate_ = yyn_;
yyreturn:
if (yylooka_ != yyeof_ && yylooka_ != yyempty_)
- yydestruct_ (_("Error: discarding lookahead"), yyilooka_, &yylval, &yylloc);
+ yydestruct_ ("Cleanup: discarding lookahead", yyilooka_, &yylval, &yylloc);
+
+ while (yystate_stack_.height () != 1)
+ {
+ yydestruct_ ("Cleanup: popping",
+ yystos_[yystate_stack_[0]],
+ &yysemantic_stack_[0],
+ &yylocation_stack_[0]);
+ yypop_ ();
+ }
+
return yyresult_;
}
void
yy::]b4_parser_class_name[::yylex_ ()
{
- YYCDEBUG << _("Reading a token: ");
+ YYCDEBUG << "Reading a token: ";
yylooka_ = ]b4_c_function_call([yylex], [int],
[[YYSTYPE*], [&yylval]][]dnl
b4_location_if([, [[location*], [&yylloc]]])dnl
if (yycheck_[x + yyn_] == x && x != yyterror_)
++count;
- message = _("syntax error, unexpected ");
- message += yyname_[yyilooka_];
+ // FIXME: This method of building the message is not compatible
+ // with internationalization. It should work like yacc.c does it.
+ // That is, first build a string that looks like this:
+ // "syntax error, unexpected %s or %s or %s"
+ // Then, invoke YY_ on this string.
+ // Finally, use the string as a format to output
+ // yytname_[yyilooka_], etc.
+ // Until this gets fixed, this message appears in English only.
+ message = "syntax error, unexpected ";
+ message += yytnamerr_ (yytname_[yyilooka_]);
if (count < 5)
{
count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn_] == x && x != yyterror_)
{
- message += (!count++) ? _(", expecting ") : _(" or ");
- message += yyname_[x];
- }
+ message += (!count++) ? ", expecting " : " or ";
+ message += yytnamerr_ (yytname_[x]);
+ }
}
}
else
#endif
- message = _("syntax error");
+ message = YY_("syntax error");
error (yylloc, message);
}
}
]b4_r2[
};
-#if YYDEBUG || YYERROR_VERBOSE
+#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. */
const char*
-const yy::]b4_parser_class_name[::yyname_[] =
+const yy::]b4_parser_class_name[::yytname_[] =
{
]b4_tname[
};
void
yy::]b4_parser_class_name[::yystack_print_ ()
{
- *yycdebug_ << _("Stack now");
+ *yycdebug_ << "Stack now";
for (state_stack_type::const_iterator i = yystate_stack_.begin ();
i != yystate_stack_.end (); ++i)
*yycdebug_ << ' ' << *i;
{
unsigned int yylno = yyrline_[yyrule];
/* Print the symbols being reduced, and their result. */
- *yycdebug_ << _("Reducing stack by rule ") << yyn_ - 1
- << " (" << _("line") << ' ' << yylno << "), ";
+ *yycdebug_ << "Reducing stack by rule " << yyn_ - 1
+ << " (line " << yylno << "), ";
for (]b4_int_type_for([b4_prhs])[ i = yyprhs_[yyn_];
0 <= yyrhs_[i]; ++i)
- *yycdebug_ << yyname_[yyrhs_[i]] << ' ';
- *yycdebug_ << "-> " << yyname_[yyr1_[yyn_]] << std::endl;
+ *yycdebug_ << yytname_[yyrhs_[i]] << ' ';
+ *yycdebug_ << "-> " << yytname_[yyr1_[yyn_]] << std::endl;
}
#endif // YYDEBUG