[antlr-interest] NoViableAltException not being thrown from Parser

cjack04 cracker_jack_04 at yahoo.com
Tue Aug 31 17:48:51 PDT 2010


I have a grammar file built to validate java style expressions that we submit
to the BeanShell interpreter for excecution. The grammar compiles fine and I
have the Parser & Lexer files which seem to be working fine for most of the
cases. 

My main problem is with the error reporting. I want to collect the parsing
errors for the expression that I validate and I followed the examples on
this page for my error reporting

http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery

I treat the expression as valid if there are no RecognitionErrors thrown &
collected in the parser.

But for some cases with invalid expressions, the NoViableAltException is not
being thrown at all and hence there is no error collection in the parser.
Strange thing is, if I submit the same expression in my eclipse Antlr IDE
environment to the Interpreter, the NoViableAltException shows up as
expected.

I am puzzled as to why the same grammar file works in my eclipse Antlr
Interpreter, but the parser generated from the grammar file does not work
the same way.

Any ideas highly appreciated. Thanks in advance.
-- 
View this message in context: http://antlr.1301665.n2.nabble.com/NoViableAltException-not-being-thrown-from-Parser-tp5485028p5485028.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list