Skip to content

Commit

Permalink
be explicit about .keys, .values, .kv and .pairs in Match
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Aug 12, 2010
1 parent 811c1c5 commit 938b133
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/core/Match.pm
Expand Up @@ -71,9 +71,25 @@ class Match is Regex::Match is Cool does Positional does Associative {
Seq.new(pir::descalarref__PP(self).Regex::Match::list);
}

multi method keys() {
(self.list.keys, self.hash.keys).flat;
}

multi method values() {
(self.list.values, self.hash.values).flat;
}

multi method kv() {
(self.list.kv, self.hash.kv).flat;
}

multi method pairs() {
(self.list.pairs, self.hash.pairs).flat;
}

multi method caps() {
my @caps;
for self.list.pairs, self.hash.pairs -> $p {
for self.pairs -> $p {
# in regexes like [(.) ...]+, the capture for (.) is
# a List. flatten that.
if $p.value ~~ Array {
Expand Down

0 comments on commit 938b133

Please sign in to comment.