symbols: minor fixes

* data/skeletons/bison.m4 (b4_symbol_kind): Series of _ are useless,
one is enough.
* data/skeletons/c.m4 (b4_token_enum): Fix overquoting.
This commit is contained in:
Akim Demaille
2020-04-08 08:13:00 +02:00
parent bbb9750b3e
commit 007e1b5f0a
5 changed files with 18 additions and 20 deletions

View File

@@ -417,12 +417,12 @@ m4_define([b4_symbol_kind],
m4_case([$1],
[-2], [[YYEMPTY]],
[0], [[YYEOF]],
[m4_case(m4_quote(b4_symbol([$1], [tag])),
[1], [[YYERROR]],
[m4_case(b4_symbol([$1], [tag]),
[$accept], [[YYACCEPT]],
[error], [[YYERROR]],
[$undefined], [[YYUNDEF]],
[b4_symbol_if([$1], [has_id], m4_expand(_b4_symbol([$1], [id])),
[[$1_][]m4_bpatsubst(m4_quote(_b4_symbol([$1], [tag])), [[^a-zA-Z_0-9]], [_])])])])])
[b4_symbol_if([$1], [has_id], _b4_symbol([$1], [id]),
[m4_bpatsubst([$1-][]_b4_symbol([$1], [tag]), [[^a-zA-Z_0-9]+], [_])])])])])
# b4_symbol(NUM, FIELD)

View File

@@ -453,8 +453,8 @@ m4_define([b4_token_enum],
[b4_token_visible_if([$1],
[m4_format([ %-30s %s],
m4_format([[%s = %s%s%s]],
[b4_symbol([$1], [id])],
[b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]]))],
b4_symbol([$1], [id]),
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])),
m4_if([$1], b4_last_enum_token, [], [[,]])),
[b4_symbol_tag_comment([$1])])])])
@@ -468,8 +468,8 @@ m4_define([b4_token_enums],
# define ]b4_api_PREFIX[TOKENTYPE
enum ]b4_api_prefix[tokentype
{
]b4_symbol_foreach([b4_token_enum])[
};
]b4_symbol_foreach([b4_token_enum])dnl
[ };
#endif
]])])
@@ -513,12 +513,12 @@ m4_define([b4_symbol_enum],
# Defining YYEMPTY here is important: it forces the compiler
# to use a signed type, which matters for yytoken.
m4_define([b4_declare_symbol_enum],
[[/* Symbol type. */
[[/* Symbol kind. */
enum yysymbol_kind_t
{
]b4_symbol_kind([-2])[ = -2,
]b4_symbol_foreach([b4_symbol_enum])[
};
]b4_symbol_foreach([b4_symbol_enum])dnl
[};
typedef enum yysymbol_kind_t yysymbol_kind_t;
]])])

View File

@@ -144,7 +144,7 @@ m4_define([b4_token_enum],
# --------------
# Output the definition of the tokens (if there are) as enums.
m4_define([b4_token_enums],
[b4_any_token_visible_if([/* Tokens. */
[b4_any_token_visible_if([/* Token kinds. */
b4_symbol_foreach([b4_token_enum])])])