[antlr-interest] White spaces not allowed

micha micha-1 at fantasymail.de
Tue Jan 13 00:22:23 PST 2009


On Monday 12 January 2009 21:59:12 Dominic Tardif wrote:

>
> OK, I've removed the NEWLINE token and changed stmt+ by stmt* and it works
> just fine, except that I want to be able to support the ' ' operator, which
> acts like a '*'.  If I didn't support it, I don't think I would have had
> any problems. Is there a way to have a white space act as an operator as
> well? If not, I'll just have to remove it. Thanks again for all your help!
> ^_^

maybe (i.e. not tested, just the idea):

WS:  (' ' | '\t' )+ { channel=hidden;}

and:

multExpr: phase ('*'? phase)*

then WS is allowed as '*' .  You can check the hidden channel, if it was 
exactly one ws.

Michael



More information about the antlr-interest mailing list