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

3947Re: [antlr-interest] RFC: defaulterrorhandler [WAS: Re: how do i skip unmatched characters?]

Expand Messages
  • Stdiobe
    Jul 4, 2001
    • 0 Attachment
      Ter,

      > However, without that possibility I think the default behaviour for
      > defaultErrorHandler should be "on". If needed I can turn it off for
      > protected rules to force exact matches (and if I don't, then mismatches
      > will at least be reported to the user so they know something is wrong,
      > and they get file/line information for locating the error).

      I finally figured it out .... the answer was there all the time; I just
      didn't see it.

      All that was needed was:
      - "filter = UNKNOWN_TOKEN"
      - UNKNOWN_TOKEN : . {issue message} ;
      - don't call setCommitToPath so the lexer will try again.

      Given this solution, I must conclude that the current behaviour of the
      lexer is indeed desired and no changes in the generator are needed.

      However, it would be nice if:
      - the documentation was more clear about the error handling behaviour
      of the lexer (i.e. mention explicitly that lexer does not default to error
      handling).
      - the Antlr generator itself should include such a rule, so that unmatched
      characters are reported including linenumber.

      Sorry for the trouble, thanks for your response,

      Stdiobe.
    • Show all 19 messages in this topic