[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison and C++ exceptions
From: |
Hans Aberg |
Subject: |
Re: bison and C++ exceptions |
Date: |
Thu, 26 May 2011 01:13:18 +0200 |
On 24 May 2011, at 20:32, Sergey Klimkin wrote:
> Trying to find information about C++ exceptions in semantic actions, with no
> results.
> Is there any Bison %Decl which allows to move parse stack outside yyparse(),
> to destroy a stack values after an exception was thrown within semantic
> action!?
The C++ parser, I recall, is by default pure. So it would not be possible to
save the stack outside yyparse() unless tweaking the skeleton file. But that
should be kept to a minium in order to having to update it with new Bison
releases - it may change.
So you might try the construct
%code qualifier {code}
(see the Bison manual sec. 3.7.14). I think that qualifier just expands a M4
macro to {code}. So you might put a try-catch inside yyparse(), and use %code
to place the catch code.
Hans