[antlr-interest] Why does it silently ignore invalid input?

Brian Smith brian-l-smith at uiowa.edu
Wed Jun 4 10:54:30 PDT 2003


If you want ANTLR to try to match everything up through the end of the 
input, you need to make sure that your start rule(s) end with EOF:

If you have a start rule like:

      a: b c d ;

you probably want:

      a: b c d EOF ;

I don't know if this is your exact problem but it seems like it matches 
the symptoms you are describing.

- Brian

mzukowski at yci.com wrote:
> Try turning off the default error handler with the option
> {defaultErrorHandler=false;}
> 
>> From: Paul J. Lucas [mailto:dude at darkfigure.org] 
>> Subject: [antlr-interest] Why does it silently ignore invalid input?
> 
>> I have a grammar with a second entry-point that I call.  In my grammar,
>> "DECLARE" is a keyword (must be upper-case).  When the generated
 >> parser encounters "declare" (lower-case), it simply breaks
 >> out of the parse loop and returns.  Why doesn't it throw an
 >> exception?





 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list