[antlr-interest] warning for 'no lexer rule corresponding to token'

Gavin Lambert antlr at mirality.co.nz
Tue Aug 7 14:01:58 PDT 2007


At 01:37 8/08/2007, Haofei wrote:
>for example, a lexer rule like
>
>COLON    :    ':'        {if (!spaceIsNext()) 
>{$type=COLON_WITH_NO_FOLLOWING_SPACE;}};
>
>if the token is a colon with no following space, I just change it 
>type to that. but when i generate the java code, there's a 
>warning like
>
>warning(105):  no lexer rule corresponding to token: 
>COLON_WITH_NO_FOLLOWING_SPACE

Add COLON_WITH_NO_FOLLOWING_SPACE to your tokens block at the top 
of the file.  Also make sure that no other lexer rules refer to 
it.  It's ok to refer to it from parser rules, though. 



More information about the antlr-interest mailing list