Loading ...
Sorry, an error occurred while loading the content.

3924Re: [antlr-interest] Re: how do i skip unmatched characters?

Expand Messages
  • Stdiobe
    Jul 2, 2001
    • 0 Attachment

      > How did you setup your exception handling in the lexer? e.g.
      > defaultErrorHandler true or false? My guess is that you have it turned

      I don't use the "defaultErrorHandler" option so I'm getting the default
      behaviour, which I thought was "on", but I just checked and it turns
      out the default behaviour is "off"! That sucks!

      After specifying defaultErrorHandler = "true" I get the desired behaviour.

      I've checked the source code of ANTLR and found that class LexerGrammar
      turns the defaultErrorHandler off. That's not mentioned anywhere in the
      documentation! Also, I can't think of any reason why this is turned "off" by

      Many thanks for the advise!

      > -------snip---
      > Parsing...
      > int aƩ;
      > line 1:6: unexpected char: 0xE9
      > ------snip----
      > (the 0xE9 is devel snapshot output of 'unprintable' chars, parsing
      > after this error)
      > This is with the following relevant options:
      > charVocabulary= '\u0000' .. '\u00FF';
      > defaultErrorHandler = true;
      > If you need defaultErrorHandler false you need to fix the error outside
      > lexer (the reason for my aside remark above). I'm not 100% sure where in
      > the path to the parser the most practical place is to catch this beast.
      > Relevant files would be the inputbuffer/charbuffer/sharedinputstate files.
      > Maybe its better to have defaultErrorHandler set to true and override per
      > rule (for as far as possible).
      > Groetsels,
      > Ric
      > --
      > -----+++++*****************************************************+++++++++--
      > ---- Ric Klaren ----- klaren@... ----- +31 53 4893722 ----
      > -----+++++*****************************************************+++++++++--
      > Why don't we just invite them to dinner and massacre them all when
      > drunk? You heard the man. There's seven hundred thousand of them.
      > Ah? ... So it'd have to be something simple with pasta, then.
      > --- From: Interesting Times by Terry
      > -----+++++*****************************************************+++++++++--
      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Show all 19 messages in this topic