Skip to content

Commit

Permalink
Allow :global as well as :g for match method.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed May 17, 2010
1 parent 96fbd6f commit a797463
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/Cool-str.pm
Expand Up @@ -22,7 +22,7 @@ augment class Cool {
}
}

multi method subst($matcher, $replacement, :g(:$global), :$x) {
multi method subst($matcher, $replacement, :g(:$global), :$x) {
die "Can't combine :g/:global and :x in subst"
if defined($global) && defined($x);
my $limit = defined($x) ?? $x +1 !! 2;
Expand Down Expand Up @@ -177,8 +177,8 @@ augment class Cool {
self gt '' ?? self.substr(0,1).lc ~ self.substr(1) !! ""
}

our multi method match(Regex $pat, :$c = 0, :$g) {
if $g {
our multi method match(Regex $pat, :$c = 0, :g(:$global)) {
if $global {
my $cont = $c;
gather while my $m = Regex::Cursor.parse(self, :rule($pat), :c($cont)) {
my $m-copy = $m;
Expand Down

0 comments on commit a797463

Please sign in to comment.