/// Default constructor.
inline symbol_type ();
+ /// Destructive move, \a s is emptied.
+ inline void move (symbol_type& s);
+
/// Constructor for tokens with semantic value.
inline symbol_type (]b4_join([token_type t],
[const semantic_type& v],
}
inline
+ void
+ ]b4_parser_class_name[::symbol_type::move (symbol_type& s)
+ {
+ ]b4_variant_if([b4_symbol_variant([[s.type]], [value], [build], [s.value])],
+ [value = s.value;])[
+ type = s.type;]b4_locations_if([
+ location = s.location;])[
+ }
+
+ inline
int
]b4_parser_class_name[::symbol_type::type_get_ () const
{
try
{
]b4_token_ctor_if(
-[ yyla = b4_function_call([yylex], [symbol_type],
- m4_ifdef([b4_lex_param], b4_lex_param));],
-[ yyla.type = yytranslate_ (b4_function_call([yylex], [int],
- [b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
+[ symbol_type yylookahead = b4_function_call([yylex], [symbol_type],
+ m4_ifdef([b4_lex_param], b4_lex_param));
+ yyla.move(yylookahead);],
+[ yyla.type = yytranslate_ (b4_function_call([yylex], [int],
+ [b4_api_PREFIX[STYPE*], [&yyla.value]][]dnl
b4_locations_if([, [[location*], [&yyla.location]]])dnl
m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
}
# The needed includes for variants support.
m4_define([b4_variant_includes],
[b4_parse_assert_if([[#include <typeinfo>]])[
+#include <cstdlib> // abort
#ifndef YYASSERT
# include <cassert>
# define YYASSERT assert
other.destroy<T>();
}
+ /// Copy the content of \a other to this.
+ /// Destroys \a other.
+ template <typename T>
+ inline void
+ copy (const variant<S>& other)
+ {
+ build<T> (other.as<T> ());
+ }
+
/// Destroy the stored \a T.
template <typename T>
inline void
tname = YY_NULL;])[
}
+ /// Prohibit blind copies.
+ // private:
+ self_type& operator=(const self_type&)
+ {
+ abort ();
+ }
+
private:
/// A buffer large enough to store any of the semantic values.
/// Long double is chosen as it has the strongest alignment