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

For each construct

From: Jonas Sicking <sicking@bigfoot.com>
Date: Mon, 18 Mar 2002 14:06:01 +0100
Message-ID: <003001c1ce7d$a7617360$b3e0d0d9@telia.com>
To: <www-xpath-comments@w3.org>
Cc: "Kay, Michael" <Michael.Kay@softwareag.com>
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
> 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 08:00:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:42 UTC