mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
c++: replace symbol_number_type with symbol_type_type
* data/skeletons/c++.m4, data/skeletons/glr.cc, * data/skeletons/lalr1.cc: here.
This commit is contained in:
@@ -265,11 +265,8 @@ m4_define([b4_public_types_declare],
|
|||||||
/// (External) token type, as returned by yylex.
|
/// (External) token type, as returned by yylex.
|
||||||
typedef token::yytokentype token_type;
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// Symbol codes.
|
/// (Internal) symbol codes.
|
||||||
]b4_declare_symbol_enum[
|
]b4_declare_symbol_enum[
|
||||||
|
|
||||||
/// Symbol type: an internal symbol number.
|
|
||||||
typedef symbol_type_type symbol_number_type;
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -325,7 +322,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
void clear ()
|
void clear ()
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
// User destructor.
|
// User destructor.
|
||||||
symbol_number_type yytype = this->type_get ();
|
symbol_type_type yytype = this->type_get ();
|
||||||
basic_symbol<Base>& yysym = *this;
|
basic_symbol<Base>& yysym = *this;
|
||||||
(void) yysym;
|
(void) yysym;
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
@@ -387,11 +384,11 @@ 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_number_type type_get () const YY_NOEXCEPT;
|
symbol_type_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// \a YYSYMBOL_YYEMPTY when empty.
|
/// \a YYSYMBOL_YYEMPTY when empty.
|
||||||
symbol_number_type type;
|
symbol_type_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
@@ -511,7 +508,7 @@ m4_define([b4_public_types_define],
|
|||||||
that.clear ();
|
that.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[]b4_parser_class[::symbol_number_type
|
]b4_inline([$1])[]b4_parser_class[::symbol_type_type
|
||||||
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
@@ -531,11 +528,11 @@ m4_define([b4_token_constructor_define], [])
|
|||||||
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
# Define yytranslate_. Sometimes used in the header file ($1=hh),
|
||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[ b4_inline([$1])b4_parser_class[::symbol_number_type
|
[ b4_inline([$1])b4_parser_class[::symbol_type_type
|
||||||
]b4_parser_class[::yytranslate_ (int t)
|
]b4_parser_class[::yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ return static_cast<symbol_number_type> (t);]],
|
[[ return static_cast<symbol_type_type> (t);]],
|
||||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||||
// TOKEN-NUM as returned by yylex.
|
// TOKEN-NUM as returned by yylex.
|
||||||
static
|
static
|
||||||
@@ -549,7 +546,7 @@ m4_define([b4_yytranslate_define],
|
|||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return YYSYMBOL_YYEOF;
|
return YYSYMBOL_YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
return YY_CAST (symbol_number_type, translate_table[t]);
|
return YY_CAST (symbol_type_type, translate_table[t]);
|
||||||
else
|
else
|
||||||
return YYSYMBOL_YYUNDEF;]])[
|
return YYSYMBOL_YYUNDEF;]])[
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ m4_define([b4_yy_symbol_print_define],
|
|||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_number_type yytype,
|
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_type_type yytype,
|
||||||
const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep]b4_locations_if([[,
|
const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep]b4_locations_if([[,
|
||||||
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp]])[]b4_user_formals[)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
`--------------------*/
|
`--------------------*/
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_number_type yytype,
|
]b4_parser_class[::yy_symbol_value_print_ (symbol_type_type yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp]])[)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
@@ -189,7 +189,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_print_ (symbol_number_type yytype,
|
]b4_parser_class[::yy_symbol_print_ (symbol_type_type yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp]])[)
|
||||||
{
|
{
|
||||||
@@ -325,14 +325,14 @@ b4_percent_code_get([[requires]])[
|
|||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_value_print_ (symbol_number_type yytype,
|
virtual void yy_symbol_value_print_ (symbol_type_type yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp]])[);
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
/// \param yyvaluep Its semantic value.]b4_locations_if([[
|
||||||
/// \param yylocationp Its location.]])[
|
/// \param yylocationp Its location.]])[
|
||||||
virtual void yy_symbol_print_ (symbol_number_type yytype,
|
virtual void yy_symbol_print_ (symbol_type_type yytype,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const semantic_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp]])[);
|
||||||
private:
|
private:
|
||||||
@@ -356,7 +356,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]m4_define([b4_declare_symbol_enum],
|
]m4_define([b4_declare_symbol_enum],
|
||||||
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_number_type yysymbol_type_t;
|
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_type_type yysymbol_type_t;
|
||||||
#define YYSYMBOL_YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEMPTY
|
#define YYSYMBOL_YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEMPTY
|
||||||
#define YYSYMBOL_YYERROR ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYERROR
|
#define YYSYMBOL_YYERROR ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYERROR
|
||||||
#define YYSYMBOL_YYEOF ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEOF
|
#define YYSYMBOL_YYEOF ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEOF
|
||||||
|
|||||||
@@ -241,13 +241,13 @@ m4_define([b4_shared_declarations],
|
|||||||
public:
|
public:
|
||||||
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
|
||||||
const symbol_type& lookahead () const { return yyla_; }
|
const symbol_type& lookahead () const { return yyla_; }
|
||||||
symbol_number_type token () const { return yyla_.type_get (); }]b4_locations_if([[
|
symbol_type_type token () const { return yyla_.type_get (); }]b4_locations_if([[
|
||||||
const location_type& location () const { return yyla_.location; }
|
const location_type& location () const { return yyla_.location; }
|
||||||
]])[
|
]])[
|
||||||
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
/// Put in YYARG at most YYARGN of the expected tokens, and return the
|
||||||
/// number of tokens stored in YYARG. If YYARG is null, return the
|
/// number of tokens stored in YYARG. If YYARG is null, return the
|
||||||
/// number of expected tokens (guaranteed to be less than YYNTOKENS).
|
/// number of expected tokens (guaranteed to be less than YYNTOKENS).
|
||||||
int yyexpected_tokens (symbol_number_type yyarg[], int yyargn) const;
|
int yyexpected_tokens (symbol_type_type yyarg[], int yyargn) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ]b4_parser_class[& yyparser_;
|
const ]b4_parser_class[& yyparser_;
|
||||||
@@ -261,10 +261,10 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
/// Check the lookahead yytoken.
|
/// Check the lookahead yytoken.
|
||||||
/// \returns true iff the token will be eventually shifted.
|
/// \returns true iff the token will be eventually shifted.
|
||||||
bool yy_lac_check_ (symbol_number_type yytoken) const;
|
bool yy_lac_check_ (symbol_type_type yytoken) const;
|
||||||
/// Establish the initial context if no initial context currently exists.
|
/// Establish the initial context if no initial context currently exists.
|
||||||
/// \returns true iff the token will be eventually shifted.
|
/// \returns true iff the token will be eventually shifted.
|
||||||
bool yy_lac_establish_ (symbol_number_type yytoken);
|
bool yy_lac_establish_ (symbol_type_type yytoken);
|
||||||
/// Discard any previous initial lookahead context because of event.
|
/// Discard any previous initial lookahead context because of event.
|
||||||
/// \param event the event which caused the lookahead to be discarded.
|
/// \param event the event which caused the lookahead to be discarded.
|
||||||
/// Only used for debbuging output.
|
/// Only used for debbuging output.
|
||||||
@@ -280,7 +280,7 @@ m4_define([b4_shared_declarations],
|
|||||||
[detailed\|verbose], [[
|
[detailed\|verbose], [[
|
||||||
/// The arguments of the error message.
|
/// The arguments of the error message.
|
||||||
int yysyntax_error_arguments_ (const context& yyctx,
|
int yysyntax_error_arguments_ (const context& yyctx,
|
||||||
symbol_number_type yyarg[], int yyargn) const;
|
symbol_type_type yyarg[], int yyargn) const;
|
||||||
|
|
||||||
/// Generate an error message.
|
/// Generate an error message.
|
||||||
/// \param yyctx the context in which the error occurred.
|
/// \param yyctx the context in which the error occurred.
|
||||||
@@ -304,11 +304,11 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Convert a scanner token number \a t to a symbol number.
|
/// Convert a scanner token number \a t to a symbol number.
|
||||||
/// In theory \a t should be a token_type, but character literals
|
/// In theory \a t should be a token_type, but character literals
|
||||||
/// are valid, yet not members of the token_type enum.
|
/// are valid, yet not members of the token_type enum.
|
||||||
static symbol_number_type yytranslate_ (int t);
|
static symbol_type_type yytranslate_ (int t);
|
||||||
]b4_parse_error_bmatch([custom\|detailed], [[
|
]b4_parse_error_bmatch([custom\|detailed], [[
|
||||||
/// The user-facing name of the symbol whose (internal) number is
|
/// The user-facing name of the symbol whose (internal) number is
|
||||||
/// YYSYMBOL. No bounds checking.
|
/// YYSYMBOL. No bounds checking.
|
||||||
static const char *yysymbol_name (symbol_number_type yysymbol);
|
static const char *yysymbol_name (symbol_type_type yysymbol);
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
// Tables.
|
// Tables.
|
||||||
@@ -378,7 +378,7 @@ m4_define([b4_shared_declarations],
|
|||||||
|
|
||||||
/// The (internal) type number (corresponding to \a state).
|
/// The (internal) type number (corresponding to \a state).
|
||||||
/// \a YYSYMBOL_YYEMPTY when empty.
|
/// \a YYSYMBOL_YYEMPTY when empty.
|
||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_type_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The state number used to denote an empty symbol.
|
/// The state number used to denote an empty symbol.
|
||||||
/// We use the initial state, as it does not have a value.
|
/// We use the initial state, as it does not have a value.
|
||||||
@@ -586,7 +586,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/* The user-facing name of the symbol whose (internal) number is
|
/* The user-facing name of the symbol whose (internal) number is
|
||||||
YYSYMBOL. No bounds checking. */
|
YYSYMBOL. No bounds checking. */
|
||||||
const char *
|
const char *
|
||||||
]b4_parser_class[::yysymbol_name (symbol_number_type yysymbol)
|
]b4_parser_class[::yysymbol_name (symbol_type_type yysymbol)
|
||||||
{
|
{
|
||||||
static const char *const yy_sname[] =
|
static const char *const yy_sname[] =
|
||||||
{
|
{
|
||||||
@@ -696,13 +696,13 @@ b4_parse_error_case([verbose], [[
|
|||||||
: state (s)
|
: state (s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_parser_class[::symbol_number_type
|
]b4_parser_class[::symbol_type_type
|
||||||
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
|
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
if (state == empty_state)
|
if (state == empty_state)
|
||||||
return YYSYMBOL_YYEMPTY;
|
return YYSYMBOL_YYEMPTY;
|
||||||
else
|
else
|
||||||
return YY_CAST (symbol_number_type, yystos_[+state]);
|
return YY_CAST (symbol_type_type, yystos_[+state]);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
|
||||||
@@ -773,7 +773,7 @@ b4_parse_error_case([verbose], [[
|
|||||||
{
|
{
|
||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
symbol_number_type yytype = yysym.type_get ();
|
symbol_type_type yytype = yysym.type_get ();
|
||||||
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
|
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
|
||||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
||||||
// below array bounds".
|
// below array bounds".
|
||||||
@@ -1229,7 +1229,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::context::yyexpected_tokens (symbol_number_type yyarg[], int yyargn) const
|
]b4_parser_class[::context::yyexpected_tokens (symbol_type_type yyarg[], int yyargn) const
|
||||||
{
|
{
|
||||||
// Actual number of expected tokens
|
// Actual number of expected tokens
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
@@ -1243,7 +1243,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
{
|
{
|
||||||
symbol_number_type yysym = YY_CAST (symbol_number_type, yyx);
|
symbol_type_type yysym = YY_CAST (symbol_type_type, yyx);
|
||||||
if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF
|
if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF
|
||||||
&& yyparser_.yy_lac_check_ (yysym))
|
&& yyparser_.yy_lac_check_ (yysym))
|
||||||
{
|
{
|
||||||
@@ -1274,7 +1274,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
else if (yycount == yyargn)
|
else if (yycount == yyargn)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
yyarg[yycount++] = YY_CAST (symbol_number_type, yyx);
|
yyarg[yycount++] = YY_CAST (symbol_type_type, yyx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
@@ -1283,7 +1283,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
]])b4_lac_if([[
|
]])b4_lac_if([[
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::yy_lac_check_ (symbol_number_type yytoken) const
|
]b4_parser_class[::yy_lac_check_ (symbol_type_type yytoken) const
|
||||||
{
|
{
|
||||||
// Logically, the yylac_stack's lifetime is confined to this function.
|
// Logically, the yylac_stack's lifetime is confined to this function.
|
||||||
// Clear it, to get rid of potential left-overs from previous call.
|
// Clear it, to get rid of potential left-overs from previous call.
|
||||||
@@ -1361,7 +1361,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
// Establish the initial context if no initial context currently exists.
|
// Establish the initial context if no initial context currently exists.
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::yy_lac_establish_ (symbol_number_type yytoken)
|
]b4_parser_class[::yy_lac_establish_ (symbol_type_type yytoken)
|
||||||
{
|
{
|
||||||
/* Establish the initial context for the current lookahead if no initial
|
/* Establish the initial context for the current lookahead if no initial
|
||||||
context is currently established.
|
context is currently established.
|
||||||
@@ -1423,7 +1423,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::yysyntax_error_arguments_ (const context& yyctx,
|
]b4_parser_class[::yysyntax_error_arguments_ (const context& yyctx,
|
||||||
symbol_number_type yyarg[], int yyargn) const
|
symbol_type_type yyarg[], int yyargn) const
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
@@ -1472,7 +1472,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
// Its maximum.
|
// Its maximum.
|
||||||
enum { YYARGS_MAX = 5 };
|
enum { YYARGS_MAX = 5 };
|
||||||
// Arguments of yyformat.
|
// Arguments of yyformat.
|
||||||
symbol_number_type yyarg[YYARGS_MAX];
|
symbol_type_type yyarg[YYARGS_MAX];
|
||||||
int yycount = yysyntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
|
int yycount = yysyntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
|
||||||
|
|
||||||
char const* yyformat = YY_NULLPTR;
|
char const* yyformat = YY_NULLPTR;
|
||||||
|
|||||||
Reference in New Issue
Block a user