c++: provide yy::parser::symbol_type::name

* data/skeletons/c++.m4 (yy::parser::basic_symbol::name): New.
* data/skeletons/lalr1.cc (yy_print_): Use it.
* doc/bison.texi: Document.
* tests/c++.at: Check.
This commit is contained in:
Akim Demaille
2020-05-10 09:58:30 +02:00
parent 6bb37dbe27
commit bf98d94f4f
5 changed files with 38 additions and 3 deletions

View File

@@ -12154,6 +12154,8 @@ values, which is always less than @code{YYNTOKENS}.
@deftypemethod {parser} {const char *} symbol_name (@code{symbol_kind_t} @var{symbol}) @code{const}
The name of the symbol whose kind is @var{symbol}, possibly translated.
Returns a @code{std::string} when @code{parse.error} is @code{verbose}.
@end deftypemethod
A custom syntax error function looks as follows. This implementation is
@@ -12286,6 +12288,12 @@ applicable) location.
The kind of this symbol.
@end deftypemethod
@deftypemethod {symbol_type} {const char *} name () @code{const}
The name of the kind of this symbol.
Returns a @code{std::string} when @code{parse.error} is @code{verbose}.
@end deftypemethod
@sp 1
For each token kind, Bison generates named constructors as follows.