[antlr-interest] How to the generated code in the "catch" section ?

Terence Parr parrt at cs.usfca.edu
Thu Feb 28 18:15:49 PST 2008


On Feb 28, 2008, at 6:05 PM, Olivier Lefevre wrote:

> Gavin Lambert wrote:
>> It's syntactically valid but last time I checked ANTLR3 didn't  
>> actually do anything with the catch blocks.  (ANTLR2 does support  
>> it, and ANTLR3 will support it, but I don't think it does yet.)
>
> With regard to parser errors, experimentation shows that in ANTLR  
> 3.0.1
> 1) a global directive of the form
>       @rulecatch { catch (RecognitionException e) { } }
>   works
> 2) a local directive of the form
>       catch [RecognitionException e] { } directive
>   works and has higher precedence than the global directive if present
> 3) a local directive of the same form as the global directive is  
> accepted
>   but does nothing
> The last point is weird. Ter?

I currentlydon't check action names for validity. target dev folks can  
use which ones they want...i'll add in future a check.
Ter


More information about the antlr-interest mailing list