Re: [pcre-dev] Why recursion occurs?

Góra strony
Delete this message
Autor: Philip Hazel
Data:  
Dla: ND
CC: Pcre-dev
Temat: Re: [pcre-dev] Why recursion occurs?
On Sun, 24 Apr 2011, ND wrote:

> Good day!
>
> Here is pcretest.exe listing:
>
> PCRE version 8.11 2010-12-10
> /(a)/
> \Ma
> Minimum match() limit = 3
> Minimum match() recursion limit = 2
> 0: a
> 1: a
>
> Documentation at "PCRE DISCUSSION OF STACK USAGE" chapter says:
> "When you call pcre_exec(), it makes use of an internal function called
> match(). This calls itself recursively at branch points in the pattern, in
> order to remember the state of the match so that it can back up and try a
> different alternative if the first one fails."
>
> Why recursion limit in the above example is greater then 1? Why a branch point
> created?


The explanation is not complete. I will add a sentence that says
something like "The match() function is also called in other
circumstances, for example, whenever a parenthesized sub-pattern is
entered and in certain cases of repetition."

Philip

--
Philip Hazel