[antlr-interest] Handling HASEXCEPTION / HASFAILURE
Andy Grove
andy.grove at codefutures.com
Thu Jul 30 07:40:36 PDT 2009
Jim,
Thanks. Could you point me in the direction of the documentation for
setting up these error message routines. I could not find anything on
the ANTLR web site about this (apart from Java specific information).
Thanks,
Andy.
On Jul 28, 2009, at 11:40 AM, Jim Idle wrote:
> 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/20090730/14ddb0aa/attachment.html
More information about the antlr-interest
mailing list