lua-users home
lua-l archive

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


In message <20150416131703.GB25546@inf.puc-rio.br>
          Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

>> 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). 
>
>How does 'fail' (nil) enter into that comparsion?

Oh, sorry! Should be:

if for all strings s either B fails on s or A does not fail and
    B:match(s) <= A:match(s)

As stated this is not computable, of course. But in certain cases
it may be logically equivalent to a computable statement. So
if s and t are strings lpeg.P(s) <= lpeg.P(t) if and only if
s is a prefix of t.
-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/