[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.
> > 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
isNullable() would mean nullable with respect to the children not the
attributes, ie
isNullable("<attribute/>") would be true
> 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.
Yes, but that would only make a difference if that groups is in turn inside
a group:
<group><group>p1 p2</group> p3</group>
The outer group would then check whether the inner group is nullable, and
max with p3 if it was.
James
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC