Skip to content

Commit 7fc7a08

Browse files
committed
Fix implementation of <before ...>.
1 parent 3071d43 commit 7fc7a08

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/QRegex/Cursor.nqp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@ role NQPCursorRole {
198198
}
199199

200200
method before($regex) {
201-
my $cur := self.'!cursor_start'();
202-
$cur.'!cursor_pass'($!pos, 'before')
203-
if $regex($cur);
201+
my $cur := self."!cursor_start"();
202+
nqp::bindattr_i($cur, $?CLASS, '$!pos', $!pos);
203+
nqp::getattr_i($regex($cur), $?CLASS, '$!pos') >= 0 ??
204+
$cur."!cursor_pass"($!pos, 'before') !!
205+
$cur."!cursor_fail"();
204206
$cur;
205207
}
206-
208+
207209
method ws() {
208210
# skip over any whitespace, fail if between two word chars
209211
my $cur := self."!cursor_start"();

0 commit comments

Comments
 (0)