mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tokens: define the "$undefined" token kind
* data/skeletons/bison.m4 (b4_symbol_token_kind): Give a definition to $undefined. (b4_token_visible_if): $undefined has an id. * src/output.c (prepare_symbol_definitions): Stop lying: $undefined _is_ a token. * tests/input.at: Adjust.
This commit is contained in:
@@ -456,10 +456,6 @@ m4_define([b4_symbol_if],
|
||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
||||
|
||||
|
||||
# Give the error token a better name.
|
||||
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][ERRCODE]])
|
||||
|
||||
|
||||
# b4_symbol_tag_comment(SYMBOL-NUM)
|
||||
# ---------------------------------
|
||||
# Issue a comment giving the tag of symbol NUM.
|
||||
@@ -541,9 +537,11 @@ m4_define([b4_symbol_map],
|
||||
# Whether NUM denotes a token that has an exported definition (i.e.,
|
||||
# shows in enum yytokentype).
|
||||
m4_define([b4_token_visible_if],
|
||||
[b4_symbol_if([$1], [is_token],
|
||||
[b4_symbol_if([$1], [has_id], [$2], [$3])],
|
||||
[$3])])
|
||||
[m4_case(b4_symbol([$1], [tag]),
|
||||
[$undefined], [$2],
|
||||
[b4_symbol_if([$1], [is_token],
|
||||
[b4_symbol_if([$1], [has_id], [$2], [$3])],
|
||||
[$3])])])
|
||||
|
||||
|
||||
# b4_token_has_definition(NUM)
|
||||
|
||||
@@ -430,6 +430,12 @@ static const b4_int_type_for([$2]) yy$1[[]] =
|
||||
## Token kinds. ##
|
||||
## ------------- ##
|
||||
|
||||
# Because C enums are not scoped, because tokens are exposed in the
|
||||
# header, and because these tokens are common to all the parser, we
|
||||
# need to make sure their names don't collide: use the api.prefix.
|
||||
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][ERRCODE]])
|
||||
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
||||
|
||||
# b4_token_define(TOKEN-NUM)
|
||||
# --------------------------
|
||||
# Output the definition of this token as #define.
|
||||
|
||||
Reference in New Issue
Block a user