From 05b13cf680588a26de64f13d2b3be385e17624bc Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Tue, 7 Mar 2023 18:50:04 +0100 Subject: regcomp.c - track parens related to CURLYX and CURLYM This was originally a patch which made somewhat drastic changes to how we represent capture buffers, which Dave M and I and are still discussing offline and which has a larger impact than is acceptable to address at the current time. As such I have reverted the controversial parts of this patch for now, while keeping most of it intact even if in some cases the changes are unused except for debugging purposes. This patch still contains valuable changes, for instance teaching CURLYX and CURLYM about how many parens there are before the curly[1] (which will be useful in follow up patches even if stricly speaking they are not directly used yet), tests and other cleanups. Also this patch is sufficiently large that reverting it out would have a large effect on the patches that were made on top of it. Thus keeping most of this patch while eliminating the controversial parts of it for now seemed the best approach, especially as some of the changes it introduces and the follow up patches based on it are very useful in cleaning up the structures we use to represent regops. [1] Curly is the regexp internals term for quantifiers, named after x{min,max} "curly brace" quantifiers. --- regcomp_debug.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'regcomp_debug.c') diff --git a/regcomp_debug.c b/regcomp_debug.c index b90fe92532..6410f5e2da 100644 --- a/regcomp_debug.c +++ b/regcomp_debug.c @@ -464,6 +464,8 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ } } else if (k == CURLY) { U32 lo = ARG1(o), hi = ARG2(o); + if (ARG3(o) || ARG4(o)) + Perl_sv_catpvf(aTHX_ sv, "<%d:%d>", ARG3(o),ARG4(o)); /* paren before, paren after */ if (op == CURLYM || op == CURLYN || op == CURLYX) Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */ Perl_sv_catpvf(aTHX_ sv, "{%u,", (unsigned) lo); -- cgit v1.2.1