Re: [pcre-dev] Remove some restrictions of lookbehind assert…

Página Principal
Apagar esta mensagem
Autor: ND
Data:  
Para: Pcre-dev
Assunto: Re: [pcre-dev] Remove some restrictions of lookbehind assertions
On 2019-07-29 10:45, Zoltán Herczeg wrote:

>I am open to other names, but I would propose the following control
> verbs:
>(*MOVE:mark_name)
> - This verb changes the current string position to the position
> recorded by the last mark which name is mark_name.
>(*SETEND:mark_name)
> - This verb changes the end position to the position recorded by the
> last mark which name is mark_name. If the position is smaller than the
> current string position, it is set to the current string position.
>With these two opcodes you can move back in the string and you can even
> match parts of it again in a quite flexible way.



I think MOVE verb like a goto operator in programming languages impacts
the clarity of pattern structure and make it error-prone. It is
undesirable in my opinion.

It seems that very specific SETEND verb needed only in matching pattern in
another pattern. But with this verb user must think not in terms of
pattern structure but also with GOTO-like terms.

I think it will be better to use standard "(?<=)" for lookbehinds, not
MOVE+SETEND.

MOVE and SETEND can exist in somehow internal PCRE level, not at userlevel
I think.
For example
(?=X) internally may be syntactic sugar for (?>(*:M1)X(*MOVE:M1))
(?<=X) - for (?>(*:M1)(*:MOVE)(*SETEND:M1)(?:X)\z(*SETEND))