[antlr-interest] Regarding handling of special characters

Gavin Lambert antlr at mirality.co.nz
Wed Apr 29 01:29:20 PDT 2009


At 17:18 29/04/2009, Simon, Peter wrote:
>you can specify the special characters in your 
>lexer rules as Unicode.
>For example: '\u00dc' for ‘Ü‘
>It’s also possible to define ranges like: '\u00a0'..'\u00ff'

Also, if you specify the following as your last lexer rule:

OTHER : . ;

then you will get an OTHER token instead of a 
lexer error on encountering an unexpected 
character.  This usually will in turn mean that 
you'll be able to provide better error messages 
(since the parser or tree parser will have better 
information about the context).



More information about the antlr-interest mailing list