lua-users home
lua-l archive

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


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?

-- 
Gavin Wraith (gavin@wra1th.plus.com)
Home page: http://www.wra1th.plus.com/