3926Re: [antlr-interest] Re: how do i skip unmatched characters?
- Jul 2, 2001Ric,
> Doh! What version of antlr are you using one of my snapshots? According toI'm using standard 2.7.1, but it's also turned off in the patched versions
> the docs it should be on by default?
(and also in version 2.6.0).
I just checked the documentation again and it seems the documentation
doesn't literally say it's "on" but it does suggest it in "err.html" under
Exception Handling in the Lexer":
"Normally you want the lexer to keep trying to get a valid token upon
lexical error. That way, the parser doesn't have to deal with lexical
and ask for another token ...... To get ANTLR to generate lexers that
pass on RecognitionException's to the parser as TokenStreamException's,
use the defaultErrorHandler=false grammar option."
However, the documentation in "options.html" mentions that "ANTLR
will generate default exception handling code for a parser or tree-parser
It doesn't say that a default error handler is generated for lexers, so it
seems I was wrong with my assumption that Antlr will also generate
a default error handler for lexers (although I still think the current
is not logical).
Note that the lexer of Antlr itself (in antlr.g) doesn't use a default
error handler. Sometimes I get unmatched character exceptions with
ANTLR where it doesn't report the linenumber. Turning error handling
on would solve that problem.
Again, thanks for your advise!
- << Previous post in topic Next post in topic >>