[antlr-interest] ANTLR or ANTLR Eclipse plugin bug

Martin Olsson mnemo at minimum.se
Tue Aug 9 05:02:05 PDT 2005

> It seems to be a bug in the code gen. The recover() method is used
> inside the parser.
> The lexer as such i dont think can recover the lexing of the same
> token. if something screws up, it will just skip that char to find the
> next token.
> Seeing this I believe the defaultErrorHandler option should be
> disallowed for lexer rules.

Having no defaultErrorHandler option specified at all makes my lexer stop
lexing whenever it runs into a char that is not part of any rule. Having
set defaultErrorHandler=false gives the same result. However, setting
defaultErrorHandler=true and implementing a dummy method recover() in the
lexer get's the job done. Having the dummy method feels ugly though, and
just as you say I also believe that this might be a code generation bug of
some sort.

However, I don't believe just removing defaultErrorHandler would solve all
problems (not mine atleast). I think, the lexer error handling needs to be
implemented so that it does what it suppose to do accoring to docs, ie it
should not stop lexing/parsing when it runs into obscure unknown chars.

That's my $0.02 =)


More information about the antlr-interest mailing list