mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
%define token.prefix.
Provide a means to add a prefix to the name of the tokens as output in the generated files. Because of name clashes, it is good to have such a prefix such as TOK_ that protects from names such as EOF, FILE etc. But it clutters the grammar itself. * data/bison.m4 (token.prefix): Empty by default. * data/c.m4 (b4_token_enum, b4_token_define): Use it. * data/lalr1.cc (b4_symbol): Ditto.
This commit is contained in:
@@ -159,7 +159,7 @@ m4_define([b4_null], [0])
|
||||
# -----------------------------------------
|
||||
# Output the definition of this token as #define.
|
||||
m4_define([b4_token_define],
|
||||
[#define $1 $2
|
||||
[#define b4_percent_define_get([token.prefix])$1 $2
|
||||
])
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ m4_map([b4_token_define], [$@])])
|
||||
# ---------------------------------------
|
||||
# Output the definition of this token as an enum.
|
||||
m4_define([b4_token_enum],
|
||||
[$1 = $2])
|
||||
[b4_percent_define_get([token.prefix])$1 = $2])
|
||||
|
||||
|
||||
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||
|
||||
Reference in New Issue
Block a user