diff --git a/data/skeletons/d.m4 b/data/skeletons/d.m4 index 7d1672d5..4c3a5ce7 100644 --- a/data/skeletons/d.m4 +++ b/data/skeletons/d.m4 @@ -148,11 +148,9 @@ private static immutable b4_int_type_for([$2])[[]] yy$1_ = ]) -## -------------------------- ## -## (External) token numbers. ## -## -------------------------- ## - -b4_percent_define_default([[api.symbol.prefix]], [[YYSYMBOL_]]) +## ------------- ## +## Token kinds. ## +## ------------- ## # b4_token_enum(TOKEN-NAME, TOKEN-NUMBER) # --------------------------------------- @@ -165,7 +163,7 @@ m4_define([b4_token_enum], # -------------- # Output the definition of the tokens as enums. m4_define([b4_token_enums], -[/* Tokens. */ +[/* Token kinds. */ public enum YYTokenType { /** Token returned by the scanner to signal the end of its input. */ @@ -174,19 +172,24 @@ b4_symbol_foreach([b4_token_enum]) } ]) -## --------------------------- ## -## (Internal) symbol numbers. ## -## --------------------------- ## + + +## -------------- ## +## Symbol kinds. ## +## -------------- ## + +b4_percent_define_default([[api.symbol.prefix]], [[S_]]) # b4_symbol_enum(SYMBOL-NUM) # -------------------------- # Output the definition of this symbol as an enum. m4_define([b4_symbol_enum], -[m4_ifval(b4_symbol([$1], [kind]), - [m4_format([[%s = %s]], - b4_symbol([$1], [kind]), - b4_symbol([$1], [number]))])]) +[m4_format([ %-30s %s], + m4_format([[%s = %s,]], + b4_symbol([$1], [kind]), + [$1]), + [b4_symbol_tag_comment([$1])])]) # b4_declare_symbol_enum @@ -195,14 +198,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 kinds. */ public enum SymbolKind { - ]m4_join([, - ], - ]b4_symbol_kind([-2])[ = -2, - b4_symbol_map([b4_symbol_enum]))[ - }; + ]b4_symbol_kind([-2])[ = -2, /* No symbol. */ +]b4_symbol_foreach([b4_symbol_enum])dnl +[ }; ]])])