help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bison 3.0.4 manual section 3.7.6 question


From: Gary L Peskin
Subject: Bison 3.0.4 manual section 3.7.6 question
Date: Sun, 14 Feb 2016 16:31:17 -0800

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,
Gary




reply via email to

[Prev in Thread] Current Thread [Next in Thread]