Re: [pcre-dev] (*SKIP:NAME) when (*MARK:NAME) is in assertio…

Top Page
Delete this message
Author: ph10
Date:  
To: ND
CC: Pcre-dev
Subject: Re: [pcre-dev] (*SKIP:NAME) when (*MARK:NAME) is in assertion
On Sat, 14 Jul 2018, ND via Pcre-dev wrote:

> It seems instead of maintaining only MarkNames PCRE can maintain a table with
> MarkName-MarkPosition pares. And so not have need to backtrack to access MARK
> position data. And not loose MarkPosition information.


Feel free to look at the code and suggest patches. However, I don't
think is is easy.

At present, the matching engine does everything by backtracking. Note
that this gives the same results as Perl. It doesn't have to do anything
special when it passes a (*MARK:NAME) other than record a backtracking
point. Then when (*SKIP:NAME) is triggered, it backtracks till it hits a
matching (*MARK:NAME) and then the current position in the subject is
where to bumpalong to.

Keeping a separate table would require memory management, and its own
backtracking mechanism! If a branch that contains a (*MARK:NAME) fails
to match, the (*MARK) must be forgotten. Consider

/(xxx(*MARK:A)xxx|yyy(*MARK:A)yyy)...(*SKIP:A).../

The *SKIP must activate whichever MARK matched, because they may have
different bumpalong points. I think what you are suggesting would be
very difficult to implement.

Philip

--
Philip Hazel