71 lines
1.9 KiB
Diff
71 lines
1.9 KiB
Diff
|
Change 33324 by demerphq@demerphq-gemini on 2008/02/17 15:39:22
|
||
|
|
||
|
Fix perlbug 50114 and document what the code does a bit better
|
||
|
|
||
|
Affected files ...
|
||
|
|
||
|
... //depot/perl/regcomp.c#650 edit
|
||
|
... //depot/perl/t/op/re_tests#129 edit
|
||
|
|
||
|
Differences ...
|
||
|
|
||
|
==== //depot/perl/regcomp.c#650 (text) ====
|
||
|
|
||
|
--- regcomp.c.orig
|
||
|
+++ regcomp.c
|
||
|
@@ -4462,7 +4462,17 @@
|
||
|
regnode *first= scan;
|
||
|
regnode *first_next= regnext(first);
|
||
|
|
||
|
- /* Skip introductions and multiplicators >= 1. */
|
||
|
+ /*
|
||
|
+ * Skip introductions and multiplicators >= 1
|
||
|
+ * so that we can extract the 'meat' of the pattern that must
|
||
|
+ * match in the large if() sequence following.
|
||
|
+ * NOTE that EXACT is NOT covered here, as it is normally
|
||
|
+ * picked up by the optimiser separately.
|
||
|
+ *
|
||
|
+ * This is unfortunate as the optimiser isnt handling lookahead
|
||
|
+ * properly currently.
|
||
|
+ *
|
||
|
+ */
|
||
|
while ((OP(first) == OPEN && (sawopen = 1)) ||
|
||
|
/* An OR of *one* alternative - should not happen now. */
|
||
|
(OP(first) == BRANCH && OP(first_next) != BRANCH) ||
|
||
|
@@ -4474,16 +4484,17 @@
|
||
|
(PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||
|
||
|
(OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))
|
||
|
{
|
||
|
-
|
||
|
+ /*
|
||
|
+ * the only op that could be a regnode is PLUS, all the rest
|
||
|
+ * will be regnode_1 or regnode_2.
|
||
|
+ *
|
||
|
+ */
|
||
|
if (OP(first) == PLUS)
|
||
|
sawplus = 1;
|
||
|
else
|
||
|
first += regarglen[OP(first)];
|
||
|
- if (OP(first) == IFMATCH) {
|
||
|
- first = NEXTOPER(first);
|
||
|
- first += EXTRA_STEP_2ARGS;
|
||
|
- } else /* XXX possible optimisation for /(?=)/ */
|
||
|
- first = NEXTOPER(first);
|
||
|
+
|
||
|
+ first = NEXTOPER(first);
|
||
|
first_next= regnext(first);
|
||
|
}
|
||
|
|
||
|
|
||
|
==== //depot/perl/t/op/re_tests#129 (text) ====
|
||
|
|
||
|
--- t/op/re_tests.orig
|
||
|
+++ t/op/re_tests
|
||
|
@@ -1341,3 +1341,6 @@
|
||
|
.*\z foo\n y - -
|
||
|
^(?:(\d)x)?\d$ 1 y ${\(defined($1)?1:0)} 0
|
||
|
.*?(?:(\w)|(\w))x abx y $1-$2 b-
|
||
|
+
|
||
|
+0{50} 000000000000000000000000000000000000000000000000000 y - -
|
||
|
+
|