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:
Akim Demaille
2012-07-22 09:11:37 +02:00
parent b611359d90
commit e3990e3c99
4 changed files with 93 additions and 53 deletions

View File

@@ -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.