[antlr-interest] Handling HASEXCEPTION / HASFAILURE

Jim Idle jimi at temporal-wave.com
Tue Jul 28 10:40:57 PDT 2009


The calling rule will make a call to the error message routines so  
check your stack there. But really you should parse, build a tree then  
do this in the tree walk and you won't have the issue.

Jim

On Jul 28, 2009, at 2:21 AM, Andy Grove <andy.grove at codefutures.com>  
wrote:

> 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/bd9c921b/attachment.html 


More information about the antlr-interest mailing list