Permalink
Browse files

be explicit about .keys, .values, .kv and .pairs in Match

  • Loading branch information...
1 parent 811c1c5 commit 938b133fb25a98d6e2342a63115376c5edbed263 @moritz moritz committed Aug 12, 2010
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/core/Match.pm
View
@@ -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 {

0 comments on commit 938b133

Please sign in to comment.