api.value.type: implement proper support, check, and document

* data/c.m4 (b4_symbol_type_register, b4_type_define_tag)
(b4_symbol_value_union, b4_value_type_setup_union)
(b4_value_type_setup_variant, b4_value_type_setup):
New.
(b4_value_type_define): Use it to set up properly the type.
Handle the various possible values of api.value.type.
* data/c++.m4 (b4_value_type_declare): Likewise.
* data/lalr1.cc (b4_value_type_setup_variant): Redefine.

* tests/types.at: New.
Exercise all the C/C++ skeletons with different types of
api.value.type values.
* tests/local.mk, tests/testsuite.at: Use it.

* doc/bison.texi (%define Summary): Document api.value.type.
* NEWS: Advertise it, together with api.token.constructor.
This commit is contained in:
Akim Demaille
2013-02-08 17:17:33 +01:00
parent dde95ca432
commit 6574576cfb
9 changed files with 463 additions and 25 deletions

View File

@@ -118,15 +118,16 @@ m4_define([b4_token_enums],
# ---------------------
# Declare semantic_type.
m4_define([b4_value_type_declare],
[b4_value_type_setup[]dnl
[ /// Symbol semantic values.
m4_ifdef([b4_union_members],
[ union semantic_type
]m4_bmatch(b4_percent_define_get([api.value.type]),
[^%union\|union$],
[[ union semantic_type
{
b4_user_union_members
};],
[m4_if(b4_tag_seen_flag, 0,
[[ typedef int semantic_type;]],
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
]b4_user_union_members[
};]],
[^$], [],
[[ typedef ]b4_percent_define_get([api.value.type])[ semantic_type;]])])
# b4_public_types_declare