bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

missing YYEMPTY #define in C skeleton


From: Todd C. Miller
Subject: missing YYEMPTY #define in C skeleton
Date: Mon, 09 Nov 2020 13:22:54 -0700

When generating a C parser, YYEMPTY is present in enum yytokentype
but there is no corresponding #define like there is for the other
values.  There is a special case for YYEMPTY in b4_token_enums but
no corresponding case in b4_token_defines.

Something like the following works, but is quite ugly.  I expected
to be able to use b4_token_define([-2]) here but that produces an
error.  Someone more familiar with bison's m4 macros can probably
come up with a much better fix.

 - todd

Index: data/skeletons/c.m4
--- data/skeletons/c.m4.orig
+++ data/skeletons/c.m4
@@ -510,6 +510,7 @@ m4_define([b4_token_define],
 # Output the definition of the tokens.
 m4_define([b4_token_defines],
 [b4_any_token_visible_if([/* Token kinds.  */
+#define ]b4_symbol([-2], [id])[ -2
 m4_join([
 ], b4_symbol_map([b4_token_define]))
 ])])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]