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:
Akim Demaille
2020-04-13 08:05:09 +02:00
parent 5e2e9af56d
commit 64aec0a8d8
5 changed files with 34 additions and 30 deletions

View File

@@ -340,7 +340,9 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
]b4_namespace_close[
]dnl Map the name used in c.m4 to the one used in c++.m4.
[#undef ]b4_symbol(0, [id])[
[#undef ]b4_symbol(-2, [id])[
#define ]b4_symbol(-2, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(-2, [id])[
#undef ]b4_symbol(0, [id])[
#define ]b4_symbol(0, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(0, [id])[
#ifndef ]b4_api_PREFIX[STYPE