d: minor clean up

* doc/bison.texi: Use @samp, not "...", around pieces of code.
* examples/d/calc/calc.y: Don't promote %union.
This commit is contained in:
Akim Demaille
2021-06-23 07:19:20 +02:00
parent ca403f672c
commit 5325292e5d
2 changed files with 10 additions and 14 deletions

View File

@@ -6484,8 +6484,7 @@ with other members of the @code{SymbolKind} class.
@item Default Value: @item Default Value:
@code{YYSYMBOL_} in C. @code{S_} in C++ and Java. The default prefix is @code{YYSYMBOL_} in C, @code{S_} in C++ and Java, empty in D.
removed from D.
@item History: @item History:
introduced in Bison 3.6. introduced in Bison 3.6.
@end itemize @end itemize
@@ -6503,9 +6502,9 @@ C++, D
@item Purpose: @item Purpose:
Request that symbols be handled as a whole (type, value, and possibly Request that symbols be handled as a whole (type, value, and possibly
location) in the scanner. In the case of C++, it works only when location) in the scanner. In the case of C++, it works only when
variant-based semantic values are enabled variant-based semantic values are enabled (@pxref{C++ Variants}), see
(@pxref{C++ Variants}), @xref{Complete Symbols}, for details. In D, @ref{Complete Symbols}, for details. In D, token constructors work with both
token constructor works with both "%union" and "%define api.value.type union". @samp{%union} and @samp{%define api.value.type union}.
@item Accepted Values: @item Accepted Values:
Boolean. Boolean.

View File

@@ -20,17 +20,14 @@
%language "D" %language "D"
%define api.parser.class {Calc} %define api.parser.class {Calc}
%define parse.error detailed
%define parse.trace
%define api.push-pull push %define api.push-pull push
%define api.token.constructor %define api.token.constructor
%define api.value.type union
%define parse.error detailed
%define parse.trace
%locations %locations
%union {
int ival;
}
/* Bison Declarations */ /* Bison Declarations */
%token PLUS "+" %token PLUS "+"
MINUS "-" MINUS "-"
@@ -39,9 +36,9 @@
LPAR "(" LPAR "("
RPAR ")" RPAR ")"
EOL "end of line" EOL "end of line"
%token <ival> NUM "number" %token <int> NUM "number"
%type <ival> exp %type <int> exp
%printer { yyo.write($$); } <ival> %printer { yyo.write($$); } <int>
%left "-" "+" %left "-" "+"
%left "*" "/" %left "*" "/"