Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Fix general quantifier in regexes with charclasses (RT #76792).
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jul 30, 2010
1 parent a11bb45 commit a3386d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/PAST/Compiler-Regex.pir
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,10 @@ standard quantifier code will handle it.
.param string backtrack
.param int min
.param int max
.param pmc sep

if backtrack != 'r' goto pessimistic
if sep goto pessimistic

.local string subtype
.local int cclass, negate
Expand Down Expand Up @@ -846,7 +848,9 @@ second child of this node.
backtrack = 'g'
have_backtrack:

.local pmc sep
.local int min, max
sep = node.'sep'()
min = node.'min'()
$P0 = node.'max'()
max = $P0
Expand All @@ -864,7 +868,7 @@ second child of this node.
$S0 = concat $S0, '_q'
$I0 = can self, $S0
unless $I0 goto optimize_done
$P0 = self.$S0(cpast, backtrack, min, max)
$P0 = self.$S0(cpast, backtrack, min, max, sep)
if null $P0 goto optimize_done
.return ($P0)
optimize_done:
Expand Down
1 change: 1 addition & 0 deletions t/p6regex/rx_quantifiers
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,4 @@ a**:!2..4 baaabbb y three "a" characters (explicit greed)
:sigspace ^[\w+] ** \, $ foo, bar ,baz y ** under :sigspace
:sigspace ^[\w+]** \, $ foo, bar ,baz n ** under :sigspace w/o ws
:sigspace ^[\w+]** \, $ foo,bar,baz y ** under :sigspace w/o ws
:ratchet ^ \w ** \, $ a,b,c,d y ** under :ratchet w charclass

0 comments on commit a3386d1

Please sign in to comment.