mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
c++: rename semantic_type as value_type
We always refer to the triplet "kind, value, location". All of them are nouns, and we support api.value.type and api.location.type. On this regard, "semantic_type" was a poor choice. Make it "value_type". The test suite was not updated to use value_type, on purpose, to enforce backward compatibility. * data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/glr2.cc, * data/skeletons/variant.hh, doc/bison.texi: Define value_type rather than semantic_type. Add a backward compatibility typedef. * examples/c++/glr/c++-types.yy: Migrate.
This commit is contained in:
27
NEWS
27
NEWS
@@ -4,22 +4,27 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Changes
|
** Changes
|
||||||
|
|
||||||
|
*** C++ value_type
|
||||||
|
|
||||||
|
Prefer value_type to semantic_type to denote the semantic value type,
|
||||||
|
specified by the `api.value.type` %define variable.
|
||||||
|
|
||||||
** New features
|
** New features
|
||||||
|
|
||||||
*** Option -H, --header and directive %header
|
*** Option -H, --header and directive %header
|
||||||
|
|
||||||
The option -H/--header supersedes the option --defines, and the directive
|
The option `-H`/`--header` supersedes the option `--defines`, and the
|
||||||
%header supersedes %defines. Both --defines and %defines are, of course,
|
directive %header supersedes %defines. Both `--defines` and `%defines`
|
||||||
maintained for backward compatibility.
|
are, of course, maintained for backward compatibility.
|
||||||
|
|
||||||
*** Option --html
|
*** Option --html
|
||||||
|
|
||||||
Since version 2.4 Bison can be used to generate HTML reports. However it
|
Since version 2.4 Bison can be used to generate HTML reports. However it
|
||||||
was a two-step process: first bison must be invoked with option --xml, and
|
was a two-step process: first bison must be invoked with option `--xml`,
|
||||||
then xsltproc must be run to the convert the XML reports into HTML.
|
and then xsltproc must be run to the convert the XML reports into HTML.
|
||||||
|
|
||||||
The new option --html combines these steps. The xsltproc program must be
|
The new option `--html` combines these steps. The xsltproc program must
|
||||||
available.
|
be available.
|
||||||
|
|
||||||
*** A C++ native GLR parser
|
*** A C++ native GLR parser
|
||||||
|
|
||||||
@@ -51,8 +56,8 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
*** Lookahead correction in Java
|
*** Lookahead correction in Java
|
||||||
|
|
||||||
The Java skeleton (lalr1.java) now supports LAC, via the %define variable
|
The Java skeleton (lalr1.java) now supports LAC, via the `parse.lac`
|
||||||
parse.lac.
|
%define variable.
|
||||||
|
|
||||||
|
|
||||||
* Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
|
* Noteworthy changes in release 3.7.4 (2020-11-14) [stable]
|
||||||
@@ -795,7 +800,7 @@ GNU Bison NEWS
|
|||||||
Also, because string aliases need not be defined, typos such as "baz"
|
Also, because string aliases need not be defined, typos such as "baz"
|
||||||
instead of "bar" will be not reported.
|
instead of "bar" will be not reported.
|
||||||
|
|
||||||
The option -Wdangling-alias catches these situations. On
|
The option `-Wdangling-alias` catches these situations. On
|
||||||
|
|
||||||
%token BAR "bar"
|
%token BAR "bar"
|
||||||
%type <ival> foo "foo"
|
%type <ival> foo "foo"
|
||||||
@@ -811,7 +816,7 @@ GNU Bison NEWS
|
|||||||
| foo: "baz" {}
|
| foo: "baz" {}
|
||||||
| ^~~~~
|
| ^~~~~
|
||||||
|
|
||||||
The -Wall option does not (yet?) include -Wdangling-alias.
|
The `-Wall` option does not (yet?) include `-Wdangling-alias`.
|
||||||
|
|
||||||
*** Better POSIX Yacc compatibility diagnostics
|
*** Better POSIX Yacc compatibility diagnostics
|
||||||
|
|
||||||
|
|||||||
@@ -206,16 +206,16 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
|
|
||||||
# b4_value_type_declare
|
# b4_value_type_declare
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Declare semantic_type.
|
# Declare value_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
[b4_value_type_setup[]dnl
|
[b4_value_type_setup[]dnl
|
||||||
[ /// Symbol semantic values.
|
[ /// Symbol semantic values.
|
||||||
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
|
||||||
[code],
|
[code],
|
||||||
[[ typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
|
[[ typedef ]b4_percent_define_get([[api.value.type]])[ value_type;]],
|
||||||
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
[m4_bmatch(b4_percent_define_get([[api.value.type]]),
|
||||||
[union\|union-directive],
|
[union\|union-directive],
|
||||||
[[ union semantic_type
|
[[ union value_type
|
||||||
{
|
{
|
||||||
]b4_user_union_members[
|
]b4_user_union_members[
|
||||||
};]])])dnl
|
};]])])dnl
|
||||||
@@ -230,8 +230,10 @@ m4_define([b4_public_types_declare],
|
|||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
[[#ifndef ]b4_api_PREFIX[STYPE
|
||||||
]b4_value_type_declare[
|
]b4_value_type_declare[
|
||||||
#else
|
#else
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE value_type;
|
||||||
#endif]b4_locations_if([
|
#endif
|
||||||
|
/// Backward compatibility (Bison 3.8).
|
||||||
|
typedef value_type semantic_type;]b4_locations_if([
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef b4_percent_define_get([[api.location.type]],
|
typedef b4_percent_define_get([[api.location.type]],
|
||||||
[[location]]) location_type;])[
|
[[location]]) location_type;])[
|
||||||
@@ -329,7 +331,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
|
|
||||||
/// Constructor for symbols with semantic value.
|
/// Constructor for symbols with semantic value.
|
||||||
basic_symbol (typename Base::kind_type t,
|
basic_symbol (typename Base::kind_type t,
|
||||||
YY_RVREF (semantic_type) v]b4_locations_if([,
|
YY_RVREF (value_type) v]b4_locations_if([,
|
||||||
YY_RVREF (location_type) l])[);
|
YY_RVREF (location_type) l])[);
|
||||||
]])[
|
]])[
|
||||||
/// Destroy the symbol.
|
/// Destroy the symbol.
|
||||||
@@ -390,7 +392,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
void move (basic_symbol& s);
|
void move (basic_symbol& s);
|
||||||
|
|
||||||
/// The semantic value.
|
/// The semantic value.
|
||||||
semantic_type value;]b4_locations_if([
|
value_type value;]b4_locations_if([
|
||||||
|
|
||||||
/// The location.
|
/// The location.
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
@@ -487,7 +489,7 @@ m4_define([b4_public_types_define],
|
|||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
]b4_parser_class[::basic_symbol<Base>::basic_symbol (]b4_join(
|
||||||
[typename Base::kind_type t],
|
[typename Base::kind_type t],
|
||||||
[YY_RVREF (semantic_type) v],
|
[YY_RVREF (value_type) v],
|
||||||
b4_locations_if([YY_RVREF (location_type) l]))[)
|
b4_locations_if([YY_RVREF (location_type) l]))[)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
, value (]b4_variant_if([], [YY_MOVE (v)])[)]b4_locations_if([
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ m4_define([b4_yy_symbol_print_define],
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
yy_symbol_print (FILE *, ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yytoken,
|
||||||
const ]b4_namespace_ref::b4_parser_class[::semantic_type *yyvaluep]b4_locations_if([[,
|
const ]b4_namespace_ref::b4_parser_class[::value_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[)
|
||||||
{
|
{
|
||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
@@ -154,7 +154,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
YYUSE (yylocationp);]])[
|
YYUSE (yylocationp);]])[
|
||||||
@@ -168,7 +168,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
@@ -247,7 +247,7 @@ m4_define([b4_glr_cc_setup],
|
|||||||
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
#define ]b4_symbol(error, [id])[ ]b4_namespace_ref[::]b4_parser_class[::token::]b4_symbol(error, [id])[
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
|
||||||
#endif
|
#endif
|
||||||
#ifndef ]b4_api_PREFIX[LTYPE
|
#ifndef ]b4_api_PREFIX[LTYPE
|
||||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
||||||
@@ -355,14 +355,14 @@ b4_percent_code_get([[requires]])[
|
|||||||
/// \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_kind_type yykind,
|
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yykind The symbol kind.
|
/// \param yykind The symbol kind.
|
||||||
/// \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_kind_type yykind,
|
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
private:
|
private:
|
||||||
/// Debug stream.
|
/// Debug stream.
|
||||||
|
|||||||
@@ -250,14 +250,14 @@ const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX =
|
|||||||
/// \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_kind_type yykind,
|
virtual void yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
/// \brief Report a symbol on the debug stream.
|
/// \brief Report a symbol on the debug stream.
|
||||||
/// \param yykind The symbol kind.
|
/// \param yykind The symbol kind.
|
||||||
/// \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_kind_type yykind,
|
virtual void yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const;
|
const location_type* yylocationp]])[) const;
|
||||||
private:
|
private:
|
||||||
/// Debug stream.
|
/// Debug stream.
|
||||||
@@ -285,7 +285,7 @@ const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX =
|
|||||||
/// If null, print nothing.
|
/// If null, print nothing.
|
||||||
/// \param yykind The symbol kind.
|
/// \param yykind The symbol kind.
|
||||||
void yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
|
void yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[);
|
const location_type* yylocationp]])[);
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
@@ -434,7 +434,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
|||||||
[b4_shared_declarations])[
|
[b4_shared_declarations])[
|
||||||
|
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::semantic_type
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class[::value_type
|
||||||
#endif
|
#endif
|
||||||
#ifndef ]b4_api_PREFIX[LTYPE
|
#ifndef ]b4_api_PREFIX[LTYPE
|
||||||
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class[::location_type
|
||||||
@@ -763,7 +763,7 @@ yyrhsLength (rule_num yyrule);
|
|||||||
class glr_state
|
class glr_state
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::semantic_type value_type;]b4_locations_if([[
|
typedef ]b4_namespace_ref[::]b4_parser_class[::value_type value_type;]b4_locations_if([[
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::location_type location_type;]])[
|
typedef ]b4_namespace_ref[::]b4_parser_class[::location_type location_type;]])[
|
||||||
|
|
||||||
glr_state ()
|
glr_state ()
|
||||||
@@ -3238,7 +3238,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
|
]b4_parser_class[::yy_destroy_ (const char* yymsg, symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[)
|
const location_type* yylocationp]])[)
|
||||||
{
|
{
|
||||||
YYUSE (yyvaluep);]b4_locations_if([[
|
YYUSE (yyvaluep);]b4_locations_if([[
|
||||||
@@ -3261,7 +3261,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_value_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
YYUSE (yylocationp);]])[
|
YYUSE (yylocationp);]])[
|
||||||
@@ -3274,7 +3274,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
]b4_parser_class[::yy_symbol_print_ (symbol_kind_type yykind,
|
||||||
const semantic_type* yyvaluep]b4_locations_if([[,
|
const value_type* yyvaluep]b4_locations_if([[,
|
||||||
const location_type* yylocationp]])[) const
|
const location_type* yylocationp]])[) const
|
||||||
{
|
{
|
||||||
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
*yycdebug_ << (yykind < YYNTOKENS ? "token" : "nterm")
|
||||||
|
|||||||
@@ -94,28 +94,28 @@ m4_define([b4_variant_includes],
|
|||||||
|
|
||||||
# b4_value_type_declare
|
# b4_value_type_declare
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# Define semantic_type.
|
# Define value_type.
|
||||||
m4_define([b4_value_type_declare],
|
m4_define([b4_value_type_declare],
|
||||||
[[ /// A buffer to store and retrieve objects.
|
[[ /// A buffer to store and retrieve objects.
|
||||||
///
|
///
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
/// Sort of a variant, but does not keep track of the nature
|
||||||
/// of the stored data, since that knowledge is available
|
/// of the stored data, since that knowledge is available
|
||||||
/// via the current parser state.
|
/// via the current parser state.
|
||||||
class semantic_type
|
class value_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Type of *this.
|
/// Type of *this.
|
||||||
typedef semantic_type self_type;
|
typedef value_type self_type;
|
||||||
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
semantic_type () YY_NOEXCEPT
|
value_type () YY_NOEXCEPT
|
||||||
: yyraw_ ()]b4_parse_assert_if([
|
: yyraw_ ()]b4_parse_assert_if([
|
||||||
, yytypeid_ (YY_NULLPTR)])[
|
, yytypeid_ (YY_NULLPTR)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Construct and fill.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
value_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||||
: yytypeid_ (&typeid (T))])[
|
: yytypeid_ (&typeid (T))])[
|
||||||
{]b4_parse_assert_if([[
|
{]b4_parse_assert_if([[
|
||||||
]b4_assert[ (sizeof (T) <= size);]])[
|
]b4_assert[ (sizeof (T) <= size);]])[
|
||||||
@@ -124,13 +124,13 @@ m4_define([b4_value_type_declare],
|
|||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
semantic_type (const self_type&) = delete;
|
value_type (const self_type&) = delete;
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
self_type& operator= (const self_type&) = delete;
|
self_type& operator= (const self_type&) = delete;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~semantic_type () YY_NOEXCEPT
|
~value_type () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
]b4_assert[ (!yytypeid_);
|
]b4_assert[ (!yytypeid_);
|
||||||
])[}
|
])[}
|
||||||
@@ -274,7 +274,7 @@ m4_define([b4_value_type_declare],
|
|||||||
private:
|
private:
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
semantic_type (const self_type&);
|
value_type (const self_type&);
|
||||||
/// Non copyable.
|
/// Non copyable.
|
||||||
self_type& operator= (const self_type&);
|
self_type& operator= (const self_type&);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3864,7 +3864,7 @@ type, define the @code{%define} variable @code{api.value.type} like this:
|
|||||||
or
|
or
|
||||||
|
|
||||||
@example
|
@example
|
||||||
%define api.value.type @{struct semantic_type@}
|
%define api.value.type @{struct semantic_value_type@}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
The value of @code{api.value.type} should be a type name that does not
|
The value of @code{api.value.type} should be a type name that does not
|
||||||
@@ -6259,7 +6259,7 @@ For example, if you specify:
|
|||||||
Bison uses @code{foo::bar} verbatim in references such as:
|
Bison uses @code{foo::bar} verbatim in references such as:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
foo::bar::parser::semantic_type
|
foo::bar::parser::value_type
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
However, to open a namespace, Bison removes any leading @code{::} and then
|
However, to open a namespace, Bison removes any leading @code{::} and then
|
||||||
@@ -12302,7 +12302,7 @@ typedef token::token_kind_type token_kind_type;
|
|||||||
@end example
|
@end example
|
||||||
@end defcv
|
@end defcv
|
||||||
|
|
||||||
@defcv {Type} {parser} {semantic_type}
|
@defcv {Type} {parser} {value_type}
|
||||||
The types for semantic values. @xref{C++ Semantic Values}.
|
The types for semantic values. @xref{C++ Semantic Values}.
|
||||||
@end defcv
|
@end defcv
|
||||||
|
|
||||||
@@ -12393,7 +12393,7 @@ features in C++.
|
|||||||
@item
|
@item
|
||||||
The type @code{YYSTYPE} is defined but its use is discouraged: rather you
|
The type @code{YYSTYPE} is defined but its use is discouraged: rather you
|
||||||
should refer to the parser's encapsulated type
|
should refer to the parser's encapsulated type
|
||||||
@code{yy::parser::semantic_type}.
|
@code{yy::parser::value_type}.
|
||||||
@item
|
@item
|
||||||
Non POD (Plain Old Data) types cannot be used. C++98 forbids any instance
|
Non POD (Plain Old Data) types cannot be used. C++98 forbids any instance
|
||||||
of classes with constructors in unions: only @emph{pointers} to such objects
|
of classes with constructors in unions: only @emph{pointers} to such objects
|
||||||
@@ -12453,14 +12453,14 @@ of alternative types such as @samp{$<int>2} or @samp{$<std::string>$}, even
|
|||||||
in midrule actions. It is mandatory to use typed midrule actions
|
in midrule actions. It is mandatory to use typed midrule actions
|
||||||
(@pxref{Typed Midrule Actions}).
|
(@pxref{Typed Midrule Actions}).
|
||||||
|
|
||||||
@deftypemethod {semantic_type} {T&} {emplace<T>} ()
|
@deftypemethod {value_type} {T&} {emplace<T>} ()
|
||||||
@deftypemethodx {semantic_type} {T&} {emplace<T>} (@code{const T&} @var{t})
|
@deftypemethodx {value_type} {T&} {emplace<T>} (@code{const T&} @var{t})
|
||||||
Available in C++98/C++03 only. Default construct/copy-construct from
|
Available in C++98/C++03 only. Default construct/copy-construct from
|
||||||
@var{t}. Return a reference to where the actual value may be stored.
|
@var{t}. Return a reference to where the actual value may be stored.
|
||||||
Requires that the variant was not initialized yet.
|
Requires that the variant was not initialized yet.
|
||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
|
|
||||||
@deftypemethod {semantic_type} {T&} {emplace<T, U>} (@code{U&&...} @var{u})
|
@deftypemethod {value_type} {T&} {emplace<T, U>} (@code{U&&...} @var{u})
|
||||||
Available in C++11 and later only. Build a variant of type @code{T} from
|
Available in C++11 and later only. Build a variant of type @code{T} from
|
||||||
the variadic forwarding references @var{u...}.
|
the variadic forwarding references @var{u...}.
|
||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
@@ -12872,8 +12872,8 @@ depends whether you use unions, or variants.
|
|||||||
|
|
||||||
The generated parser expects @code{yylex} to have the following prototype.
|
The generated parser expects @code{yylex} to have the following prototype.
|
||||||
|
|
||||||
@deftypefun {int} yylex (@code{semantic_type*} @var{yylval}, @code{location_type*} @var{yylloc}, @var{type1} @var{arg1}, @dots{})
|
@deftypefun {int} yylex (@code{value_type*} @var{yylval}, @code{location_type*} @var{yylloc}, @var{type1} @var{arg1}, @dots{})
|
||||||
@deftypefunx {int} yylex (@code{semantic_type*} @var{yylval}, @var{type1} @var{arg1}, @dots{})
|
@deftypefunx {int} yylex (@code{value_type*} @var{yylval}, @var{type1} @var{arg1}, @dots{})
|
||||||
Return the next token. Its kind is the return value, its semantic value and
|
Return the next token. Its kind is the return value, its semantic value and
|
||||||
location (if enabled) being @var{yylval} and @var{yylloc}. Invocations of
|
location (if enabled) being @var{yylval} and @var{yylloc}. Invocations of
|
||||||
@samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments.
|
@samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments.
|
||||||
|
|||||||
@@ -46,11 +46,11 @@
|
|||||||
# define nullptr 0
|
# define nullptr 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static yy::parser::semantic_type
|
static yy::parser::value_type
|
||||||
stmtMerge (const yy::parser::semantic_type& x0, const yy::parser::semantic_type& x1);
|
stmtMerge (const yy::parser::value_type& x0, const yy::parser::value_type& x1);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yylex (yy::parser::semantic_type* val, yy::parser::location_type* loc);
|
yylex (yy::parser::value_type* val, yy::parser::location_type* loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
%expect-rr 1
|
%expect-rr 1
|
||||||
@@ -103,7 +103,7 @@ yy::parser::error (const location_type& l, const std::string& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
yylex (yy::parser::semantic_type* lvalp, yy::parser::location_type* llocp)
|
yylex (yy::parser::value_type* lvalp, yy::parser::location_type* llocp)
|
||||||
{
|
{
|
||||||
static int lineNum = 1;
|
static int lineNum = 1;
|
||||||
static int colNum = 0;
|
static int colNum = 0;
|
||||||
@@ -162,8 +162,8 @@ yylex (yy::parser::semantic_type* lvalp, yy::parser::location_type* llocp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static yy::parser::semantic_type
|
static yy::parser::value_type
|
||||||
stmtMerge (const yy::parser::semantic_type& x0, const yy::parser::semantic_type& x1)
|
stmtMerge (const yy::parser::value_type& x0, const yy::parser::value_type& x1)
|
||||||
{
|
{
|
||||||
return Nterm ("<OR>", x0, x1);
|
return Nterm ("<OR>", x0, x1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user