[antlr-interest] White spaces within token definition

Jim Idle jimi at temporal-wave.com
Wed May 7 14:24:34 PDT 2008


No, I think he said he wanted COMMAND ID didn't he? Anyway, he seems to be on track now :-)

Jim

> -----Original Message-----
> From: Gavin Lambert [mailto:antlr at mirality.co.nz]
> Sent: Wednesday, May 07, 2008 2:04 PM
> To: Jim Idle; antlr-interest at antlr.org
> Subject: Re: [antlr-interest] White spaces within token definition
> 
> 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