[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Prefixes of Lpeg patterns
- From: Gavin Wraith <gavin@...>
- Date: Thu, 16 Apr 2015 13:29:05 +0100
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/