summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAkim Demaille <demaille@gostai.com>2008-08-21 22:04:27 +0200
committerJoel E. Denny <jdenny@clemson.edu>2009-12-29 16:01:46 -0500
commit39f6a8d1426417ef23893d8358511ea66cb9b361 (patch)
treea5039ea40fd6350685a41a298b9b443309e15c80 /data
parente657f3698ed074bca2a84d5e2498f8f369c3bc49 (diff)
downloadbison-39f6a8d1426417ef23893d8358511ea66cb9b361.tar.gz
Prefer M4 to CPP.
* data/lalr1.cc: Use b4_error_verbose_if instead of #if YYERROR_VERBOSE. (cherry picked from commit 422c18f48d3d545c538c61dbb7471cfa7b9e920c)
Diffstat (limited to 'data')
-rw-r--r--data/lalr1.cc25
1 files changed, 10 insertions, 15 deletions
diff --git a/data/lalr1.cc b/data/lalr1.cc
index f4cadc0e..e7620a23 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -233,12 +233,10 @@ b4_user_stype
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
static const char* const yytname_[];
-#endif
+#endif]b4_error_verbose_if([
-#if YYERROR_VERBOSE
/// Convert the symbol name \a n to a form suitable for a diagnostic.
- virtual std::string yytnamerr_ (const char *n);
-#endif
+ static std::string yytnamerr_ (const char *n);])[
#if YYDEBUG
/// A type to store symbol numbers and -1.
@@ -384,8 +382,7 @@ do { \
#define YYERROR goto yyerrorlab
#define YYRECOVERING() (!!yyerrstatus_)
-]b4_namespace_open[
-#if YYERROR_VERBOSE
+]b4_namespace_open[]b4_error_verbose_if([[
/* Return YYSTR after stripping away unnecessary quotes and
backslashes, so that it's suitable for yyerror. The heuristic is
@@ -423,8 +420,7 @@ do { \
return yystr;
}
-
-#endif
+]])[
/// Build a parser object.
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
@@ -849,12 +845,11 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
// Generate an error message.
std::string
- ]b4_parser_class_name[::yysyntax_error_ (int yystate, int]dnl
-b4_error_verbose_if([ yytoken])[)
+ ]b4_parser_class_name[::yysyntax_error_ (]dnl
+b4_error_verbose_if([int yystate, int yytoken],
+ [int, int])[)
{
- std::string yyres;
- YYUSE (yystate);
-#if YYERROR_VERBOSE
+ std::string yyres;]b4_error_verbose_if([[
int yyn = yypact_[yystate];
if (yypact_ninf_ < yyn && yyn <= yylast_)
{
@@ -913,8 +908,8 @@ b4_error_verbose_if([ yytoken])[)
yyres += *yyp;
}
else
-#endif
- yyres = YY_("syntax error");
+ ]])dnl
+[ yyres = YY_("syntax error");
return yyres;
}