mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 22:03:02 +00:00
skeletons: introduce "slot"s for symbols
Extracted from d9cf99b6a5, in the master
branch.
* data/skeletons/bison.m4 (b4_symbol_slot): New, with safer semantics
than type and type_tag.
This commit is contained in:
@@ -465,6 +465,19 @@ m4_case([$1],
|
||||
# but are S_YYEMPTY and symbol_kind::S_YYEMPTY in C++.
|
||||
m4_copy([b4_symbol_kind_base], [b4_symbol_kind])
|
||||
|
||||
|
||||
# b4_symbol_slot(NUM)
|
||||
# -------------------
|
||||
# The name of union member that contains the value of these symbols.
|
||||
# Currently, we are messy, this should actually be type_tag, but type_tag
|
||||
# has several meanings.
|
||||
m4_define([b4_symbol_slot],
|
||||
[m4_case(b4_percent_define_get([[api.value.type]]),
|
||||
[union], [b4_symbol([$1], [type_tag])],
|
||||
[variant], [b4_symbol([$1], [type_tag])],
|
||||
[b4_symbol([$1], [type])])])
|
||||
|
||||
|
||||
# b4_symbol(NUM, FIELD)
|
||||
# ---------------------
|
||||
# Fetch FIELD of symbol #NUM (or "orig NUM"). Fail if undefined.
|
||||
@@ -475,6 +488,7 @@ m4_define([b4_symbol],
|
||||
[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($@)])])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user