mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +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:
@@ -241,10 +241,10 @@ m4_define([b4_glr_cc_setup],
|
||||
|
||||
#undef ]b4_symbol(empty, [id])[
|
||||
#define ]b4_symbol(empty, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(empty, [id])[
|
||||
#undef ]b4_symbol(0, [id])[
|
||||
#define ]b4_symbol(0, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(0, [id])[
|
||||
#undef ]b4_symbol(1, [id])[
|
||||
#define ]b4_symbol(1, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(1, [id])[
|
||||
#undef ]b4_symbol(eof, [id])[
|
||||
#define ]b4_symbol(eof, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(eof, [id])[
|
||||
#undef ]b4_symbol(error, [id])[
|
||||
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
||||
|
||||
#ifndef ]b4_api_PREFIX[STYPE
|
||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
||||
@@ -271,8 +271,8 @@ m4_define([b4_undef_symbol_kind],
|
||||
# Remove redirections for glr.c.
|
||||
m4_define([b4_glr_cc_cleanup],
|
||||
[[#undef ]b4_symbol(empty, [id])[
|
||||
#undef ]b4_symbol(0, [id])[
|
||||
#undef ]b4_symbol(1, [id])[
|
||||
#undef ]b4_symbol(eof, [id])[
|
||||
#undef ]b4_symbol(error, [id])[
|
||||
|
||||
]b4_undef_symbol_kind(-2)dnl
|
||||
b4_symbol_foreach([b4_undef_symbol_kind])dnl
|
||||
|
||||
Reference in New Issue
Block a user