[antlr-interest] How catch exception when "extraneous input" happens?

BiGNoRm6969 normand.bedard at gmail.com
Thu Jun 10 07:09:05 PDT 2010


During a string validation, I receive this message "line 1:20 extraneous
input 'f' expecting ASA" in the console. This is printed by the
"getErrorMessage" function, initiated by the "match" function. I understanrd
why this message is displayed. 

My problem is that I want to catch the error generated by the parser. I
include this code in my .g:

@rulecatch {
       catch ( RecognitionException testing ) {
           throw testing;
       }
  }

I also include a try/catch block in my Java code that use my parser, to
catch the RecognitionException exception. However, it never catch it. So, my
program is unable to know if the validation succeed or not.

What I am  missing?


-- 
View this message in context: http://antlr.1301665.n2.nabble.com/How-catch-exception-when-extraneous-input-happens-tp5163385p5163385.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list