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

Commit 0e0dbcb

Browse files
committed
Update setting with fix for failing subst expression.
1 parent 7882ea3 commit 0e0dbcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/setting/Regex.pm

Lines changed: 6 additions & 4 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -41,10 +41,12 @@ our sub subst ($text, $regex, $repl, :$global?) {
41
my $result := pir::new__Ps('StringBuilder');
41
my $result := pir::new__Ps('StringBuilder');
42

42

43
for @matches -> $match {
43
for @matches -> $match {
44-
pir::push($result, pir::substr($text, $offset, $match.from - $offset))
44+
if $match {
45-
if $match.from > $offset;
45+
pir::push($result, pir::substr($text, $offset, $match.from - $offset))
46-
pir::push($result, $is_code ?? $repl($match) !! $repl);
46+
if $match.from > $offset;
47-
$offset := $match.to;
47+
pir::push($result, $is_code ?? $repl($match) !! $repl);
48+
$offset := $match.to;
49+
}
48
}
50
}
49

51

50
my $chars := pir::length($text);
52
my $chars := pir::length($text);

0 commit comments

Comments
 (0)