[antlr-interest] What does " The following alternatives can never be matched" mean
Gavin Lambert
antlr at mirality.co.nz
Wed Dec 2 01:45:32 PST 2009
At 20:30 2/12/2009, David-Sarah Hopwood wrote:
>You probably want these to be lexer rules, i.e.
>
> prog : command+ ;
> command : (Function | Var)+ ;
>
> Function : ('A'..'Z')+ ',' ;
> Var : ('A'..'Z')+ ;
> WS : ( '\t'|' '|'\r'|'\n'|'\u000C' )+ { $channel =
HIDDEN;
>} ;
Actually it's probably better to keep function/var out of the
lexer:
prog : command+ ;
command : (function | var)+ ;
function : ID COMMA ;
var : ID ;
fragment Letter : 'A'..'Z';
COMMA : ',' ;
ID : Letter+ ;
WS : ( '\t'|' '|'\r'|'\n'|'\u000C' )+ { $channel = HIDDEN; }
More information about the antlr-interest
mailing list