Re: [pcre-dev] Quantifying backtracking verbs

Kezdőlap
Üzenet törlése
Szerző: ph10
Dátum:  
Címzett: ND
CC: Pcre-dev
Tárgy: Re: [pcre-dev] Quantifying backtracking verbs
On Wed, 19 Jun 2019, ND via Pcre-dev wrote:

> (*ACCEPT) can't leave lookaround borders. So ACCEPT's that are inside
> lookarounds can't influence minimum length claculation, if lookaround entrails
> are not participate in this calculation (is this true?).
>
> Thus more preferable may be to turn off minimum length scan not for all
> patterns that have ACCEPT. But only for patterns with at least one ACCEPT that
> is not inside a lookaround. Of course if it's easy to distinguish such
> ACCEPT's.


At present, lookarounds do not take part in minimum length calculations,
though I have been wondering if there is an easy way to make use of
positive lookaheads. I am not sure that there is an easy way, and I am
also not sure whether it is worth doing in any case. How often would it
matter?

Unfortunately, it isn't simple to distinguish ACCEPT's in assertions
when compiling. The current code sets a flag for all ACCEPTs (which is
very simple - one line of code). Again, I am not sure whether doing a
lot of work for this case is worth it - and there is also the case of
ASSERT in a non-assertion that is called as a subroutine from inside an
assertion. Actually, I suppose that wouldn't matter - it would cause the
scan to be disabled, which does no harm. However, my point is that this
can get rather complicated, which makes it error-prone.

Philip

--
Philip Hazel