lua-users home
lua-l archive

Re: Prefixes of Lpeg patterns

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2015年04月16日 14:29 GMT+02:00 Gavin Wraith <gavin@wra1th.plus.com>:
> Let us say that if A and B are Lpeg patterns without captures that
> B is a prefix of A (write B <= A) if for all strings s
> B:match(s) <= A:match(s).
>
> I think it is then the case that:
>
> <= is transitive and reflexive
> for any Lpeg patterns X,Y without captures X <= X*Y
> for any Lpeg patterns X,Y,U,V without captures
> X <= Y & U <= V implies X + U <= Y + V
> X <= Y implies X - U <= Y - U
>
> Query: Given an Lpeg pattern A and a string s is there a minimal
> prefix B of A for which B:match(s) = A:match(s), in the sense that
> for any prefix C of A for which C:match(s) = A:match(s) we must
> have B <= C?
Some concrete examples would be a useful aid to discerning
the full inwardness of this query.

AltStyle によって変換されたページ (->オリジナル) /