[antlr-interest] White spaces not allowed

Dominic Tardif Dominic.Tardif at USherbrooke.ca
Wed Jan 14 11:08:22 PST 2009


OK, I've tried what you suggested and, for the most part, it works.  There's 
just a little problem with this: the WS as an operator, if there is one, is 
not present in the AST.  How can I put it in the AST?  Better yet, how can I 
rewrite the rule so that I can see it as a '*' operator in the AST?  Thanks 
again for all your help!!! ^_^

Dominic

P.S.: If it has something to do with the hidden channel, I'm kind of 
confused on how to access it, let alone use it.  Thanks!

--------------------------------------------------
From: "micha" <micha-1 at fantasymail.de>
Sent: Tuesday, January 13, 2009 3:22 AM
To: <antlr-interest at antlr.org>
Subject: Re: [antlr-interest] White spaces not allowed

> 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
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> 



More information about the antlr-interest mailing list