-m4_popdef([b4_at_dollar])dnl
-m4_popdef([b4_dollar_dollar])dnl
-])])
-
-# b4_symbol_constructor_declaration_(SYMBOL-NUMBER)
-# -------------------------------------------------
-# Declare the overloaded version of make_symbol for the (common) type of
-# these SYMBOL-NUMBERS. Use at class-level.
-m4_define([b4_symbol_constructor_declaration_],
-[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
-[ static inline
- symbol_type
- make_[]b4_symbol_([$1], [id]) (dnl
-b4_args(b4_symbol_if([$1], [has_type],
- [const b4_symbol([$1], [type])& v]),
- b4_locations_if([const location_type& l])));
-
-])])])
-
-
-# b4_symbol_constructor_declarations
-# ----------------------------------
-# Declare symbol constructors for all the value types.
-# Use at class-level.
-m4_define([b4_symbol_constructor_declarations],
-[b4_variant_if([
- // Symbol constructors declarations.
-b4_symbol_foreach([b4_symbol_constructor_declaration_])])])
-
-
-
-# b4_symbol_constructor_definition_(SYMBOL-NUMBER)
-# ------------------------------------------------
-# Define symbol constructor for this SYMBOL-NUMBER.
-m4_define([b4_symbol_constructor_definition_],
-[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
-[ b4_parser_class_name::symbol_type
- b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
-b4_args(b4_symbol_if([$1], [has_type],
- [const b4_symbol([$1], [type])& v]),
- b4_locations_if([const location_type& l])))
- {
- return symbol_type (b4_args([yytranslate_ (token::b4_symbol([$1], [id]))],
- b4_symbol_if([$1], [has_type], [v]),
- b4_locations_if([l])));
- }
-
-])])])
-
-
-# b4_symbol_constructor_definitions
-# ----------------------------------
-# Define the overloaded versions of make_symbol for all the value types.
-m4_define([b4_symbol_constructor_definitions],
-[[ // symbol_base_type.
- template <typename Exact>
- ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type ()
- : value()]b4_locations_if([
- , location()])[
- {
- }]b4_locations_if([[
-
- template <typename Exact>
- ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (const location_type& l)
- : value()
- , location(l)
- {
- }]])[
-
- template <typename Exact>
- ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
- [const semantic_type& v],
- b4_locations_if([const location_type& l]))[)
- : value(v)]b4_locations_if([
- , location(l)])[
- {
- }
-
- template <typename Exact>
- const Exact&
- ]b4_parser_class_name[::symbol_base_type<Exact>::self () const
- {
- return static_cast<const Exact&>(*this);
- }
-
- template <typename Exact>
- Exact&
- ]b4_parser_class_name[::symbol_base_type<Exact>::self ()
- {
- return static_cast<Exact&>(*this);
- }
-
- template <typename Exact>
- int
- ]b4_parser_class_name[::symbol_base_type<Exact>::type_get () const
- {
- return self ().type_get_ ();
- }
-
- // symbol_type.
- ]b4_parser_class_name[::symbol_type::symbol_type ()
- : super_type ()
- , type ()
- {
- }
-
- ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
- [int t],
- b4_locations_if([const location_type& l]))[)
- : super_type (]b4_locations_if([l])[)
- , type (t)
- {
- }
-
- ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
- [int t],
- [const semantic_type& v],
- b4_locations_if([const location_type& l]))[)
- : super_type (v]b4_locations_if([, l])[)
- , type (t)
- {
- }
-
- int
- ]b4_parser_class_name[::symbol_type::type_get_ () const
- {
- return type;
- }
-]b4_lex_symbol_if([[
- ]b4_parser_class_name[::token_type
- ]b4_parser_class_name[::symbol_type::token () const
- {
- // YYTOKNUM[NUM] -- (External) token number corresponding to the
- // (internal) symbol number NUM (which must be that of a token). */
- static
- const ]b4_int_type_for([b4_toknum])[
- yytoken_number_[] =
- {
- ]b4_toknum[
- };
- return static_cast<token_type> (yytoken_number_[type]);
- }
-]])[
-
-]b4_variant_if(
-[ // Implementation of make_symbol for each symbol type.
-b4_symbol_foreach([b4_symbol_constructor_definition_])])])
-
-
-# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
-# ------------------------------------------------
-# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
-# YYTYPE.
-m4_define([b4_symbol_variant],
-[m4_pushdef([b4_dollar_dollar],
- [$2.$3< $][3 >(m4_shift3($@))])dnl
- switch ($1)
- {
-b4_type_foreach([b4_type_action_])[]dnl
- default:
- break;
- }
-m4_popdef([b4_dollar_dollar])dnl
-])
-
-
-# _b4_char_sizeof_counter
-# -----------------------
-# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
-m4_define([_b4_char_sizeof_counter],
-[0])
-
-# _b4_char_sizeof_dummy
-# ---------------------
-# At each call return a new C++ identifier.
-m4_define([_b4_char_sizeof_dummy],
-[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
-dummy[]_b4_char_sizeof_counter])
-
-
-# b4_char_sizeof_(SYMBOL-NUM)
-# ---------------------------
-# A comment describing this symbol.
-m4_define([b4_char_sizeof_],
-[ // b4_symbol([$1], [tag])
-])
-
-# b4_char_sizeof(SYMBOL-NUMS)
-# --------------------------
-# To be mapped on the list of type names to produce:
-#
-# char dummy1[sizeof(type_name_1)];
-# char dummy2[sizeof(type_name_2)];
-#
-# for defined type names.
-m4_define([b4_char_sizeof],
-[b4_symbol_if([$1], [has_type],
-[
-m4_map([b4_char_sizeof_], [$@])dnl
- char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};