]b4_token_enums[
};
- /// Token type.
+ /// (External) token type, as returned by yylex.
typedef token::yytokentype token_type;
+ /// Internal symbol number.
+ typedef int symbol_number_type;
+
+ /// Internal symbol number for tokens (subsumed by symbol_number_type).
+ typedef ]b4_int_type_for([b4_translate])[ token_number_type;
+
/// A complete symbol.
///
/// Expects its Base type to provide access to the symbol type
basic_symbol (const basic_symbol& other);
/// Constructor for valueless symbols.
- basic_symbol (typename Base::value_type t]b4_locations_if([,
+ basic_symbol (typename Base::kind_type t]b4_locations_if([,
const location_type& l])[);
/// Constructor for symbols with semantic value.
- basic_symbol (typename Base::value_type t,
+ basic_symbol (typename Base::kind_type t,
const semantic_type& v]b4_locations_if([,
const location_type& l])[);
/// Copy constructor.
by_type (const by_type& other);
- /// Constructor.
- ///
- by_type (token_type t);
+ /// The symbol type as needed by the constructor.
+ typedef token_type kind_type;
- /// Steal the type of \a that.
- void move (by_type& that);
+ /// Constructor from (external) token numbers.
+ by_type (kind_type t);
- /// The symbol type.
- ///
- /// -1 when this symbol is empty.
- int type;
+ /// Steal the symbol type from \a that.
+ void move (by_type& that);
- /// The type (corresponding to \a type).
+ /// The (internal) type number (corresponding to \a type).
/// -1 when this symbol is empty.
- int type_get () const;
+ symbol_number_type type_get () const;
/// The token.
token_type token () const;
- /// The type used to store the symbol type.
- typedef token_type value_type;
+ enum { empty = 0 };
+
+ /// The symbol type.
+ ///
+ /// -1 when this symbol is empty.
+ token_number_type type;
};
/// "External" symbols: returned by the scanner.
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
- [typename Base::value_type t],
+ [typename Base::kind_type t],
[const semantic_type& v],
b4_locations_if([const location_type& l]))[)
: Base (t)
template <typename Base>
inline
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
- [typename Base::value_type t],
+ [typename Base::kind_type t],
b4_locations_if([const location_type& l]))[)
: Base (t)
, value ()]b4_locations_if([
]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
{]b4_variant_if([[
// User destructor.
- int yytype = this->type_get ();
+ symbol_number_type yytype = this->type_get ();
switch (yytype)
{
]b4_symbol_foreach([b4_symbol_destructor])dnl
// by_type.
inline
]b4_parser_class_name[::by_type::by_type ()
- : type (-1)
+ : type (empty)
{}
inline
]b4_parser_class_name[::by_type::move (by_type& that)
{
type = that.type;
- that.type = -1;
+ that.type = empty;
}
inline