From 94d01ff504f3ff7a8114c4239bf60476b4d1d4e6 Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Mon, 12 Jul 2010 20:13:08 +0200 Subject: [PATCH] initial Match.new - does not handle subcaptures yet --- src/core/Match.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/Match.pm b/src/core/Match.pm index dea3da6956c..0f2bc694be7 100644 --- a/src/core/Match.pm +++ b/src/core/Match.pm @@ -1,4 +1,15 @@ class Match is Regex::Match is Cool does Positional does Associative { + method create(:$from, :$to, :$orig) { + my $new = self.bless(*); + pir::setattribute__vpsp($new, '$!from', $from); + pir::setattribute__vpsp($new, '$!to', $to); + pir::setattribute__vpsp($new, '$!target', $orig); + + # TODO: handle :@positional, :%named + + $new; + } + method ast() { my $x = self.Regex::Match::ast; pir::isa__IPs($x, 'Undef') ?? Any !! $x;