mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
@@ -12193,6 +12193,17 @@ location. Invocations of @samp{%lex-param @{@var{type1} @var{arg1}@}} yield
|
||||
additional arguments.
|
||||
@end deftypefun
|
||||
|
||||
@defcv {Type} {parser} {symbol_type}
|
||||
A ``complete symbol'', that binds together its kind, value and (when
|
||||
applicable) location.
|
||||
@end defcv
|
||||
|
||||
@deftypemethod {symbol_type} {symbol_kind_type} kind () @code{const}
|
||||
The kind of this symbol.
|
||||
@end deftypemethod
|
||||
|
||||
@sp 1
|
||||
|
||||
For each token kind, Bison generates named constructors as follows.
|
||||
|
||||
@deftypeop {Constructor} {parser::symbol_type} {} {symbol_type} (@code{int} @var{token}, @code{const @var{value_type}&} @var{value}, @code{const location_type&} @var{location})
|
||||
|
||||
Reference in New Issue
Block a user