W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

RE: For each construct

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Mon, 18 Mar 2002 20:25:53 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210602679CD2@daemsg02.software-ag.de>
To: "'Jonas Sicking'" <sicking@bigfoot.com>, www-xpath-comments@w3.org
Cc: "Kay, Michael" <Michael.Kay@softwareag.com>
A number of different syntaxes have been proposed for a "for" construct
without range variables. Some of these are keyword based, some use
operators. We still have an open issue as to whether we want to provide such
a construct; I think the sentiment in the group is probably that we can
manage without it.

Michael Kay

> -----Original Message-----
> From: Jonas Sicking [mailto:sicking@bigfoot.com]
> Sent: 18 March 2002 13:06
> To: www-xpath-comments@w3.org
> Cc: Kay, Michael
> Subject: For each construct
> 
> 
> I pondered this discussion the other day and had some more thoughts.
> > > How about a 'foreach' construct? So one could write
> > >
> > > sum(foreach //item return quantity * USPrice)
> > >
> > > Shouldn't that avoid any parsingproblems?
> > >
> > Unfortunately not. It requires either lookahead or reserved 
> words: you
> can't
> > tell until you hit the "return" that foreach//item isn't a 
> relative path
> > expression.
> 
> shouldn't this work:
> 
> for each //item return quantity * USPrice
> 
> I am admittedly not very well versed in lexers/parsers, but 
> it seems like if
> a lexer is able to tokenize "cast as" without lookahead, then 
> it should be
> able to interpret "for each" as well?
> 
> / Jonas Sicking
> 
Received on Monday, 18 March 2002 14:25:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:54 GMT