symbols: stop dealing with YYEMPTY as b4_symbol(-2, ...)

* data/skeletons/bison.m4 (b4_symbol): Redirect `b4_symbol(empty,
...)` to `b4_symbol(-2, ...)`.
Change all uses of the latter to the former.
This commit is contained in:
Akim Demaille
2020-09-29 06:27:31 +02:00
parent a7daa63cb7
commit cd40ec9526
9 changed files with 77 additions and 75 deletions

View File

@@ -480,16 +480,18 @@ m4_define([b4_symbol_slot],
# b4_symbol(NUM, FIELD)
# ---------------------
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
# Fetch FIELD of symbol #NUM (or "orig NUM", or "empty"). Fail if undefined.
#
# If FIELD = id, prepend the token prefix.
m4_define([b4_symbol],
[m4_case([$2],
[id], [b4_symbol_token_kind([$1])],
[kind_base], [b4_symbol_kind_base([$1])],
[kind], [b4_symbol_kind([$1])],
[slot], [b4_symbol_slot([$1])],
[_b4_symbol($@)])])
[m4_if([$1], [empty],
[b4_symbol([-2], [$2])],
[m4_case([$2],
[id], [b4_symbol_token_kind([$1])],
[kind_base], [b4_symbol_kind_base([$1])],
[kind], [b4_symbol_kind([$1])],
[slot], [b4_symbol_slot([$1])],
[_b4_symbol($@)])])])
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)