[antlr-interest] HOW To catch error (no exception is thown)
Guntis Ozols
guntiso at latnet.lv
Tue Apr 22 15:54:11 PDT 2008
> thanks a lot, that work .I ve just put
>
> public void reportError (RecognitionException re){
> throw new RuntimeException("Bailing out!");
> }
>
> in member in parser.I have no information on the error but i have an
> error (it still that).
>
> PS: I use antwork 1.1.7
>
> a+++
Since java 1.4, the preferred way would be:
throw new RuntimeException("Lexing problem!", re);
Then, with some effort, you can get line/char/token info
(another 'feature' of antlr is that getMessage() and
getLocalizedMessage() does not work properly for exceptions.
getMessage(ResourceBundle res) is missing, too).
More information about the antlr-interest
mailing list