[antlr-interest] mismatched character

ian eyberg ian at telematter.com
Thu Jan 8 09:12:43 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


More information about the antlr-interest mailing list