support $<tag>$ in printers and destructors

* src/scan-code.l (SC_SYMBOL_ACTION): Accept $<tag>$, not just $$.
* data/c.m4 (b4_dollar_dollar_): New.
(b4_symbol_actions): Let b4_dollar_dollar use b4_dollar_dollar_.
* NEWS, doc/bison.texi: Document it.
* tests/actions.at: Check this for C and C++.
This commit is contained in:
Akim Demaille
2012-07-26 16:52:35 +02:00
parent 65a99eca25
commit 4982f078bf
6 changed files with 182 additions and 15 deletions

View File

@@ -4592,11 +4592,11 @@ symbol is automatically discarded.
@deffn {Directive} %destructor @{ @var{code} @} @var{symbols}
@findex %destructor
Invoke the braced @var{code} whenever the parser discards one of the
@var{symbols}.
Within @var{code}, @code{$$} designates the semantic value associated
with the discarded symbol, and @code{@@$} designates its location.
The additional parser parameters are also available (@pxref{Parser Function, ,
The Parser Function @code{yyparse}}).
@var{symbols}. Within @var{code}, @code{$$} (or @code{$<@var{tag}>$})
designates the semantic value associated with the discarded symbol, and
@code{@@$} designates its location. The additional parser parameters are
also available (@pxref{Parser Function, , The Parser Function
@code{yyparse}}).
When a symbol is listed among @var{symbols}, its @code{%destructor} is called a
per-symbol @code{%destructor}.
@@ -4734,10 +4734,11 @@ Decl, , Freeing Discarded Symbols}).
@c This is the same text as for %destructor.
Invoke the braced @var{code} whenever the parser displays one of the
@var{symbols}. Within @var{code}, @code{yyoutput} denotes the output stream
(a @code{FILE*} in C, and an @code{std::ostream&} in C++),
@code{$$} designates the semantic value associated with the symbol, and
@code{@@$} its location. The additional parser parameters are also
available (@pxref{Parser Function, , The Parser Function @code{yyparse}}).
(a @code{FILE*} in C, and an @code{std::ostream&} in C++), @code{$$} (or
@code{$<@var{tag}>$}) designates the semantic value associated with the
symbol, and @code{@@$} its location. The additional parser parameters are
also available (@pxref{Parser Function, , The Parser Function
@code{yyparse}}).
The @var{symbols} are defined as for @code{%destructor} (@pxref{Destructor
Decl, , Freeing Discarded Symbols}.): they can be per-type (e.g.,