a problem with 1..8

View: New views
4 Messages — Rating Filter:   Alert me  

a problem with 1..8

by Xue-Feng Yang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to parse the language like "1..8" for an index loop. However, I have float literal in the grammar so that JavaCC recognizes "1." as a float literal and it expects ".." before ".8"(again, ".8" is a float literal too.).

How do I resolve this problem?

Thanks.




      __________________________________________________________________
Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: a problem with 1..8

by Laughing Man :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Shouldn't be too hard. Just define another token that looks for two periods.

Place this above the token definition for float literals, and you should be set.

> Date: Mon, 19 Oct 2009 21:59:57 +0000
> From: just4look@...
> To: users@...
> Subject: [JavaCC] a problem with 1..8
>
> I need to parse the language like "1..8" for an index loop. However, I have float literal in the grammar so that JavaCC recognizes "1." as a float literal and it expects ".." before ".8"(again, ".8" is a float literal too.).
>
> How do I resolve this problem?
>
> Thanks.
>
>
>
>
> __________________________________________________________________
> Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>


Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®.

RE: a problem with 1..8

by Xue-Feng Yang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That would be ugly in my case.

Actually, in this language, only number literal is defined as either integer literal or float literal. In other words, there is no difference in language for integer and float. This is a specification.

On the other hand, it's not a good idea to mix token definition and syntax definition.


--- On Mon, 10/19/09, Laughing Man <xuincherguixe@...> wrote:

> From: Laughing Man <xuincherguixe@...>
> Subject: RE: [JavaCC] a problem with 1..8
> To: users@...
> Received: Monday, October 19, 2009, 6:06 PM
>
>
>
>
>  
> Shouldn't be too hard. Just define another token that
> looks for two periods.
>
> Place this above the token definition for float literals,
> and you should be set.
>
> > Date: Mon, 19 Oct 2009 21:59:57 +0000
> > From: just4look@...
> > To: users@...
> > Subject: [JavaCC] a problem with 1..8
> >
> > I need to parse the language like "1..8" for
> an index loop. However, I have float literal in the grammar
> so that JavaCC recognizes "1." as a float literal
> and it expects ".." before ".8"(again,
> ".8" is a float literal too.).
> >
> > How do I resolve this problem?
> >
> > Thanks.
> >
> >
> >
> >
> >      
> __________________________________________________________________
> > Make your browsing faster, safer, and easier with the
> new Internet Explorer® 8. Optimized for Yahoo! Get it Now
> for Free! at
> http://downloads.yahoo.com/ca/internetexplorer/
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@...
> > For additional commands, e-mail:
> users-help@...
> >
>      
> Windows Live Hotmail:  Your
> friends can get your Facebook updates, right from
> Hotmail®.
>


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: a problem with 1..8

by Xue-Feng Yang :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I misunderstood. I'll try.

--- On Mon, 10/19/09, Laughing Man <xuincherguixe@...> wrote:

> From: Laughing Man <xuincherguixe@...>
> Subject: RE: [JavaCC] a problem with 1..8
> To: users@...
> Received: Monday, October 19, 2009, 6:06 PM
>
>
>
>
>  
> Shouldn't be too hard. Just define another token that
> looks for two periods.
>
> Place this above the token definition for float literals,
> and you should be set.
>
> > Date: Mon, 19 Oct 2009 21:59:57 +0000
> > From: just4look@...
> > To: users@...
> > Subject: [JavaCC] a problem with 1..8
> >
> > I need to parse the language like "1..8" for
> an index loop. However, I have float literal in the grammar
> so that JavaCC recognizes "1." as a float literal
> and it expects ".." before ".8"(again,
> ".8" is a float literal too.).
> >
> > How do I resolve this problem?
> >
> > Thanks.
> >
> >
> >
> >
> >      
> __________________________________________________________________
> > Make your browsing faster, safer, and easier with the
> new Internet Explorer® 8. Optimized for Yahoo! Get it Now
> for Free! at
> http://downloads.yahoo.com/ca/internetexplorer/
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@...
> > For additional commands, e-mail:
> users-help@...
> >
>      
> Windows Live Hotmail:  Your
> friends can get your Facebook updates, right from
> Hotmail®.
>


      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now
http://ca.toolbar.yahoo.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...