[antlr-interest] Examining characters in lexer
Dennis Brothers
brothers at bros.com
Thu Mar 12 13:55:23 PDT 2009
Is there a special symbol or method that returns the character about
to be scanned? In order to handle a variety of (natural) languages,
I'd like to use Unicode categories to detect various character types
(particularly letters).
I want to do something like
fragment LETTER : { Char.IsLetter( $char ) } ?=> . ;
where $char is the next character to be scanned and Char.IsLetter() is
a .NET method that examines a character's Unicode category and returns
true if it's one of the letter categories.
While I'm at it, is it legal to use a gated predicate like the above
in a lexer?
Thanks -
- Dennis Brothers
More information about the antlr-interest
mailing list