[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
-# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
-# -----------------------------------------------------
+# b4_token_enums
+# --------------
# Output the definition of the tokens as enums.
m4_define([b4_token_enums],
-[/* Tokens. */
- enum yytokentype {
-m4_map_sep([ b4_token_enum], [,
-],
- [$@])
- };
+[[enum yytokentype
+ {
+ ]m4_join([,
+ ],
+ b4_symbol_map([b4_token_enum]))[
+ };]dnl
])
};],
[m4_if(b4_tag_seen_flag, 0,
[[ typedef int semantic_type;]],
-[[ typedef YYSTYPE semantic_type;]])])])
+[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
# b4_public_types_declare
# Define the public types: token, semantic value, location, and so forth.
# Depending on %define token_lex, may be output in the header or source file.
m4_define([b4_public_types_declare],
-[[#ifndef YYSTYPE
+[[#ifndef ]b4_api_PREFIX[STYPE
]b4_semantic_type_declare[
#else
- typedef YYSTYPE semantic_type;
+ typedef ]b4_api_PREFIX[STYPE semantic_type;
#endif]b4_locations_if([
/// Symbol locations.
typedef b4_percent_define_get([[location_type]],
/// Tokens.
struct token
{
- ]b4_token_enums(b4_tokens)[
+ ]b4_token_enums[
};
/// Token type.
inline symbol_base_type ();
/// Constructor.]b4_locations_if([
- inline symbol_base_type (const location_type& l)])[;
- inline symbol_base_type (]b4_args(
+ inline symbol_base_type (const location_type& l);])[
+ inline symbol_base_type (]b4_join(
[const semantic_type& v],
b4_locations_if([const location_type& l]))[);
inline symbol_type ();
/// Constructor for tokens with semantic value.
- inline symbol_type (]b4_args([token_type t],
+ inline symbol_type (]b4_join([token_type t],
[const semantic_type& v],
b4_locations_if([const location_type& l]))[);
/// Constructor for valueless tokens.
- inline symbol_type (]b4_args([token_type t],
+ inline symbol_type (]b4_join([token_type t],
b4_locations_if([const location_type& l]))[);
/// The symbol type.
template <typename Exact>
inline
- ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
+ ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_join(
[const semantic_type& v],
b4_locations_if([const location_type& l]))[)
: value(v)]b4_locations_if([
}
inline
- ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
+ ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join(
[token_type t],
b4_locations_if([const location_type& l]))[)
: super_type (]b4_locations_if([l])[)
}
inline
- ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
+ ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join(
[token_type t],
[const semantic_type& v],
b4_locations_if([const location_type& l]))[)
], [$@])])
m4_define([b4_cc_var_decl],
[ $1;])
+
+
+## ---------##
+## Values. ##
+## ---------##
+
+# b4_yylloc_default_define
+# ------------------------
+# Define YYLLOC_DEFAULT.
+m4_define([b4_yylloc_default_define],
+[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+# ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (N) \
+ { \
+ (Current).begin = YYRHSLOC (Rhs, 1).begin; \
+ (Current).end = YYRHSLOC (Rhs, N).end; \
+ } \
+ else \
+ { \
+ (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
+ } \
+ while (/*CONSTCOND*/ false)
+# endif
+]])