doc: update variant usage

* doc/bison.texi, examples/variant.yy: Use "%define api.value.type variant",
instead of "%define variant".
This commit is contained in:
Akim Demaille
2012-12-23 12:47:31 +01:00
parent 1a06f28efc
commit ae8880deec
2 changed files with 27 additions and 29 deletions

View File

@@ -5744,6 +5744,26 @@ introduced in Bison 2.8
@c api.token.prefix @c api.token.prefix
@c ================================================== api.value.type
@item %define api.value.type variant
@findex %define api.value.type variant
@itemize @bullet
@item Language(s):
C++
@item Purpose:
Request variant-based semantic values.
@xref{C++ Variants}.
@c FIXME: @item Accepted Values:
@c FIXME: Boolean.
@c @item Default Value:
@c @code{false}
@ @end itemize
@c api.value.type
@c ================================================== lr.default-reduction @c ================================================== lr.default-reduction
@item lr.default-reduction @item lr.default-reduction
@@ -5891,29 +5911,8 @@ compiled.
@item Default Value: @code{false} @item Default Value: @code{false}
@end itemize @end itemize
@c parse.trace @c parse.trace
@c ================================================== variant
@item variant
@findex %define variant
@itemize @bullet
@item Language(s):
C++
@item Purpose:
Request variant-based semantic values.
@xref{C++ Variants}.
@item Accepted Values:
Boolean.
@item Default Value:
@code{false}
@end itemize
@c variant
@end table @end table
@node %code Summary @node %code Summary
@subsection %code Summary @subsection %code Summary
@findex %code @findex %code
@@ -10115,10 +10114,9 @@ Symbols}.
@node C++ Variants @node C++ Variants
@subsubsection C++ Variants @subsubsection C++ Variants
Starting with version 2.6, Bison provides a @emph{variant} based Bison provides a @emph{variant} based implementation of semantic values for
implementation of semantic values for C++. This alleviates all the C++. This alleviates all the limitations reported in the previous section,
limitations reported in the previous section, and in particular, object and in particular, object types can be used without pointers.
types can be used without pointers.
To enable variant-based semantic values, set @code{%define} variable To enable variant-based semantic values, set @code{%define} variable
@code{variant} (@pxref{%define Summary,, variant}). Once this defined, @code{variant} (@pxref{%define Summary,, variant}). Once this defined,
@@ -10546,7 +10544,7 @@ or
@node Complete Symbols @node Complete Symbols
@subsubsection Complete Symbols @subsubsection Complete Symbols
If you specified both @code{%define variant} and If you specified both @code{%define api.value.type variant} and
@code{%define api.token.constructor}, @code{%define api.token.constructor},
the @code{parser} class also defines the class @code{parser::symbol_type} the @code{parser} class also defines the class @code{parser::symbol_type}
which defines a @emph{complete} symbol, aggregating its type (i.e., the which defines a @emph{complete} symbol, aggregating its type (i.e., the
@@ -10810,7 +10808,7 @@ the grammar for.
@noindent @noindent
@findex %define api.token.constructor @findex %define api.token.constructor
@findex %define variant @findex %define api.value.type variant
This example will use genuine C++ objects as semantic values, therefore, we This example will use genuine C++ objects as semantic values, therefore, we
require the variant-based interface. To make sure we properly use it, we require the variant-based interface. To make sure we properly use it, we
enable assertions. To fully benefit from type-safety and more natural enable assertions. To fully benefit from type-safety and more natural
@@ -10819,8 +10817,8 @@ definition of ``symbol'', we enable @code{api.token.constructor}.
@comment file: calc++-parser.yy @comment file: calc++-parser.yy
@example @example
%define api.token.constructor %define api.token.constructor
%define api.value.type variant
%define parse.assert %define parse.assert
%define variant
@end example @end example
@noindent @noindent

View File

@@ -19,8 +19,8 @@
%skeleton "lalr1.cc" %skeleton "lalr1.cc"
%defines %defines
%define api.token.constructor %define api.token.constructor
%define api.value.type variant
%define parse.assert %define parse.assert
%define variant
%locations %locations
%code requires // *.hh %code requires // *.hh