[antlr-interest] newbie question

Rolf Schumacher mailinglist at august.de
Fri Apr 9 02:18:59 PDT 2004


Even though I solved my problem I'd like to be able to understand 'why':

Why this rule does not work?:

LINECHAR: ~'\n';

while this is working:

LINECHAR: '\u0000'..'\u0009' | '\u000b'..'\uffff';

I would expect identical behavior from both lexer rules.
The answer must be simple, though I read several days thru the docs
and could not find it. Can you help me?

Rolf

p.s. ---------------
The full story: this works:
--------------------
class WParser extends Parser;
text    :   ( LINE )+ ;

class WLexer extends Lexer;
protected
LINECHAR:   '\u0000'..'\u0009' | '\u000b'..'\uffff'
          // putting ~'\n' here does not work, why??
      ;
LINE    :   (LINECHAR)+ {System.out.println(getText());} ;
WS      :   '\n' { _ttype = Token.SKIP; newline(); } ;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 1730 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040409/69a5e0a1/smime.bin


More information about the antlr-interest mailing list