mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 01:33:03 +00:00
style: avoid explicit symbol numbers
This should have been part of commit "symbols: stop dealing with YYEMPTY
as b4_symbol(-2, ...)" (cd40ec9526).
Give names to all the special symbols: "eof", "error" and "undef".
* data/skeletons/bison.m4 (b4_symbol): Let `b4_symbol(eof, ...)` mean
`b4_symbol(0, ...)`, `b4_symbol(error, ...)` mean `b4_symbol(1, ...)`,
and , `b4_symbol(undef, ...)` mean `b4_symbol(2, ...)`..
* data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/glr.cc,
* data/skeletons/glr2.cc, data/skeletons/lalr1.cc,
* data/skeletons/lalr1.d, data/skeletons/lalr1.java,
* data/skeletons/yacc.c:
Prefer symbols to numbers.
This commit is contained in:
@@ -484,8 +484,10 @@ m4_define([b4_symbol_slot],
|
||||
#
|
||||
# If FIELD = id, prepend the token prefix.
|
||||
m4_define([b4_symbol],
|
||||
[m4_if([$1], [empty],
|
||||
[b4_symbol([-2], [$2])],
|
||||
[m4_if([$1], [empty], [b4_symbol([-2], [$2])],
|
||||
[$1], [eof], [b4_symbol([0], [$2])],
|
||||
[$1], [error], [b4_symbol([1], [$2])],
|
||||
[$1], [undef], [b4_symbol([2], [$2])],
|
||||
[m4_case([$2],
|
||||
[id], [b4_symbol_token_kind([$1])],
|
||||
[kind_base], [b4_symbol_kind_base([$1])],
|
||||
|
||||
Reference in New Issue
Block a user