>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 List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---