c++: give public access to the symbol kind

symbol_type::token () was removed: it returned the token kind of a
symbol.  To do that, one needs to convert from the symbol kind to the
token kind, which requires a table.

This broke some users' unit tests for scanners, see
https://lists.gnu.org/r/bug-bison/2020-01/msg00001.html
https://lists.gnu.org/r/bug-bison/2020-03/msg00020.html
https://lists.gnu.org/r/help-bison/2020-04/msg00005.html

Instead of making this possible again, let's check the symbol's kind
instead.  So give proper access to a symbol's kind.

That feature existed, undocumented, as 'type_get()'.  Let's rename
this as 'kind()'.

* data/skeletons/c++.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.cc (type_get): Rename as...
(kind): This.
(type_get): Install a backward compatibility alias.
* doc/bison.texi (Complete Symbols): Document symbol_type and
symbol_type::kind.
This commit is contained in:
Akim Demaille
2020-04-17 08:51:18 +02:00
parent e86b14069d
commit d6ae95fb50
6 changed files with 67 additions and 35 deletions

View File

@@ -107,7 +107,7 @@ yyerror (]b4_locations_if([[const ]b4_namespace_ref::b4_parser_class[::location_
]b4_percent_define_flag_if([[global_tokens_and_yystype]], [],
[m4_define([b4_pre_epilogue],
[[/* The user is using the C++ token type, not the C one. */
[[/* The user is using the C++ token kind, not the C one. */
#undef ]b4_symbol(0, [id])
])])[