Port small part of master's 8901f32e so future ports are easier.

* data/lalr1.cc (yy::parser::yysyntax_error_): Always add second
argument, but name it in the function definition only when
verbose error messages are enabled and it'll thus be used.
(yy::parser::parse): Update use of yysyntax_error_.
This commit is contained in:
Joel E. Denny
2009-12-22 15:44:29 -05:00
parent 2728ac7ecd
commit 1e05521d4f
2 changed files with 12 additions and 6 deletions

View File

@@ -1,3 +1,11 @@
2009-12-22 Joel E. Denny <jdenny@clemson.edu>
Port small part of master's 8901f32e so future ports are easier.
* data/lalr1.cc (yy::parser::yysyntax_error_): Always add second
argument, but name it in the function definition only when
verbose error messages are enabled and it'll thus be used.
(yy::parser::parse): Update use of yysyntax_error_.
2009-12-29 Joel E. Denny <jdenny@clemson.edu> 2009-12-29 Joel E. Denny <jdenny@clemson.edu>
portability: `<' and `>' are not always defined on addresses. portability: `<' and `>' are not always defined on addresses.

View File

@@ -153,8 +153,7 @@ b4_user_stype
/// Generate an error message. /// Generate an error message.
/// \param state the state where the error occurred. /// \param state the state where the error occurred.
/// \param tok the lookahead token. /// \param tok the lookahead token.
virtual std::string yysyntax_error_ (int yystate]dnl virtual std::string yysyntax_error_ (int yystate, int tok);
b4_error_verbose_if([, int tok])[);
#if YYDEBUG #if YYDEBUG
/// \brief Report a symbol value on the debug stream. /// \brief Report a symbol value on the debug stream.
@@ -726,8 +725,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
if (!yyerrstatus_) if (!yyerrstatus_)
{ {
++yynerrs_; ++yynerrs_;
error (yylloc, yysyntax_error_ (yystate]dnl error (yylloc, yysyntax_error_ (yystate, yytoken));
b4_error_verbose_if([, yytoken])[));
} }
yyerror_range[0] = yylloc; yyerror_range[0] = yylloc;
@@ -851,8 +849,8 @@ b4_error_verbose_if([, yytoken])[));
// Generate an error message. // Generate an error message.
std::string std::string
]b4_parser_class_name[::yysyntax_error_ (int yystate]dnl ]b4_parser_class_name[::yysyntax_error_ (int yystate, int]dnl
b4_error_verbose_if([, int tok])[) b4_error_verbose_if([ tok])[)
{ {
std::string res; std::string res;
YYUSE (yystate); YYUSE (yystate);