diff options
author | David Mitchell <davem@iabyn.com> | 2018-08-15 18:02:53 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-08-26 20:57:34 +0100 |
commit | 21cbe0098921b51ccea087caa9ad5c71b2cda029 (patch) | |
tree | 9c02a0f2f2bc312bfafd7651d15e484ac0211d23 /regcomp.sym | |
parent | 42f10b3ffcb09f2c3fb2fb2600565b3fe588f922 (diff) | |
download | perl-21cbe0098921b51ccea087caa9ad5c71b2cda029.tar.gz |
S_regmatch(): combine CURLY_B_min/_known states
There are currently two similar backtracking states for simple
non-greedy pattern repeats:
CURLY_B_min
CURLY_B_min_known
the latter is a variant of the former for when the character which must
follow the repeat is known, e.g. /(...)*?X.../, which allows quick
skipping to the next viable position.
The code for the two cases:
case CURLY_B_min_fail:
case CURLY_B_min_known_fail:
share a lot of similarities. This commit merges the two states into a
single CURLY_B_min state, with an associated single CURLY_B_min_fail
fail state.
That one code block can handle both types, with a single
if (ST.c1 == CHRTEST_VOID) ...
test to choose between the two variant parts of the code.
This makes the code smaller and more maintainable, at the cost of one
extra test per backtrack.
Diffstat (limited to 'regcomp.sym')
-rw-r--r-- | regcomp.sym | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/regcomp.sym b/regcomp.sym index 368039539f..6c20e28b8a 100644 --- a/regcomp.sym +++ b/regcomp.sym @@ -255,7 +255,7 @@ WHILEM A_pre,A_min,A_max,B_min,B_max:FAIL BRANCH next:FAIL CURLYM A,B:FAIL IFMATCH A:FAIL -CURLY B_min_known,B_min,B_max:FAIL +CURLY B_min,B_max:FAIL COMMIT next:FAIL MARKPOINT next:FAIL SKIP next:FAIL |