[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison 3.0.4 manual section 3.7.6 question
From: |
Akim Demaille |
Subject: |
Re: Bison 3.0.4 manual section 3.7.6 question |
Date: |
Sat, 18 Aug 2018 14:14:59 +0200 |
Hi!
> Le 15 févr. 2016 à 01:31, Gary L Peskin <address@hidden> a écrit :
>
> In the Bison 3.0.4 manual in section 3.7.6 on destructors, the example
> shows:
>
> %union { char *string; }
> %token <string> STRING1 STRING2
> %type <string> string1 string2
> %union { char character; }
> %token <character> CHR
> %type <character> chr
> %token TAGLESS
>
> %destructor { } <character>
> %destructor { free ($$); } <*>
> %destructor { free ($$); printf ("%d", @$.first_line); } STRING1 string1
> %destructor { printf ("Discarding tagless symbol.\n"); } <>
>
> The text following the example says:
>
> However, when the parser discards a STRING1 or a string1, it also prints
> its line number to stdout. It performs only the second %destructor in this
> case, so it invokes free only once.
>
> Should the manual reference the third %destructor instead of the second? If
> not, I'm confused.
>
> Thanks,
Actually thanks to you! For your report… and your patience :)
I installed this.
commit a5ef14596461104ba38f1434816a1e90eae03609
Author: Akim Demaille <address@hidden>
Date: Sat Aug 18 14:09:16 2018 +0200
doc: Clarify the destructor selection example
Reported by Gary L Peskin.
http://lists.gnu.org/archive/html/help-bison/2016-02/msg00000.html
* doc/bison.texi (Destructor Decl): here.
diff --git a/THANKS b/THANKS
index ffea0f16..92c9a2cd 100644
--- a/THANKS
+++ b/THANKS
@@ -57,6 +57,7 @@ Florian Krohm address@hidden
Frank Heckenbach address@hidden
Frans Englich address@hidden
Gabriel Rassoul address@hidden
+Gary L Peskin address@hidden
Georg Sauthoff address@hidden
George Neuner address@hidden
Gilles Espinasse address@hidden
diff --git a/doc/bison.texi b/doc/bison.texi
index deb7182a..28c5e2b3 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -5072,10 +5072,9 @@ For example:
guarantees that, when the parser discards any user-defined symbol that has a
semantic type tag other than @code{<character>}, it passes its semantic value
to @code{free} by default.
-However, when the parser discards a @code{STRING1} or a @code{string1}, it also
-prints its line number to @code{stdout}.
-It performs only the second @code{%destructor} in this case, so it invokes
address@hidden only once.
+However, when the parser discards a @code{STRING1} or a @code{string1},
+it uses the third @code{%destructor}, which frees it and
+prints its line number to @code{stdout} (@code{free} is invoked only once).
Finally, the parser merely prints a message whenever it discards any symbol,
such as @code{TAGLESS}, that has no semantic type tag.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Bison 3.0.4 manual section 3.7.6 question,
Akim Demaille <=