mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
c, c++: also define YYEMPTY in yytoken_kind_t
I have been hesitating a lot before doing it ---after all the user must not use this kind, so what's the point of showing it in yytoken_kind_t. And eventually I chose to play it safe with the typing system and make it possible to use yytoken_kind_t for all the tokens, even the "empty token". * data/skeletons/c.m4: Give an id and a tag to YYEMPTY. (b4_token_enums): Define YYEMPTY. * data/skeletons/c++.m4 (b4_token_enums): Define YYEMPTY. * data/skeletons/glr.c, data/skeletons/glr.cc, data/skeletons/yacc.c: (YYEMPTY): Remove. Use b4_symbol(-2, id) instead.
This commit is contained in:
@@ -434,11 +434,15 @@ static const b4_int_type_for([$2]) yy$1[[]] =
|
||||
# header, and because these tokens are common to all the parsers, we
|
||||
# need to make sure their names don't collide: use the api.prefix.
|
||||
# YYEOF is special, since the user may give it a different name.
|
||||
m4_define([b4_symbol(-2, id)], [b4_api_PREFIX[][EMPTY]])
|
||||
m4_define([b4_symbol(-2, tag)], [[No symbol.]])
|
||||
|
||||
m4_if(b4_symbol(0, id), [YYEOF],
|
||||
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
||||
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][ERRCODE]])
|
||||
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
||||
|
||||
|
||||
# b4_token_define(TOKEN-NUM)
|
||||
# --------------------------
|
||||
# Output the definition of this token as #define.
|
||||
@@ -477,6 +481,7 @@ m4_define([b4_token_enums],
|
||||
# define ]b4_api_PREFIX[TOKENTYPE
|
||||
enum ]b4_api_prefix[tokentype
|
||||
{
|
||||
]b4_symbol([-2], [id])[ = -2,
|
||||
]b4_symbol_foreach([b4_token_enum])dnl
|
||||
[ };
|
||||
typedef enum ]b4_api_prefix[tokentype ]b4_api_prefix[token_kind_t;
|
||||
|
||||
Reference in New Issue
Block a user