mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
lalr1.cc: factor the yytranslate_ invocation in make_SYMBOLS.
* data/c++.m4, data/lalr1.cc (parser::symbol_type): Change the constructor to take a token_type instead of the (internal) symbol number. Call yytranslate_. * data/variant.hh (b4_symbol_constructor_define_): Therefore, don't call yytranslate_ here.
This commit is contained in:
19
data/c++.m4
19
data/c++.m4
@@ -178,21 +178,22 @@ m4_define([b4_public_types_declare],
|
||||
/// Default constructor.
|
||||
inline symbol_type ();
|
||||
|
||||
/// Constructor.
|
||||
inline symbol_type (]b4_args([int t],
|
||||
/// Constructor for tokens with semantic value.
|
||||
inline symbol_type (]b4_args([token_type t],
|
||||
[const semantic_type& v],
|
||||
b4_locations_if([const location_type& l]))[);
|
||||
|
||||
inline symbol_type (]b4_args([int t],
|
||||
/// Constructor for valueless tokens.
|
||||
inline symbol_type (]b4_args([token_type t],
|
||||
b4_locations_if([const location_type& l]))[);
|
||||
|
||||
/// The symbol type.
|
||||
int type;
|
||||
|
||||
/// Return the type corresponding to this state.
|
||||
/// The symbol type.
|
||||
inline int type_get_ () const;
|
||||
|
||||
/// Its token.
|
||||
/// The token.
|
||||
inline token_type token () const;
|
||||
};
|
||||
]b4_symbol_constructor_declare])
|
||||
@@ -269,20 +270,20 @@ m4_define([b4_public_types_define],
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
||||
[int t],
|
||||
[token_type t],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: super_type (]b4_locations_if([l])[)
|
||||
, type (t)
|
||||
, type (yytranslate_ (t))
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
||||
[int t],
|
||||
[token_type t],
|
||||
[const semantic_type& v],
|
||||
b4_locations_if([const location_type& l]))[)
|
||||
: super_type (v]b4_locations_if([, l])[)
|
||||
, type (t)
|
||||
, type (yytranslate_ (t))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user