mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
c++: remove the yy prefix from some functions
yy::parser features a parse() function, not a yyparse() one. * data/skeletons/lalr1.cc (yyreport_syntax_error) (context::yyexpected_tokens): Rename as... (report_syntax_error, context::expected_tokens): these.
This commit is contained in:
11
TODO
11
TODO
@@ -1,20 +1,11 @@
|
|||||||
* Bison 3.6
|
* Bison 3.6
|
||||||
** C++
|
|
||||||
yyreport_syntax_error should always be the name of the reporting, yyparse
|
|
||||||
should not have to dispatch to several APIs.
|
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
- yyexpected_tokens in all the languages.
|
- yyexpected_tokens/expected_tokens/expectedTokens in all the languages.
|
||||||
- YYENOMEM
|
- YYENOMEM
|
||||||
- YYERRCODE, YYUNDEF, YYEOF
|
- YYERRCODE, YYUNDEF, YYEOF
|
||||||
- i18n in Java
|
- i18n in Java
|
||||||
- symbol.type_get should be kind_get, and it's not documented.
|
- symbol.type_get should be kind_get, and it's not documented.
|
||||||
|
|
||||||
** Naming conventions
|
|
||||||
There's no good reason to use the "yy" prefix in parser::context, is there?
|
|
||||||
See also the case of Java. We should keep the prefix for private
|
|
||||||
implementation details, but maybe not for public APIs.
|
|
||||||
|
|
||||||
** User token number, internal symbol number, external token number, etc.
|
** User token number, internal symbol number, external token number, etc.
|
||||||
There is some confusion over these terms, which is even a problem for
|
There is some confusion over these terms, which is even a problem for
|
||||||
translators. We need something clear, especially if we provide access to
|
translators. We need something clear, especially if we provide access to
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
||||||
/// number of tokens stored in YYARG. If YYARG is null, return the
|
/// number of tokens stored in YYARG. If YYARG is null, return the
|
||||||
/// number of expected tokens (guaranteed to be less than YYNTOKENS).
|
/// number of expected tokens (guaranteed to be less than YYNTOKENS).
|
||||||
int yyexpected_tokens (symbol_kind_type yyarg[], int yyargn) const;
|
int expected_tokens (symbol_kind_type yyarg[], int yyargn) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ]b4_parser_class[& yyparser_;
|
const ]b4_parser_class[& yyparser_;
|
||||||
@@ -276,7 +276,7 @@ m4_define([b4_shared_declarations],
|
|||||||
[custom], [[
|
[custom], [[
|
||||||
/// Report a syntax error
|
/// Report a syntax error
|
||||||
/// \param yyctx the context in which the error occurred.
|
/// \param yyctx the context in which the error occurred.
|
||||||
void yyreport_syntax_error (const context& yyctx) const;]],
|
void report_syntax_error (const context& yyctx) const;]],
|
||||||
[detailed\|verbose], [[
|
[detailed\|verbose], [[
|
||||||
/// The arguments of the error message.
|
/// The arguments of the error message.
|
||||||
int yy_syntax_error_arguments_ (const context& yyctx,
|
int yy_syntax_error_arguments_ (const context& yyctx,
|
||||||
@@ -1074,7 +1074,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]],
|
error (]b4_join(b4_locations_if([yyla.location]), [[YY_MOVE (msg)]])[);]],
|
||||||
[custom], [[
|
[custom], [[
|
||||||
context yyctx (*this, yyla);
|
context yyctx (*this, yyla);
|
||||||
yyreport_syntax_error (yyctx);]],
|
report_syntax_error (yyctx);]],
|
||||||
[[
|
[[
|
||||||
context yyctx (*this, yyla);
|
context yyctx (*this, yyla);
|
||||||
std::string msg = yysyntax_error_ (yyctx);
|
std::string msg = yysyntax_error_ (yyctx);
|
||||||
@@ -1230,7 +1230,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::context::yyexpected_tokens (symbol_kind_type yyarg[], int yyargn) const
|
]b4_parser_class[::context::expected_tokens (symbol_kind_type yyarg[], int yyargn) const
|
||||||
{
|
{
|
||||||
// Actual number of expected tokens
|
// Actual number of expected tokens
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
@@ -1462,7 +1462,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
if (yyarg)
|
if (yyarg)
|
||||||
yyarg[0] = yyctx.token ();
|
yyarg[0] = yyctx.token ();
|
||||||
int yyn = yyctx.yyexpected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
int yyn = yyctx.expected_tokens (yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
||||||
return yyn + 1;
|
return yyn + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ void
|
|||||||
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n';
|
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n';
|
||||||
}]AT_ERROR_CUSTOM_IF([[
|
}]AT_ERROR_CUSTOM_IF([[
|
||||||
void
|
void
|
||||||
]AT_NAMESPACE[::parser::yyreport_syntax_error (const context& ctx) const
|
]AT_NAMESPACE[::parser::report_syntax_error (const context& ctx) const
|
||||||
{]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
|
{]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
|
||||||
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [
|
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [
|
||||||
YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[
|
YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[
|
||||||
@@ -762,7 +762,7 @@ void
|
|||||||
{
|
{
|
||||||
enum { TOKENMAX = 10 };
|
enum { TOKENMAX = 10 };
|
||||||
symbol_kind_type expected[TOKENMAX];
|
symbol_kind_type expected[TOKENMAX];
|
||||||
int n = ctx.yyexpected_tokens (expected, TOKENMAX);
|
int n = ctx.expected_tokens (expected, TOKENMAX);
|
||||||
if (0 < n)
|
if (0 < n)
|
||||||
{
|
{
|
||||||
std::cerr << " (expected:";
|
std::cerr << " (expected:";
|
||||||
|
|||||||
Reference in New Issue
Block a user