Re: Implementing Equality Expressions...

Subject: Re: Implementing Equality Expressions...
From: James Clark <jjc@xxxxxxxxxx>
Date: Sat, 02 Jan 1999 09:09:01 +0700
I don't understand exactly what the problem you're having is, but there
are a couple of tricks you can use to parse And/Or expressions:

- one is to keep some state in the lexer; this is the way the spec does
it: "An OperatorName token is recognized only when there is a preceding
token and the preceding token is not one of @, /, |, (, [ or an
OperatorName."

- the other is to parse a BooleanExpr as if it were

BooleanExpr ::= BooleanPrimaryExpr (Name BooleanPrimaryExpr)*

and then check separately that each Name is either "and" or "or" and are
not mixed in a BooleanExpr (this is what I do in XT)/

Tyler Baker wrote:
> 
> In the XSL Spec Boolean Expressions are defined as follows...
> 
> BooleanExpr ::= AndExpr | OrExpr | BooleanPrimaryExpr
> BooleanPrimaryExpr ::= BooleanGroupExpr | NotExpr | PositionalExpr |
> TestExpr | EqualityExpr
> 
> When trying to parse an equality expression directly, I have found that
> it is very difficult to separate the SelectExpression from the Literal
> when and expressions or or expressions are also present.
> 
> The algorithm I use is basically is to find the first '=' that is not in
> a nested expression "anything inside '(' and ')'" and not inside a
> literal.  The problem arises is that if you encounter an "and" or an
> "or" then you will

Part of the sentence seems to be missing.

James



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread