[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Prefixes of Lpeg patterns
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 16 Apr 2015 11:23:36 -0300
> 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.
I don't think that is true. match("a", "a") returns 2, but match("ab",
"a") fails; so, by your definition, match("a", "a") </= match("ab", "a").
(and, so, lpeg.P("a") </= lpeg.P("ab")). ('</=' stands for 'not <='...)
-- Roberto