mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Define the constructors of symbol_type in b4_symbol_constructor_definitions.
The constructors are called by the make_symbol functions, which a forthcoming patch will move elsewhere. Hence the interest of putting them together. The stack_symbol_type does not need to be moved, it is used only by the parser. * data/lalr1.cc: Move symbol_type and symbol_base_type constructors into... (b4_symbol_constructor_definitions): here. Adjust.
This commit is contained in:
154
data/lalr1.cc
154
data/lalr1.cc
@@ -267,11 +267,86 @@ b4_args(b4_symbol_if([$1], [has_type],
|
||||
])])])
|
||||
|
||||
|
||||
# b4_symbol_constructor_declarations
|
||||
# b4_symbol_constructor_definitions
|
||||
# ----------------------------------
|
||||
# Define the overloaded versions of make_symbol for all the value types.
|
||||
m4_define([b4_symbol_constructor_definitions],
|
||||
[b4_variant_if(
|
||||
[[ // 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_variant_if(
|
||||
[ // Implementation of make_symbol for each symbol type.
|
||||
m4_map([b4_symbol_constructor_definition_], m4_defn([b4_symbol_numbers]))])])
|
||||
|
||||
@@ -948,81 +1023,6 @@ b4_percent_code_get[]dnl
|
||||
| Symbol types. |
|
||||
`---------------*/
|
||||
|
||||
// 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_symbol_constructor_definitions[
|
||||
|
||||
// stack_symbol_type.
|
||||
|
||||
Reference in New Issue
Block a user