help-bison
[Top][All Lists]
Advanced

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

Re: C++ parser and exceptions in semantic actions


From: John Horigan
Subject: Re: C++ parser and exceptions in semantic actions
Date: Tue, 23 Feb 2010 22:48:30 -0800

Ok, I read the generated parser cpp file and it looks like I must have all the 
try/catch blocks inside my rule actions. It doesn't look like the parser 
destructor will clean things up properly.

So I would like to turn this thread into a feature request thread. It would be 
very nice if there were a yyerror() exception class and a yyabort() exception 
class. Throwing yyerror()/yyabort() exceptions would be equivalent to the 
YYERROR/YYABORT macros but they can occur anywhere, not just in the action. It 
would be a simple matter to wrap the yyreduce switch statement in a try/catch 
block to catch these exceptions and execute the YYERROR or YYABORT macros. The 
error() method could also be called using a location and an error message 
contained in the yyerror()/yyabort() object.

I guess there would need to be a new bison declaration for turning on the 
try/catch block in the C++ skeleton. Otherwise everyone would be compelled to 
compile with exception support turned on.

What's the process for new feature requests? Should I create a patch and upload 
it to savannah?

-- john






reply via email to

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