develooper Front page | perl.perl5.porters | Postings from July 2013

Re: refactoring of regex execution / calling

Thread Previous | Thread Next
Leon Timmermans
July 31, 2013 08:45
Re: refactoring of regex execution / calling
Message ID:
On Tue, Jul 30, 2013 at 10:20 PM, Dave Mitchell <> wrote:
>     [MERGE] refactor pp_match(), pp_subst(), regexec()
>     Notionally the regexec engine has a well-defined API.
>     In practice, the caller of regexec() (typically pp_match() or pp_subst()),
>     is required to do a lot of set-up before calling regexec(), and some
>     post-processing afterwards; in particular to handle \G, to handle intuit,
>     and to set up $& correctly after an intuit-only match.
>     The series of commits in this branch refactors the code around these three
>     functions so that all the regex "knowledge"  is now contained within
>     regexec() rather than in the calling pp functions. At the same, time the
>     pp functions have been heavily cleaned up and simplified where possible.
>     This reduces the LOC in pp_match() from 305 to 186.

I'm very happy to hear that. I remember trying to use the regexp
engine from an embedded perspective some 4-5 years ago and getting
stuck in having to reuse half of pp_match/pp_subst.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About