api.value.type: use keyword/brace values

Suggested by Joel E. Denny.
http://lists.gnu.org/archive/html/bison-patches/2013-03/msg00016.html

* data/bison.m4 (b4_percent_define_get_kind): New.
(b4_variant_flag): Check that api.value.type is defined as the 'variant'
keyword value.
* data/c.m4 (_b4_value_type_setup_keyword): New.
(b4_value_type_setup): Use it to simplify reading.
Use b4_define_silent.
Decode api.value.type, including its type.
(b4_value_type_define): Likewise.
* data/c++.m4 (b4_value_type_declare): Adjust the decoding of api.value.type,
taking its kind into account.
* doc/bison.texi: Adjust all the examples to the new syntax.
* NEWS: Ditto.
* tests/types.at: Adjust
This commit is contained in:
Akim Demaille
2013-04-05 14:40:25 +02:00
parent 1fa19a7697
commit 435575cb5e
6 changed files with 105 additions and 51 deletions

View File

@@ -120,14 +120,16 @@ m4_define([b4_token_enums],
m4_define([b4_value_type_declare],
[b4_value_type_setup[]dnl
[ /// Symbol semantic values.
]m4_bmatch(b4_percent_define_get([api.value.type]),
[^%union\|union$],
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
[code],
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
[union\|union-directive],
[[ union semantic_type
{
]b4_user_union_members[
};]],
[^$], [],
[[ typedef ]b4_percent_define_get([api.value.type])[ semantic_type;]])])
]b4_user_union_members[
};]])])dnl
])
# b4_public_types_declare