mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-23 11:13:03 +00:00
style: c++: s/type/kind/ where appropriate
These are internal details. `type_get ()` is still there to ensure backward compatibility, `kind ()` being the modern way. * data/skeletons/c++.m4 (by_type, by_type::type): Rename as... (by_kind, by_kind::kind_): this. Adjust dependencies.
This commit is contained in:
18
TODO
18
TODO
@@ -1,9 +1,5 @@
|
|||||||
* Bison 3.6
|
* Bison 3.6
|
||||||
** Questions
|
** Questions
|
||||||
*** C++
|
|
||||||
We still have occurrences of `type` that should read `kind`, in
|
|
||||||
basic_symbol.
|
|
||||||
|
|
||||||
*** Java
|
*** Java
|
||||||
- Should i18n be part of the Lexer? Currently it's a static method of
|
- Should i18n be part of the Lexer? Currently it's a static method of
|
||||||
Lexer.
|
Lexer.
|
||||||
@@ -30,9 +26,6 @@ basic_symbol.
|
|||||||
Beware that returning 0 is unclear: does it mean there are no possible
|
Beware that returning 0 is unclear: does it mean there are no possible
|
||||||
lookahead, or that there are too many?
|
lookahead, or that there are too many?
|
||||||
|
|
||||||
** bistromathic
|
|
||||||
Beware of portability of __attribute__.
|
|
||||||
|
|
||||||
** YYerror
|
** YYerror
|
||||||
yacc.c should `#define YYERRCODE YYerror` in the *.c for sake of the
|
yacc.c should `#define YYERRCODE YYerror` in the *.c for sake of the
|
||||||
projects that used it. In particular
|
projects that used it. In particular
|
||||||
@@ -58,7 +51,7 @@ token vs terminal, variable vs non terminal.
|
|||||||
|
|
||||||
** api.token.raw
|
** api.token.raw
|
||||||
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
The YYUNDEFTOK could be assigned a semantic value so that yyerror could be
|
||||||
used to report invalid lexemes. See also the item "$undefined" below.
|
used to report invalid lexemes.
|
||||||
|
|
||||||
** push parsers
|
** push parsers
|
||||||
Consider deprecating impure push parsers. They add a lot of complexity, for
|
Consider deprecating impure push parsers. They add a lot of complexity, for
|
||||||
@@ -489,15 +482,6 @@ move to partial orders (sounds like series/parallel orders to me).
|
|||||||
|
|
||||||
This is a prerequisite for modules.
|
This is a prerequisite for modules.
|
||||||
|
|
||||||
* $undefined
|
|
||||||
From Hans:
|
|
||||||
- If the Bison generated parser experiences an undefined number in the
|
|
||||||
character range, that character is written out in diagnostic messages, an
|
|
||||||
addition to the $undefined value.
|
|
||||||
|
|
||||||
Suggest: Change the name $undefined to undefined; looks better in outputs.
|
|
||||||
|
|
||||||
|
|
||||||
* Pre and post actions.
|
* Pre and post actions.
|
||||||
From: Florian Krohm <florian@edamail.fishkill.ibm.com>
|
From: Florian Krohm <florian@edamail.fishkill.ibm.com>
|
||||||
Subject: YYACT_EPILOGUE
|
Subject: YYACT_EPILOGUE
|
||||||
|
|||||||
@@ -380,30 +380,30 @@ m4_define([b4_symbol_type_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Type access provider for token (enum) based symbols.
|
/// Type access provider for token (enum) based symbols.
|
||||||
struct by_type
|
struct by_kind
|
||||||
{
|
{
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_type ();
|
by_kind ();
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Move constructor.
|
/// Move constructor.
|
||||||
by_type (by_type&& that);
|
by_kind (by_kind&& that);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_type (const by_type& that);
|
by_kind (const by_kind& that);
|
||||||
|
|
||||||
/// The symbol kind as needed by the constructor.
|
/// The symbol kind as needed by the constructor.
|
||||||
typedef token_kind_type kind_type;
|
typedef token_kind_type kind_type;
|
||||||
|
|
||||||
/// Constructor from (external) token numbers.
|
/// Constructor from (external) token numbers.
|
||||||
by_type (kind_type t);
|
by_kind (kind_type t);
|
||||||
|
|
||||||
/// Record that this symbol is empty.
|
/// Record that this symbol is empty.
|
||||||
void clear ();
|
void clear ();
|
||||||
|
|
||||||
/// Steal the symbol kind from \a that.
|
/// Steal the symbol kind from \a that.
|
||||||
void move (by_type& that);
|
void move (by_kind& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
@@ -411,14 +411,14 @@ 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 type;
|
symbol_kind_type kind_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
struct symbol_type : basic_symbol<by_type>
|
struct symbol_type : basic_symbol<by_kind>
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
/// Superclass.
|
/// Superclass.
|
||||||
typedef basic_symbol<by_type> super_type;
|
typedef basic_symbol<by_kind> super_type;
|
||||||
|
|
||||||
/// Empty symbol.
|
/// Empty symbol.
|
||||||
symbol_type () {}
|
symbol_type () {}
|
||||||
@@ -492,44 +492,44 @@ m4_define([b4_public_types_define],
|
|||||||
location = YY_MOVE (s.location);])[
|
location = YY_MOVE (s.location);])[
|
||||||
}
|
}
|
||||||
|
|
||||||
// by_type.
|
// by_kind.
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type ()
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind ()
|
||||||
: type (symbol_kind::]b4_symbol_prefix[YYEMPTY)
|
: kind_ (symbol_kind::]b4_symbol_prefix[YYEMPTY)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (by_type&& that)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (by_kind&& that)
|
||||||
: type (that.type)
|
: kind_ (that.kind_)
|
||||||
{
|
{
|
||||||
that.clear ();
|
that.clear ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (const by_type& that)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (const by_kind& that)
|
||||||
: type (that.type)
|
: kind_ (that.kind_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class[::by_type::by_type (token_kind_type t)
|
]b4_inline([$1])b4_parser_class[::by_kind::by_kind (token_kind_type t)
|
||||||
: type (yytranslate_ (t))
|
: kind_ (yytranslate_ (t))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_type::clear ()
|
]b4_parser_class[::by_kind::clear ()
|
||||||
{
|
{
|
||||||
type = symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
kind_ = symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[void
|
]b4_inline([$1])[void
|
||||||
]b4_parser_class[::by_type::move (by_type& that)
|
]b4_parser_class[::by_kind::move (by_kind& that)
|
||||||
{
|
{
|
||||||
type = that.type;
|
kind_ = that.kind_;
|
||||||
that.clear ();
|
that.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
|
||||||
]b4_parser_class[::by_type::kind () const YY_NOEXCEPT
|
]b4_parser_class[::by_kind::kind () const YY_NOEXCEPT
|
||||||
{
|
{
|
||||||
return type;
|
return kind_;
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
b4_symbol_variant([that.kind ()],
|
b4_symbol_variant([that.kind ()],
|
||||||
[value], [move], [YY_MOVE (that.value)])])[
|
[value], [move], [YY_MOVE (that.value)])])[
|
||||||
// that is emptied.
|
// that is emptied.
|
||||||
that.type = symbol_kind::]b4_symbol(-2, kind)[;
|
that.kind_ = symbol_kind::]b4_symbol(-2, kind)[;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
@@ -968,7 +968,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{]b4_token_ctor_if([[
|
{]b4_token_ctor_if([[
|
||||||
symbol_type yylookahead (]b4_lex[);
|
symbol_type yylookahead (]b4_lex[);
|
||||||
yyla.move (yylookahead);]], [[
|
yyla.move (yylookahead);]], [[
|
||||||
yyla.type = yytranslate_ (]b4_lex[);]])[
|
yyla.kind_ = yytranslate_ (]b4_lex[);]])[
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
@@ -987,7 +987,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
// lookahead, it is too special and may lead us to an endless
|
// lookahead, it is too special and may lead us to an endless
|
||||||
// loop in error recovery. */
|
// loop in error recovery. */
|
||||||
yyla.type = ]symbol_kind::b4_symbol(2, kind)[;
|
yyla.kind_ = ]symbol_kind::b4_symbol(2, kind)[;
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user