mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
glr2.cc: introduse b4_glr2_cc_if
* data/skeletons/bison.m4 (b4_glr2_cc_if): Intro. * data/skeletons/c++.m4: use.
This commit is contained in:
@@ -409,8 +409,12 @@ b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
|||||||
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
# b4_glr_cc_if([IF-TRUE], [IF-FALSE])
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
m4_define([b4_glr_cc_if],
|
m4_define([b4_glr_cc_if],
|
||||||
[m4_if(m4_bregexp(b4_skeleton, [^"glr.cc"$]), [0], $@)])
|
[m4_if(b4_skeleton, ["glr.cc"], $@)])
|
||||||
|
|
||||||
|
# b4_glr2_cc_if([IF-TRUE], [IF-FALSE])
|
||||||
|
# ------------------------------------
|
||||||
|
m4_define([b4_glr2_cc_if],
|
||||||
|
[m4_if(b4_skeleton, ["glr2.cc"], $@)])
|
||||||
|
|
||||||
## --------- ##
|
## --------- ##
|
||||||
## Symbols. ##
|
## Symbols. ##
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ m4_define([b4_value_type_declare],
|
|||||||
# Define the public types: token, semantic value, location, and so forth.
|
# 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.
|
# Depending on %define token_lex, may be output in the header or source file.
|
||||||
m4_define([b4_public_types_declare],
|
m4_define([b4_public_types_declare],
|
||||||
[m4_if(b4_skeleton, ["glr2.cc"],
|
[b4_glr2_cc_if(
|
||||||
[b4_value_type_declare],
|
[b4_value_type_declare],
|
||||||
[[#ifdef ]b4_api_PREFIX[STYPE
|
[[#ifdef ]b4_api_PREFIX[STYPE
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
@@ -265,13 +265,13 @@ m4_define([b4_public_types_declare],
|
|||||||
/// Token kinds.
|
/// Token kinds.
|
||||||
struct token
|
struct token
|
||||||
{
|
{
|
||||||
]b4_token_enums[]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
]b4_token_enums[]b4_glr2_cc_if([], [[
|
||||||
/// Backward compatibility alias (Bison 3.6).
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
typedef token_kind_type yytokentype;]])[
|
typedef token_kind_type yytokentype;]])[
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Token kind, as returned by yylex.
|
/// Token kind, as returned by yylex.
|
||||||
typedef token::token_kind_type token_kind_type;]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
typedef token::token_kind_type token_kind_type;]b4_glr2_cc_if([], [[
|
||||||
|
|
||||||
/// Backward compatibility alias (Bison 3.6).
|
/// Backward compatibility alias (Bison 3.6).
|
||||||
typedef token_kind_type token_type;]])[
|
typedef token_kind_type token_type;]])[
|
||||||
@@ -399,7 +399,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
std::string name () const YY_NOEXCEPT
|
std::string name () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return ]b4_parser_class[::symbol_name (this->kind ());
|
return ]b4_parser_class[::symbol_name (this->kind ());
|
||||||
}]])[]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
}]])[]b4_glr2_cc_if([], [[
|
||||||
|
|
||||||
/// Backward compatibility (Bison 3.6).
|
/// Backward compatibility (Bison 3.6).
|
||||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
||||||
@@ -456,7 +456,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
symbol_kind_type kind () const YY_NOEXCEPT;]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
symbol_kind_type kind () const YY_NOEXCEPT;]b4_glr2_cc_if([], [[
|
||||||
|
|
||||||
/// Backward compatibility (Bison 3.6).
|
/// Backward compatibility (Bison 3.6).
|
||||||
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
symbol_kind_type type_get () const YY_NOEXCEPT;]])[
|
||||||
@@ -464,7 +464,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// The symbol kind.
|
/// The symbol kind.
|
||||||
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
||||||
symbol_kind_type kind_;
|
symbol_kind_type kind_;
|
||||||
};]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
};]b4_glr2_cc_if([], [[
|
||||||
|
|
||||||
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
/// Backward compatibility for a private implementation detail (Bison 3.6).
|
||||||
typedef by_kind by_type;]])[
|
typedef by_kind by_type;]])[
|
||||||
@@ -522,7 +522,7 @@ m4_define([b4_public_types_define],
|
|||||||
(void) v;
|
(void) v;
|
||||||
]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
]b4_symbol_variant([this->kind ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||||
|
|
||||||
]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
]b4_glr2_cc_if([], [[
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::symbol_kind_type
|
]b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::basic_symbol<Base>::type_get () const YY_NOEXCEPT
|
||||||
@@ -599,7 +599,7 @@ m4_define([b4_public_types_define],
|
|||||||
return kind_;
|
return kind_;
|
||||||
}
|
}
|
||||||
|
|
||||||
]m4_if(b4_skeleton, ["glr2.cc"], [], [[
|
]b4_glr2_cc_if([], [[
|
||||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user