Skip to content

Commit

Permalink
Merge e44cffb into 08e4a1e
Browse files Browse the repository at this point in the history
  • Loading branch information
hvds committed May 28, 2021
2 parents 08e4a1e + e44cffb commit a3c98e2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
26 changes: 20 additions & 6 deletions regcomp.c
Expand Up @@ -6336,20 +6336,34 @@ Perl_re_printf( aTHX_ "LHS=%" UVuf " RHS=%" UVuf "\n",
*(data->last_closep) = ARG(scan);
}
else if (OP(scan) == EVAL) {
if (data)
data->flags |= SF_HAS_EVAL;
if (data)
data->flags |= SF_HAS_EVAL;
}
else if ( PL_regkind[OP(scan)] == ENDLIKE ) {
if (flags & SCF_DO_SUBSTR) {
scan_commit(pRExC_state, data, minlenp, is_inf);
flags &= ~SCF_DO_SUBSTR;
}
if (data && OP(scan)==ACCEPT) {
data->flags |= SCF_SEEN_ACCEPT;
if (stopmin > min)
stopmin = min;
if (OP(scan) == ACCEPT) {
/* m{(*ACCEPT)x} does not have to start with 'x' */
flags &= ~SCF_DO_STCLASS;
if (data) {
data->flags |= SCF_SEEN_ACCEPT;
if (stopmin > min)
stopmin = min;
}
}
}
else if (OP(scan) == COMMIT) {
/* gh18770: m{abc(*COMMIT)xyz} must fail on "abc abcxyz", so we
* must not end up with "abcxyz" as a fixed substring else we'll
* skip straight to attempting to match at offset 4.
*/
if (flags & SCF_DO_SUBSTR) {
scan_commit(pRExC_state, data, minlenp, is_inf);
flags &= ~SCF_DO_SUBSTR;
}
}
else if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */
{
if (flags & SCF_DO_SUBSTR) {
Expand Down
5 changes: 5 additions & 0 deletions t/re/opt.t
Expand Up @@ -268,3 +268,8 @@ acdef|bcdeg 5 1+cde - Tanchored,stclass=~[ab]
a(b){2,3}c 4 -abb 1+bbc
a(b|bb)c 3 -ab 1-bc Tfloating,Tfloating min offset
a(b|bb){2}c 4 -abb 1-bbc Tanchored,Tfloating,Tfloating min offset
abc(*COMMIT)xyz 6 0+abc - -
abc(*ACCEPT)xyz 3 0+abc - -
# Must not have stclass=[x]
(*ACCEPT)xyz 0 - - -

0 comments on commit a3c98e2

Please sign in to comment.