[antlr-interest] White spaces within token definition
Gavin Lambert
antlr at mirality.co.nz
Wed May 7 14:04:11 PDT 2008
At 03:05 8/05/2008, Jim Idle wrote:
>fragment COMMAND
>: 'COMMAND';
>
>COMMAND_EXIT
>: COMMAND
> (
> (' EXIT')=> ' EXIT'
> | { $type = COMMAND; }
> )
>;
>ID : ('A'..'Z'|'a'..'z')+;
>WS: (' '|'\t')+ {$channel=HIDDEN;};
>
>This will produce COMMAND ID when the next sequence is not '
>EXIT';
The OP asked for this to produce ID ID, though, which is what the
snippet I provided should do :)
More information about the antlr-interest
mailing list