[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: Alternative algorithm to restrict use of data/string in patterns.
> If we consider the three states to be ordered:
>
> element < anyString < text
>
> Then the "OR" operation is just max. Right?
Exactly. max is probably intuitive and more understandable.
I started this algorithm with two states (element as false and text as
true). That's why OR is used.
> Would another way to do it be to have calcFPDS just take s single argument
> and for group to do
>
> if (p is <group>p1 p2</group>) {
> if (isNullable(p1))
> return calcFPDS(p1) || calcFPDS(p2);
> else
> return calcFPDS(p1);
> }
>
> where isNullable(p) checks whether p can match the empty sequence (and any
> atts)?
No. Firstly, there are two patterns that needs the second fpds parameter.
if(p is "<attribute />")
return fpds
if( p is <empty/> )
return fpds
Secondly, in case of <group> p1 p2 </group>, p2 may also be nullable
(AKA epsilon-reducible). In that case, we still need the second
parameter.
--
Kohsuke KAWAGUCHI +1 650 786 0721
Sun Microsystems kohsuke.kawaguchi@eng.sun.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC