Re: [xsl] Re: FXPath - A comment on EXSL

Subject: Re: [xsl] Re: FXPath - A comment on EXSL
From: "David Rosenborg" <david.rosenborg@xxxxxxxxxx>
Date: Thu, 1 Mar 2001 15:29:00 +0100
Hi Jeni,

> I thought that single token lookahead had something to do with only
> needing to look ahead a single token to be able to work out what a
> token means. Perhaps my naivety is showing through, but in your
> example:
> > or and and or and or or and or
> then you *know* that the first 'or' must be an element name because if
> it were an operator name then it would have something in front of it,
> so you *know* that the first 'and' has to be an operator name, so you
> *know* that the second 'and' has to be an element name and so on. So
> you can tokenise it all successfully before working out what kind of
> expression has priority.

Ok, I just wanted to give an example of how precedence rules works.
The lookahead issue was examplified in an earlier post:

true ()

When the parser sees the 'true' token it cannot yet know if this is a node test
for the element 'true' or if it will be the 'true' function call. It must look
one token ahed, '(' in this case, to make that decision.

> With:
>    if and then * else - 2

When the parser sees 'if', it must look one token ahead. If that token doesn't
continue this subexpression and the end of the expression isn't reached,
then we know for sure that this is the first keyword in a conditional expression.



David Rosenborg
Pantor Engineering AB

 XSL-List info and archive:

Current Thread