[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Not able to use %union?
From: |
Hans Åberg |
Subject: |
Re: Not able to use %union? |
Date: |
Mon, 18 Feb 2019 23:06:35 +0100 |
> On 18 Feb 2019, at 04:37, Peng Yu <address@hidden> wrote:
>
> I use rapidstring to make the string operations use and use the Boehm
> garbage collector so that I don't have to always remember to release
> the memory.
>
> https://github.com/boyerjohn/rapidstring
>
> Because I want to use the previously allocated memory, I don't want to
> call "rs_init(&yylval->str)" in any action.
That is probably not needed (Akim may clarify): Without a GC, just hand over
the lexer allocated pointer to the parser marked with a type, and set
%destructor for this type to handle error cleanup when the parser stack
unwinds; otherwise deallocate in the rules.