diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-12-26 08:21:50 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-12-26 09:05:45 +0100 |
commit | 2157ced3dd1bc77764d06222f2b82b59ef807207 (patch) | |
tree | 7783535503ab91bdfccbc15b1466fca27b66e5d8 /doc | |
parent | 59653c8efd894b1190e31cc6eea56862316afe0d (diff) | |
download | bison-2157ced3dd1bc77764d06222f2b82b59ef807207.tar.gz |
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.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/bison.texi | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/bison.texi b/doc/bison.texi index a272b387..f6ac5f86 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -3864,7 +3864,7 @@ type, define the @code{%define} variable @code{api.value.type} like this: or @example -%define api.value.type @{struct semantic_type@} +%define api.value.type @{struct semantic_value_type@} @end example 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: @example -foo::bar::parser::semantic_type +foo::bar::parser::value_type @end example 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 defcv -@defcv {Type} {parser} {semantic_type} +@defcv {Type} {parser} {value_type} The types for semantic values. @xref{C++ Semantic Values}. @end defcv @@ -12393,7 +12393,7 @@ features in C++. @item The type @code{YYSTYPE} is defined but its use is discouraged: rather you should refer to the parser's encapsulated type -@code{yy::parser::semantic_type}. +@code{yy::parser::value_type}. @item 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 @@ -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 (@pxref{Typed Midrule Actions}). -@deftypemethod {semantic_type} {T&} {emplace<T>} () -@deftypemethodx {semantic_type} {T&} {emplace<T>} (@code{const T&} @var{t}) +@deftypemethod {value_type} {T&} {emplace<T>} () +@deftypemethodx {value_type} {T&} {emplace<T>} (@code{const T&} @var{t}) 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. Requires that the variant was not initialized yet. @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 the variadic forwarding references @var{u...}. @end deftypemethod @@ -12872,8 +12872,8 @@ depends whether you use unions, or variants. 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{}) -@deftypefunx {int} yylex (@code{semantic_type*} @var{yylval}, @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{value_type*} @var{yylval}, @var{type1} @var{arg1}, @dots{}) 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 @samp{%lex-param @{@var{type1} @var{arg1}@}} yield additional arguments. |