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

Góra strony
Delete this message
Autor: ND
Data:  
Dla: Pcre-dev
Temat: Re: [pcre-dev] (*SKIP:NAME) when (*MARK:NAME) is in assertion
On 2018-07-14 15:12, ph10 wrote:

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


Sorry. I'm not С programmer.


> 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.
>


I wonder that engine not doing something special.
Consider this example:

PCRE2 version 10.31 2018-02-12
/(*NO_START_OPT)\A(?>(*:1)a)((*:2)x|)/mark
ab
0: a
1:
MK: 1


Resulting mark is "1" when no backtracking is allowed to it.
So I can guess PCRE do a special: it copies a pointers to mark names to
another memory places. May be it copies pointer to current mark in every
backtracking frame. May be something else *special* tactic.
Isn't it?



> 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).../
>


Now I don't see any extended backtracking needs. Only unsetting of
"Mark-Position" fields of table.


Howbeit I see that such changes can be made in theory only after Perl
changed accordingly. I can't neither report to Perl authors about this
weird and unobvious behavior, nor programming in C.

So you free to close this topic.