mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
output: use the token list to define the yytokentype
There are currently two systems used to pass information about tokens to m4: the original one, and another, which is used for instance for printers and destructors, variants etc. Move to using only the latter. * data/bison.m4 (b4_symbol_map, b4_token_visible_if) (b4_token_has_definition, b4_any_token_visible_if, b4_token_format): New. * data/c++.m4, data/c.m4, data/glr.c, data/java.m4: Adjust to use them.
This commit is contained in:
18
data/c++.m4
18
data/c++.m4
@@ -86,16 +86,16 @@ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||
|
||||
|
||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
# -----------------------------------------------------
|
||||
# b4_token_enums
|
||||
# --------------
|
||||
# Output the definition of the tokens as enums.
|
||||
m4_define([b4_token_enums],
|
||||
[/* Tokens. */
|
||||
enum yytokentype {
|
||||
m4_map_sep([ b4_token_enum], [,
|
||||
],
|
||||
[$@])
|
||||
};
|
||||
[[enum yytokentype
|
||||
{
|
||||
]m4_join([,
|
||||
],
|
||||
b4_symbol_map([b4_token_enum]))[
|
||||
};]dnl
|
||||
])
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ m4_define([b4_public_types_declare],
|
||||
/// Tokens.
|
||||
struct token
|
||||
{
|
||||
]b4_token_enums(b4_tokens)[
|
||||
]b4_token_enums[
|
||||
};
|
||||
|
||||
/// Token type.
|
||||
|
||||
Reference in New Issue
Block a user