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

Commit

Permalink
Update setting with fix for failing subst expression.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed May 25, 2010
1 parent 7882ea3 commit 0e0dbcb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/setting/Regex.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ our sub subst ($text, $regex, $repl, :$global?) {
my $result := pir::new__Ps('StringBuilder'); my $result := pir::new__Ps('StringBuilder');


for @matches -> $match { for @matches -> $match {
pir::push($result, pir::substr($text, $offset, $match.from - $offset)) if $match {
if $match.from > $offset; pir::push($result, pir::substr($text, $offset, $match.from - $offset))
pir::push($result, $is_code ?? $repl($match) !! $repl); if $match.from > $offset;
$offset := $match.to; pir::push($result, $is_code ?? $repl($match) !! $repl);
$offset := $match.to;
}
} }


my $chars := pir::length($text); my $chars := pir::length($text);
Expand Down

0 comments on commit 0e0dbcb

Please sign in to comment.