[antlr-interest] mismatched character
ian eyberg
ian at telematter.com
Thu Jan 8 10:47:18 PST 2009
>Hi list,
> I have a problem with a very simple
>grammar. Whenever I try to uncomment the
>lexer rule, ANTE, to this grammar it spits out a
>
>line 1:18 mismatched character 's' expecting 'n'
>
>
>test file:
>*** TURN *** [Ad As 6d] [Ts]
>
>the grammar:
>
>
>grammar Blah;
>options {language=Java;}
>
>line : caction .* NEWLINE
> { System.out.println("YO"); } ;
>
>caction : TURN cards '] [' ca=cards ']'
> { System.out.println($ca.text); } ;
>
>cards : ((ALPHA | INT) WS?)+ ;
>
>fragment LOWER_LETTER : 'a'..'z' ;
>fragment UPPER_LETTER : 'A'..'Z' ;
>ALPHA : (LOWER_LETTER | UPPER_LETTER)+ ;
>
>COMMA_SP: ',' ' ' ;
>
>fragment DIGIT : '0'..'9' ;
>INT : DIGIT+ COMMA_SP?;
>
>NEWLINE : '\r'? '\n' ;
>
>WS : ' '+ ;
>COLON_SPACE : ': ' ;
>
>TURN : '*** TURN *** [' ;
>//ANTE : ' Ante ' ;
>
>
>
>Can anyone spot the obvious that I'm missing?
>
>Thanks,
>Ian
I figured it out ...
I re-arranged the grammar to have the
ANTE token by itself with no spaces and
used the WS token surrounding it instead.
Thanks,
Ian
More information about the antlr-interest
mailing list