[antlr-interest] Use @rulecatch but also keep antlr error messages

Karl Hennig karl at karlhennig.com
Tue May 6 13:13:41 PDT 2008


Hello,

I'm using antlr for a configuration file system and have used @rulecatch 
to have exceptions thrown all the way up to me so I can exit on a syntax 
error, disallowing antlr's default attempts to recover.

However, the problem is that when I do that, I lose the useful 
information that antlr provides in addition to the exception itself.  
For example, it would also print something out like this:
line 4:0 mismatched input 'a5' expecting ';'

In looking at the exception raised, I see that it has a property called 
'detailmessage', but in my case it's always null.

How can I get/generate the error output (capture it at a higher level, 
not just printed out) while also letting the exceptions bubble to the top?

Thank you.

Karl


More information about the antlr-interest mailing list