[antlr-interest] Handling HASEXCEPTION / HASFAILURE

Andy Grove andy.grove at codefutures.com
Tue Jul 28 05:21:25 PDT 2009


Because the C version of ANTLR does not support @after actions, I have  
implemented the equivalent in my grammar by placing a block of code at  
the end of my rule. For example:

whereClause
@init { sse.pushCall(sse.WHERECLAUSE); }
	:
	(
	WHERE
		c = searchCondition
      )
      { sse.popCall(); } <-- @after action
	;

I noticed that this @after action was not running for some of my input  
data, so I added debug logging to the generated parser code and found  
that one of the calls to the HASEXCEPTION macro is returning true and  
the parser is finishing at that point.

How am I supposed to detect if an exception like this has occurred and  
how do I find out what is causing the exception?

Thanks,

Andy.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090728/cb5c2881/attachment.html 


More information about the antlr-interest mailing list