[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/8] c, c++: rename yysymbol_type_t as yysymbol_kind_t
From: |
Akim Demaille |
Subject: |
[PATCH 1/8] c, c++: rename yysymbol_type_t as yysymbol_kind_t |
Date: |
Sun, 5 Apr 2020 16:29:56 +0200 |
See https://lists.gnu.org/r/bison-patches/2020-04/msg00031.html
* data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/yacc.c
(yysymbol_type_t): Rename as...
(yysymbol_kind_t): this.
Adjust dependencies.
* data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/lalr1.cc
(symbol_type_type): Rename as...
(symbol_kind_type): this.
Adjust dependencies.
---
NEWS | 4 +--
data/skeletons/c++.m4 | 16 +++++------
data/skeletons/c.m4 | 10 +++----
data/skeletons/glr.c | 50 ++++++++++++++++-----------------
data/skeletons/glr.cc | 14 ++++-----
data/skeletons/lalr1.cc | 38 ++++++++++++-------------
data/skeletons/yacc.c | 38 ++++++++++++-------------
examples/c/bistromathic/parse.y | 4 +--
src/parse-gram.c | 42 +++++++++++++--------------
src/parse-gram.h | 2 +-
src/parse-gram.y | 4 +--
tests/local.at | 8 +++---
12 files changed, 115 insertions(+), 115 deletions(-)
diff --git a/NEWS b/NEWS
index d3017c8a..c29ffa49 100644
--- a/NEWS
+++ b/NEWS
@@ -45,7 +45,7 @@ GNU Bison NEWS
// Report the tokens expected at this point.
{
enum { TOKENMAX = 10 };
- yysymbol_type_t expected[TOKENMAX];
+ yysymbol_kind_t expected[TOKENMAX];
int n = yyexpected_tokens (ctx, expected, TOKENMAX);
if (n < 0)
// Forward errors to yyparse.
@@ -57,7 +57,7 @@ GNU Bison NEWS
}
// Report the unexpected token.
{
- yysymbol_type_t lookahead = yypcontext_token (ctx);
+ yysymbol_kind_t lookahead = yypcontext_token (ctx);
if (lookahead != YYSYMBOL_YYEMPTY)
fprintf (stderr, " before %s", yysymbol_name (lookahead));
}
diff --git a/data/skeletons/c++.m4 b/data/skeletons/c++.m4
index b27e762d..720977b0 100644
--- a/data/skeletons/c++.m4
+++ b/data/skeletons/c++.m4
@@ -188,7 +188,7 @@ m4_define([b4_token_enums],
# Defining YYEMPTY here is important: it forces the compiler
# to use a signed type, which matters for yytoken.
m4_define([b4_declare_symbol_enum],
-[[enum symbol_type_type
+[[enum symbol_kind_type
{
]m4_join([,
],
@@ -322,7 +322,7 @@ m4_define([b4_symbol_type_define],
void clear ()
{]b4_variant_if([[
// User destructor.
- symbol_type_type yytype = this->type_get ();
+ symbol_kind_type yytype = this->type_get ();
basic_symbol<Base>& yysym = *this;
(void) yysym;
switch (yytype)
@@ -384,11 +384,11 @@ m4_define([b4_symbol_type_define],
/// The (internal) type number (corresponding to \a type).
/// \a empty when empty.
- symbol_type_type type_get () const YY_NOEXCEPT;
+ symbol_kind_type type_get () const YY_NOEXCEPT;
/// The symbol type.
/// \a YYSYMBOL_YYEMPTY when empty.
- symbol_type_type type;
+ symbol_kind_type type;
};
/// "External" symbols: returned by the scanner.
@@ -508,7 +508,7 @@ m4_define([b4_public_types_define],
that.clear ();
}
- ]b4_inline([$1])[]b4_parser_class[::symbol_type_type
+ ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
]b4_parser_class[::by_type::type_get () const YY_NOEXCEPT
{
return type;
@@ -528,11 +528,11 @@ m4_define([b4_token_constructor_define], [])
# Define yytranslate_. Sometimes used in the header file ($1=hh),
# sometimes in the cc file.
m4_define([b4_yytranslate_define],
-[ b4_inline([$1])b4_parser_class[::symbol_type_type
+[ b4_inline([$1])b4_parser_class[::symbol_kind_type
]b4_parser_class[::yytranslate_ (int t)
{
]b4_api_token_raw_if(
-[[ return static_cast<symbol_type_type> (t);]],
+[[ return static_cast<symbol_kind_type> (t);]],
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
// TOKEN-NUM as returned by yylex.
static
@@ -546,7 +546,7 @@ m4_define([b4_yytranslate_define],
if (t <= 0)
return YYSYMBOL_YYEOF;
else if (t <= user_token_number_max_)
- return YY_CAST (symbol_type_type, translate_table[t]);
+ return YY_CAST (symbol_kind_type, translate_table[t]);
else
return YYSYMBOL_YYUNDEF;]])[
}
diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4
index 37891363..2c134365 100644
--- a/data/skeletons/c.m4
+++ b/data/skeletons/c.m4
@@ -508,14 +508,14 @@ m4_define([b4_symbol_enum],
# to use a signed type, which matters for yytoken.
m4_define([b4_declare_symbol_enum],
[[/* Symbol type. */
-enum yysymbol_type_t
+enum yysymbol_kind_t
{
]m4_join([,
],
]b4_symbol_sid([-2])[ = -2,
b4_symbol_map([b4_symbol_enum]))[
};
-typedef enum yysymbol_type_t yysymbol_type_t;
+typedef enum yysymbol_kind_t yysymbol_kind_t;
]])])
@@ -620,7 +620,7 @@ m4_define_default([b4_yydestruct_define],
static void
yydestruct (const char *yymsg,
- yysymbol_type_t yytype, YYSTYPE *yyvaluep]b4_locations_if(dnl
+ yysymbol_kind_t yytype, YYSTYPE *yyvaluep]b4_locations_if(dnl
[[, YYLTYPE *yylocationp]])[]b4_user_formals[)
{
]b4_parse_param_use([yyvaluep], [yylocationp])dnl
@@ -646,7 +646,7 @@ m4_define_default([b4_yy_symbol_print_define],
static void
yy_symbol_value_print (FILE *yyo,
- yysymbol_type_t yytype, YYSTYPE const * const
yyvaluep]b4_locations_if(dnl
+ yysymbol_kind_t yytype, YYSTYPE const * const
yyvaluep]b4_locations_if(dnl
[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
{
FILE *yyoutput = yyo;
@@ -674,7 +674,7 @@ b4_percent_code_get([[post-printer]])dnl
static void
yy_symbol_print (FILE *yyo,
- yysymbol_type_t yytype, YYSTYPE const * const
yyvaluep]b4_locations_if(dnl
+ yysymbol_kind_t yytype, YYSTYPE const * const
yyvaluep]b4_locations_if(dnl
[[, YYLTYPE const * const yylocationp]])[]b4_user_formals[)
{
YYFPRINTF (yyo, "%s %s (",
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 9a2c0910..8add28fb 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -337,10 +337,10 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
]b4_api_token_raw_if(dnl
-[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_type_t, YYX)]],
+[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]],
[[#define YYTRANSLATE(YYX) \
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
- ? YY_CAST (yysymbol_type_t, yytranslate[YYX]) \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
: YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
@@ -594,16 +594,16 @@ yyMemoryExhausted (yyGLRStack* yystackp)
}
/** Accessing symbol of state YYSTATE. */
-static inline yysymbol_type_t
+static inline yysymbol_kind_t
yy_accessing_symbol (yy_state_t yystate)
{
- return YY_CAST (yysymbol_type_t, yystos[yystate]);
+ return YY_CAST (yysymbol_kind_t, yystos[yystate]);
}
#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG ||
]b4_token_table_flag], [[1]])[
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
-static const char *yysymbol_name (yysymbol_type_t yysymbol)
YY_ATTRIBUTE_UNUSED;
+static const char *yysymbol_name (yysymbol_kind_t yysymbol)
YY_ATTRIBUTE_UNUSED;
]b4_parse_error_bmatch([simple\|verbose],
[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
@@ -614,12 +614,12 @@ static const char *const yytname[] =
};
static const char *
-yysymbol_name (yysymbol_type_t yysymbol)
+yysymbol_name (yysymbol_kind_t yysymbol)
{
return yytname[yysymbol];
}]],
[[static const char *
-yysymbol_name (yysymbol_type_t yysymbol)
+yysymbol_name (yysymbol_kind_t yysymbol)
{
static const char *const yy_sname[] =
{
@@ -805,10 +805,10 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
]m4_define([b4_yygetToken_call],
[[yygetToken (&yychar][]b4_pure_if([, yystackp])[]b4_user_args[)]])[
/** If yychar is empty, fetch the next token. */
-static inline yysymbol_type_t
+static inline yysymbol_kind_t
yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack*
yystackp])[]b4_user_formals[)
{
- yysymbol_type_t yytoken;
+ yysymbol_kind_t yytoken;
]b4_parse_param_use()dnl
[ if (*yycharp == YYEMPTY)
{
@@ -994,10 +994,10 @@ yydestroyGLRState (char const *yymsg, yyGLRState
*yys]b4_user_formals[)
}
/** Left-hand-side symbol for rule #YYRULE. */
-static inline yysymbol_type_t
+static inline yysymbol_kind_t
yylhsNonterm (yyRuleNum yyrule)
{
- return YY_CAST (yysymbol_type_t, yyr1[yyrule]);
+ return YY_CAST (yysymbol_kind_t, yyr1[yyrule]);
}
#define yypact_value_is_default(Yyn) \
@@ -1030,7 +1030,7 @@ yydefaultAction (yy_state_t yystate)
* of conflicting reductions.
*/
static inline int
-yygetLRActions (yy_state_t yystate, yysymbol_type_t yytoken, const short**
yyconflicts)
+yygetLRActions (yy_state_t yystate, yysymbol_kind_t yytoken, const short**
yyconflicts)
{
int yyindex = yypact[yystate] + yytoken;
if (yyisDefaultedState (yystate)
@@ -1056,7 +1056,7 @@ yygetLRActions (yy_state_t yystate, yysymbol_type_t
yytoken, const short** yycon
* \param yysym the nonterminal to push on the stack
*/
static inline yy_state_t
-yyLRgotoState (yy_state_t yystate, yysymbol_type_t yysym)
+yyLRgotoState (yy_state_t yystate, yysymbol_kind_t yysym)
{
int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
@@ -2027,7 +2027,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
}
else
{
- yysymbol_type_t yytoken = ]b4_yygetToken_call[;
+ yysymbol_kind_t yytoken = ]b4_yygetToken_call[;
const short* yyconflicts;
const int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
@@ -2090,7 +2090,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
be less than YYNTOKENS). */
static int
yyexpected_tokens (const yyGLRStack* yystackp,
- yysymbol_type_t yyarg[], int yyargn)
+ yysymbol_kind_t yyarg[], int yyargn)
{
/* Actual size of YYARG. */
int yycount = 0;
@@ -2114,7 +2114,7 @@ yyexpected_tokens (const yyGLRStack* yystackp,
else if (yycount == yyargn)
return 0;
else
- yyarg[yycount++] = YY_CAST (yysymbol_type_t, yyx);
+ yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
}
}
return yycount;
@@ -2128,14 +2128,14 @@ static int
yyreport_syntax_error (const yyGLRStack* yystackp]b4_user_formals[);
/* The token type of the lookahead of this context. */
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yyGLRStack *yystackp)
{
YYUSE (yystackp);
- yysymbol_type_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE
(yychar);
+ yysymbol_kind_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE
(yychar);
return yytoken;
}
@@ -2152,9 +2152,9 @@ yypcontext_location (const yyGLRStack *yystackp)
[detailed\|verbose],
[[static int
yy_syntax_error_arguments (const yyGLRStack* yystackp,
- yysymbol_type_t yyarg[], int yyargn)
+ yysymbol_kind_t yyarg[], int yyargn)
{
- yysymbol_type_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE
(yychar);
+ yysymbol_kind_t yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE
(yychar);
/* Actual size of YYARG. */
int yycount = 0;
/* There are many possibilities here to consider:
@@ -2219,7 +2219,7 @@ yyreportSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat: reported tokens (one for the "unexpected",
one per "expected"). */
- yysymbol_type_t yyarg[YYARGS_MAX];
+ yysymbol_kind_t yyarg[YYARGS_MAX];
/* Cumulated lengths of YYARG. */
ptrdiff_t yysize = 0;
@@ -2307,7 +2307,7 @@ yyrecoverSyntaxError (yyGLRStack*
yystackp]b4_user_formals[)
reductions. Skip tokens until we can proceed. */
while (yytrue)
{
- yysymbol_type_t yytoken;
+ yysymbol_kind_t yytoken;
int yyj;
if (yychar == YYEOF)
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
@@ -2465,7 +2465,7 @@ b4_dollar_popdef])[]dnl
}
else
{
- yysymbol_type_t yytoken = ]b4_yygetToken_call;[
+ yysymbol_kind_t yytoken = ]b4_yygetToken_call;[
const short* yyconflicts;
int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
if (*yyconflicts != 0)
@@ -2495,7 +2495,7 @@ b4_dollar_popdef])[]dnl
while (yytrue)
{
- yysymbol_type_t yytoken_to_shift;
+ yysymbol_kind_t yytoken_to_shift;
ptrdiff_t yys;
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc
index 9ba52db0..88cbf702 100644
--- a/data/skeletons/glr.cc
+++ b/data/skeletons/glr.cc
@@ -69,7 +69,7 @@ m4_defn([b4_parse_param]))],
# b4_declare_symbol_enum
# ----------------------
m4_append([b4_declare_symbol_enum],
-[[typedef symbol_type_type yysymbol_type_t;
+[[typedef symbol_kind_type yysymbol_kind_t;
]])
@@ -83,7 +83,7 @@ m4_define([b4_yy_symbol_print_define],
`--------------------*/
static void
-yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_type_type
yytype,
+yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type
yytype,
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[)
{
@@ -175,7 +175,7 @@ m4_pushdef([b4_parse_param],
m4_defn([b4_parse_param_orig]))dnl
`--------------------*/
void
- ]b4_parser_class[::yy_symbol_value_print_ (symbol_type_type yytype,
+ ]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yytype,
const semantic_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[)
{]b4_locations_if([[
@@ -189,7 +189,7 @@ m4_pushdef([b4_parse_param],
m4_defn([b4_parse_param_orig]))dnl
void
- ]b4_parser_class[::yy_symbol_print_ (symbol_type_type yytype,
+ ]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yytype,
const semantic_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[)
{
@@ -325,14 +325,14 @@ b4_percent_code_get([[requires]])[
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.]b4_locations_if([[
/// \param yylocationp Its location.]])[
- virtual void yy_symbol_value_print_ (symbol_type_type yytype,
+ virtual void yy_symbol_value_print_ (symbol_kind_type yytype,
const semantic_type*
yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[);
/// \brief Report a symbol on the debug stream.
/// \param yytype The token type.
/// \param yyvaluep Its semantic value.]b4_locations_if([[
/// \param yylocationp Its location.]])[
- virtual void yy_symbol_print_ (symbol_type_type yytype,
+ virtual void yy_symbol_print_ (symbol_kind_type yytype,
const semantic_type*
yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[);
private:
@@ -356,7 +356,7 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
]b4_namespace_close[
]m4_define([b4_declare_symbol_enum],
-[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_type_type
yysymbol_type_t;
+[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type
yysymbol_kind_t;
#define YYSYMBOL_YYEMPTY
]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEMPTY
#define YYSYMBOL_YYERROR
]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYERROR
#define YYSYMBOL_YYEOF ]b4_namespace_ref[::]b4_parser_class[::YYSYMBOL_YYEOF
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index ca4ac9cb..926db09d 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -241,13 +241,13 @@ m4_define([b4_shared_declarations],
public:
context (const ]b4_parser_class[& yyparser, const symbol_type& yyla);
const symbol_type& lookahead () const { return yyla_; }
- symbol_type_type token () const { return yyla_.type_get ();
}]b4_locations_if([[
+ symbol_kind_type token () const { return yyla_.type_get ();
}]b4_locations_if([[
const location_type& location () const { return yyla_.location; }
]])[
/// 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 expected tokens (guaranteed to be less than YYNTOKENS).
- int yyexpected_tokens (symbol_type_type yyarg[], int yyargn) const;
+ int yyexpected_tokens (symbol_kind_type yyarg[], int yyargn) const;
private:
const ]b4_parser_class[& yyparser_;
@@ -261,10 +261,10 @@ m4_define([b4_shared_declarations],
/// Check the lookahead yytoken.
/// \returns true iff the token will be eventually shifted.
- bool yy_lac_check_ (symbol_type_type yytoken) const;
+ bool yy_lac_check_ (symbol_kind_type yytoken) const;
/// Establish the initial context if no initial context currently exists.
/// \returns true iff the token will be eventually shifted.
- bool yy_lac_establish_ (symbol_type_type yytoken);
+ bool yy_lac_establish_ (symbol_kind_type yytoken);
/// Discard any previous initial lookahead context because of event.
/// \param event the event which caused the lookahead to be discarded.
/// Only used for debbuging output.
@@ -280,7 +280,7 @@ m4_define([b4_shared_declarations],
[detailed\|verbose], [[
/// The arguments of the error message.
int yy_syntax_error_arguments_ (const context& yyctx,
- symbol_type_type yyarg[], int yyargn)
const;
+ symbol_kind_type yyarg[], int yyargn)
const;
/// Generate an error message.
/// \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.
/// In theory \a t should be a token_type, but character literals
/// are valid, yet not members of the token_type enum.
- static symbol_type_type yytranslate_ (int t);
+ static symbol_kind_type yytranslate_ (int t);
]b4_parse_error_bmatch([custom\|detailed], [[
/// The user-facing name of the symbol whose (internal) number is
/// YYSYMBOL. No bounds checking.
- static const char *yysymbol_name (symbol_type_type yysymbol);
+ static const char *yysymbol_name (symbol_kind_type yysymbol);
]])[
// Tables.
@@ -378,7 +378,7 @@ m4_define([b4_shared_declarations],
/// The (internal) type number (corresponding to \a state).
/// \a YYSYMBOL_YYEMPTY when empty.
- symbol_type_type type_get () const YY_NOEXCEPT;
+ symbol_kind_type type_get () const YY_NOEXCEPT;
/// The state number used to denote an empty symbol.
/// 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
YYSYMBOL. No bounds checking. */
const char *
- ]b4_parser_class[::yysymbol_name (symbol_type_type yysymbol)
+ ]b4_parser_class[::yysymbol_name (symbol_kind_type yysymbol)
{
static const char *const yy_sname[] =
{
@@ -696,13 +696,13 @@ b4_parse_error_case([verbose], [[
: state (s)
{}
- ]b4_parser_class[::symbol_type_type
+ ]b4_parser_class[::symbol_kind_type
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
{
if (state == empty_state)
return YYSYMBOL_YYEMPTY;
else
- return YY_CAST (symbol_type_type, yystos_[+state]);
+ return YY_CAST (symbol_kind_type, yystos_[+state]);
}
]b4_parser_class[::stack_symbol_type::stack_symbol_type ()
@@ -773,7 +773,7 @@ b4_parse_error_case([verbose], [[
{
std::ostream& yyoutput = yyo;
YYUSE (yyoutput);
- symbol_type_type yytype = yysym.type_get ();
+ symbol_kind_type yytype = yysym.type_get ();
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ *
100 + __GNUC_MINOR__ <= 408
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
// below array bounds".
@@ -1229,7 +1229,7 @@ b4_dollar_popdef])[]dnl
{}
int
- ]b4_parser_class[::context::yyexpected_tokens (symbol_type_type yyarg[], int
yyargn) const
+ ]b4_parser_class[::context::yyexpected_tokens (symbol_kind_type yyarg[], int
yyargn) const
{
// Actual number of expected tokens
int yycount = 0;
@@ -1243,7 +1243,7 @@ b4_dollar_popdef])[]dnl
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
{
- symbol_type_type yysym = YY_CAST (symbol_type_type, yyx);
+ symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF
&& yyparser_.yy_lac_check_ (yysym))
{
@@ -1274,7 +1274,7 @@ b4_dollar_popdef])[]dnl
else if (yycount == yyargn)
return 0;
else
- yyarg[yycount++] = YY_CAST (symbol_type_type, yyx);
+ yyarg[yycount++] = YY_CAST (symbol_kind_type, yyx);
}
}
]])[
@@ -1283,7 +1283,7 @@ b4_dollar_popdef])[]dnl
]])b4_lac_if([[
bool
- ]b4_parser_class[::yy_lac_check_ (symbol_type_type yytoken) const
+ ]b4_parser_class[::yy_lac_check_ (symbol_kind_type yytoken) const
{
// Logically, the yylac_stack's lifetime is confined to this function.
// 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.
bool
- ]b4_parser_class[::yy_lac_establish_ (symbol_type_type yytoken)
+ ]b4_parser_class[::yy_lac_establish_ (symbol_kind_type yytoken)
{
/* Establish the initial context for the current lookahead if no initial
context is currently established.
@@ -1423,7 +1423,7 @@ b4_dollar_popdef])[]dnl
int
]b4_parser_class[::yy_syntax_error_arguments_ (const context& yyctx,
- symbol_type_type yyarg[], int
yyargn) const
+ symbol_kind_type yyarg[], int
yyargn) const
{
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
@@ -1472,7 +1472,7 @@ b4_dollar_popdef])[]dnl
// Its maximum.
enum { YYARGS_MAX = 5 };
// Arguments of yyformat.
- symbol_type_type yyarg[YYARGS_MAX];
+ symbol_kind_type yyarg[YYARGS_MAX];
int yycount = yy_syntax_error_arguments_ (yyctx, yyarg, YYARGS_MAX);
char const* yyformat = YY_NULLPTR;
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index d593467b..52383d29 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -631,10 +631,10 @@ union yyalloc
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
]b4_api_token_raw_if(dnl
-[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_type_t, YYX)]],
+[[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]],
[[#define YYTRANSLATE(YYX) \
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
- ? YY_CAST (yysymbol_type_t, yytranslate[YYX]) \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
: YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
@@ -650,12 +650,12 @@ static const ]b4_int_type_for([b4_translate])[
yytranslate[] =
#endif
/** Accessing symbol of state STATE. */
-#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_type_t, yystos[State])
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
#if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG ||
]b4_token_table_flag], [[1]])[
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
-static const char *yysymbol_name (yysymbol_type_t yysymbol)
YY_ATTRIBUTE_UNUSED;
+static const char *yysymbol_name (yysymbol_kind_t yysymbol)
YY_ATTRIBUTE_UNUSED;
]b4_parse_error_bmatch([simple\|verbose],
[[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
@@ -666,12 +666,12 @@ static const char *const yytname[] =
};
static const char *
-yysymbol_name (yysymbol_type_t yysymbol)
+yysymbol_name (yysymbol_kind_t yysymbol)
{
return yytname[yysymbol];
}]],
[[static const char *
-yysymbol_name (yysymbol_type_t yysymbol)
+yysymbol_name (yysymbol_kind_t yysymbol)
{
static const char *const yy_sname[] =
{
@@ -1018,7 +1018,7 @@ do {
\
any old *YYES other than YYESA. */
static int
yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
- YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_type_t yytoken)
+ YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_kind_t yytoken)
{
yy_state_t *yyes_prev = yyssp;
yy_state_t *yyesp = yyes_prev;
@@ -1130,7 +1130,7 @@ typedef struct
yy_state_t *yyesa;
yy_state_t **yyes;
YYPTRDIFF_T *yyes_capacity;]])])[
- yysymbol_type_t yytoken;]b4_locations_if([[
+ yysymbol_kind_t yytoken;]b4_locations_if([[
YYLTYPE *yylloc;]])[
} yypcontext_t;
@@ -1142,10 +1142,10 @@ typedef struct
YYARG up to YYARGN. */]b4_push_if([[
static int
yypstate_expected_tokens (yypstate *yyps,
- yysymbol_type_t yyarg[], int yyargn)]], [[
+ yysymbol_kind_t yyarg[], int yyargn)]], [[
static int
yyexpected_tokens (const yypcontext_t *yyctx,
- yysymbol_type_t yyarg[], int yyargn)]])[
+ yysymbol_kind_t yyarg[], int yyargn)]])[
{
/* Actual size of YYARG. */
int yycount = 0;
@@ -1153,7 +1153,7 @@ yyexpected_tokens (const yypcontext_t *yyctx,
int yyx;
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
{
- yysymbol_type_t yysym = YY_CAST (yysymbol_type_t, yyx);
+ yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF)
switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes,
&yyps->yyes_capacity, yyps->yyssp, yysym]],
[[yyctx->yyesa, yyctx->yyes,
yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
@@ -1191,7 +1191,7 @@ yyexpected_tokens (const yypcontext_t *yyctx,
else if (yycount == yyargn)
return 0;
else
- yyarg[yycount++] = YY_CAST (yysymbol_type_t, yyx);
+ yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
}
}]])[
return yycount;
@@ -1201,7 +1201,7 @@ yyexpected_tokens (const yypcontext_t *yyctx,
/* Similar to the previous function. */
static int
yyexpected_tokens (const yypcontext_t *yyctx,
- yysymbol_type_t yyarg[], int yyargn)
+ yysymbol_kind_t yyarg[], int yyargn)
{
return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
}]])[
@@ -1210,10 +1210,10 @@ yyexpected_tokens (const yypcontext_t *yyctx,
]b4_parse_error_bmatch(
[custom],
[[/* The token type of the lookahead of this context. */
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yypcontext_t *yyctx)
{
return yyctx->yytoken;
@@ -1324,7 +1324,7 @@ yytnamerr (char *yyres, const char *yystr)
static int
yy_syntax_error_arguments (const yypcontext_t *yyctx,
- yysymbol_type_t yyarg[], int yyargn)
+ yysymbol_kind_t yyarg[], int yyargn)
{
/* Actual size of YYARG. */
int yycount = 0;
@@ -1391,7 +1391,7 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat: reported tokens (one for the "unexpected",
one per "expected"). */
- yysymbol_type_t yyarg[YYARGS_MAX];
+ yysymbol_kind_t yyarg[YYARGS_MAX];
/* Cumulated lengths of YYARG. */
YYPTRDIFF_T yysize = 0;
@@ -1584,7 +1584,7 @@ yyparse (]m4_ifset([b4_parse_param],
[b4_formals(b4_parse_param)], [void])[)]])[
/* The return value of yyparse. */
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- yysymbol_type_t yytoken = YYSYMBOL_YYEMPTY;
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;]b4_locations_if([[
@@ -1869,7 +1869,7 @@ yyreduce:
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_type_t, yyr1[yyn]), &yyval,
&yyloc);
+ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval,
&yyloc);
YYPOPSTACK (yylen);
yylen = 0;
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 9b8fb76f..233f8a6c 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -290,7 +290,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
// Report the tokens expected at this point.
{
enum { TOKENMAX = 10 };
- yysymbol_type_t expected[TOKENMAX];
+ yysymbol_kind_t expected[TOKENMAX];
int n = yyexpected_tokens (ctx, expected, TOKENMAX);
if (n < 0)
// Forward errors to yyparse.
@@ -302,7 +302,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
}
// Report the unexpected token.
{
- yysymbol_type_t lookahead = yypcontext_token (ctx);
+ yysymbol_kind_t lookahead = yypcontext_token (ctx);
if (lookahead != YYSYMBOL_YYEMPTY)
fprintf (stderr, " before %s", yysymbol_name (lookahead));
}
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 808dffd3..4a97442e 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.5.3.219-2a6f. */
+/* A Bison parser, made by GNU Bison 3.5.4.236-8d75. */
/* Bison implementation for Yacc-like parsers in C
@@ -48,7 +48,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.5.3.219-2a6f"
+#define YYBISON_VERSION "3.5.4.236-8d75"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -101,7 +101,7 @@
#include "src/parse-gram.h"
/* Symbol type. */
-enum yysymbol_type_t
+enum yysymbol_kind_t
{
YYSYMBOL_YYEMPTY = -2,
YYSYMBOL_YYEOF = 0,
@@ -208,7 +208,7 @@ enum yysymbol_type_t
YYSYMBOL_string_as_id = 101,
YYSYMBOL_102_epilogue_opt = 102
};
-typedef enum yysymbol_type_t yysymbol_type_t;
+typedef enum yysymbol_kind_t yysymbol_kind_t;
@@ -608,7 +608,7 @@ union yyalloc
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
-#define YYTRANSLATE(YYX) YY_CAST (yysymbol_type_t, YYX)
+#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)
#if GRAM_DEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
@@ -631,15 +631,15 @@ static const yytype_int16 yyrline[] =
#endif
/** Accessing symbol of state STATE. */
-#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_type_t, yystos[State])
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
#if 1
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
-static const char *yysymbol_name (yysymbol_type_t yysymbol)
YY_ATTRIBUTE_UNUSED;
+static const char *yysymbol_name (yysymbol_kind_t yysymbol)
YY_ATTRIBUTE_UNUSED;
static const char *
-yysymbol_name (yysymbol_type_t yysymbol)
+yysymbol_name (yysymbol_kind_t yysymbol)
{
static const char *const yy_sname[] =
{
@@ -1035,7 +1035,7 @@ do {
\
static void
yy_symbol_value_print (FILE *yyo,
- yysymbol_type_t yytype, YYSTYPE const * const yyvaluep,
YYLTYPE const * const yylocationp)
+ yysymbol_kind_t yytype, YYSTYPE const * const yyvaluep,
YYLTYPE const * const yylocationp)
{
FILE *yyoutput = yyo;
YYUSE (yyoutput);
@@ -1246,7 +1246,7 @@ troff (yyo);
static void
yy_symbol_print (FILE *yyo,
- yysymbol_type_t yytype, YYSTYPE const * const yyvaluep,
YYLTYPE const * const yylocationp)
+ yysymbol_kind_t yytype, YYSTYPE const * const yyvaluep,
YYLTYPE const * const yylocationp)
{
YYFPRINTF (yyo, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yysymbol_name (yytype));
@@ -1480,7 +1480,7 @@ do {
\
any old *YYES other than YYESA. */
static int
yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
- YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_type_t yytoken)
+ YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_kind_t yytoken)
{
yy_state_t *yyes_prev = yyssp;
yy_state_t *yyesp = yyes_prev;
@@ -1590,7 +1590,7 @@ typedef struct
yy_state_t *yyesa;
yy_state_t **yyes;
YYPTRDIFF_T *yyes_capacity;
- yysymbol_type_t yytoken;
+ yysymbol_kind_t yytoken;
YYLTYPE *yylloc;
} yypcontext_t;
@@ -1602,7 +1602,7 @@ typedef struct
YYARG up to YYARGN. */
static int
yyexpected_tokens (const yypcontext_t *yyctx,
- yysymbol_type_t yyarg[], int yyargn)
+ yysymbol_kind_t yyarg[], int yyargn)
{
/* Actual size of YYARG. */
int yycount = 0;
@@ -1610,7 +1610,7 @@ yyexpected_tokens (const yypcontext_t *yyctx,
int yyx;
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
{
- yysymbol_type_t yysym = YY_CAST (yysymbol_type_t, yyx);
+ yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
if (yysym != YYSYMBOL_YYERROR && yysym != YYSYMBOL_YYUNDEF)
switch (yy_lac (yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity,
yyctx->yyssp, yysym))
{
@@ -1634,10 +1634,10 @@ yyexpected_tokens (const yypcontext_t *yyctx,
/* The token type of the lookahead of this context. */
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
-static yysymbol_type_t
+static yysymbol_kind_t
yypcontext_token (const yypcontext_t *yyctx)
{
return yyctx->yytoken;
@@ -1663,7 +1663,7 @@ yyreport_syntax_error (const yypcontext_t *yyctx);
static void
yydestruct (const char *yymsg,
- yysymbol_type_t yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
+ yysymbol_kind_t yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
@@ -1789,7 +1789,7 @@ YYLTYPE yylloc = yyloc_default;
/* The return value of yyparse. */
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- yysymbol_type_t yytoken = YYSYMBOL_YYEMPTY;
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -2595,7 +2595,7 @@ yyreduce:
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_type_t, yyr1[yyn]), &yyval,
&yyloc);
+ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval,
&yyloc);
YYPOPSTACK (yylen);
yylen = 0;
@@ -2806,11 +2806,11 @@ yyreport_syntax_error (const yypcontext_t *ctx)
enum { ARGS_MAX = 5 };
const char *argv[ARGS_MAX];
int argc = 0;
- yysymbol_type_t unexpected = yypcontext_token (ctx);
+ yysymbol_kind_t unexpected = yypcontext_token (ctx);
if (unexpected != YYSYMBOL_YYEMPTY)
{
argv[argc++] = yysymbol_name (unexpected);
- yysymbol_type_t expected[ARGS_MAX - 1];
+ yysymbol_kind_t expected[ARGS_MAX - 1];
int nexpected = yyexpected_tokens (ctx, expected, ARGS_MAX - 1);
if (nexpected < 0)
res = nexpected;
diff --git a/src/parse-gram.h b/src/parse-gram.h
index 79ce7480..a62b6436 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.5.3.219-2a6f. */
+/* A Bison parser, made by GNU Bison 3.5.4.236-8d75. */
/* Bison interface for Yacc-like parsers in C
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 1d78cbd2..148d48b8 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -807,11 +807,11 @@ yyreport_syntax_error (const yypcontext_t *ctx)
enum { ARGS_MAX = 5 };
const char *argv[ARGS_MAX];
int argc = 0;
- yysymbol_type_t unexpected = yypcontext_token (ctx);
+ yysymbol_kind_t unexpected = yypcontext_token (ctx);
if (unexpected != YYSYMBOL_YYEMPTY)
{
argv[argc++] = yysymbol_name (unexpected);
- yysymbol_type_t expected[ARGS_MAX - 1];
+ yysymbol_kind_t expected[ARGS_MAX - 1];
int nexpected = yyexpected_tokens (ctx, expected, ARGS_MAX - 1);
if (nexpected < 0)
res = nexpected;
diff --git a/tests/local.at b/tests/local.at
index d43f9b25..7f92f1bd 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -639,13 +639,13 @@ yyreport_syntax_error (const yypcontext_t
*ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[
fprintf (stderr, ": ");]])[
fprintf (stderr, "syntax error");
{
- yysymbol_type_t la = yypcontext_token (ctx);
+ yysymbol_kind_t la = yypcontext_token (ctx);
if (la != YYSYMBOL_YYEMPTY)
fprintf (stderr, " on token [%s]", yysymbol_name (la));
}
{
enum { TOKENMAX = 10 };
- yysymbol_type_t expected[TOKENMAX];
+ yysymbol_kind_t expected[TOKENMAX];
int n = yyexpected_tokens (ctx, expected, TOKENMAX);
/* Forward errors to yyparse. */
if (n <= 0)
@@ -755,13 +755,13 @@ void
std::cerr << ctx.location () << ": ";]])[
std::cerr << "syntax error";
{
- symbol_type_type la = ctx.token ();
+ symbol_kind_type la = ctx.token ();
if (la != YYSYMBOL_YYEMPTY)
fprintf (stderr, " on token [%s]", yysymbol_name (la));
}
{
enum { TOKENMAX = 10 };
- symbol_type_type expected[TOKENMAX];
+ symbol_kind_type expected[TOKENMAX];
int n = ctx.yyexpected_tokens (expected, TOKENMAX);
if (0 < n)
{
--
2.26.0
- RFC: renaming the symbol "types" as "kinds", Akim Demaille, 2020/04/04
- Re: RFC: renaming the symbol "types" as "kinds", Paul Eggert, 2020/04/04
- Re: RFC: renaming the symbol "types" as "kinds", Akim Demaille, 2020/04/05
- Re: RFC: renaming the symbol "types" as "kinds", Paul Eggert, 2020/04/05
- [PATCH 0/8] Rename token/symbol type as token/symbol kind, Akim Demaille, 2020/04/05
- [PATCH 4/8] m4: we don't need undef_token_number, Akim Demaille, 2020/04/05
- [PATCH 3/8] m4: rename b4_symbol_sid as b4_symbol_kind, Akim Demaille, 2020/04/05
- [PATCH 7/8] bison: use consistently "token kind", not "token type", Akim Demaille, 2020/04/05
- [PATCH 2/8] d, java: rename SymbolType as SymbolKind, Akim Demaille, 2020/04/05
- [PATCH 6/8] skeletons: use consistently "kind" instead of "type" in the code, Akim Demaille, 2020/04/05
- [PATCH 1/8] c, c++: rename yysymbol_type_t as yysymbol_kind_t,
Akim Demaille <=
- [PATCH 8/8] regen, Akim Demaille, 2020/04/05
- [PATCH 5/8] doc: refer to the token kind rather than the token type, Akim Demaille, 2020/04/05