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

@@ -173,6 +173,7 @@ m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
m4_define([b4_token_enums],
[[enum yytokentype
{
]b4_symbol([-2], [id])[ = -2,
]b4_symbol_foreach([b4_token_enum])dnl
[ };]dnl
])