mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 23:33:03 +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:
@@ -146,9 +146,10 @@ m4_define([b4_rhs_location],
|
||||
# b4_symbol(NUM, FIELD)
|
||||
# ---------------------
|
||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
||||
# undefined.
|
||||
# undefined. If FIELD = id, prepend the prefix.
|
||||
m4_define([b4_symbol],
|
||||
[m4_indir([b4_symbol($1, $2)])])
|
||||
[m4_if([$2], [id], [b4_percent_define_get([token.prefix])])dnl
|
||||
m4_indir([b4_symbol($1, $2)])])
|
||||
|
||||
|
||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
||||
|
||||
Reference in New Issue
Block a user