[svn:parrot] r46928 - trunk/ext/nqp-rx/src/stage0

bacek at svn.parrot.org bacek at svn.parrot.org
Sun May 23 23:00:42 UTC 2010


Author: bacek
Date: Sun May 23 23:00:42 2010
New Revision: 46928
URL: https://trac.parrot.org/parrot/changeset/46928

Log:
Grab new nqp-setting from upstream

Modified:
   trunk/ext/nqp-rx/src/stage0/nqp-setting.nqp

Modified: trunk/ext/nqp-rx/src/stage0/nqp-setting.nqp
==============================================================================
--- trunk/ext/nqp-rx/src/stage0/nqp-setting.nqp	Sun May 23 22:59:03 2010	(r46927)
+++ trunk/ext/nqp-rx/src/stage0/nqp-setting.nqp	Sun May 23 23:00:42 2010	(r46928)
@@ -154,17 +154,17 @@
 
 our sub match ($text, $regex, :$global?) {
     my $match := $text ~~ $regex;
+    my @matches;
     if $global {
-        my @matches;
         while $match {
             @matches.push($match);
             $match := $match.CURSOR.parse($text, :rule($regex), :c($match.to));
         }
-        @matches;
     }
-    else {
-        $match;
+    elsif $match {
+        @matches.push($match);
     }
+    @matches;
 }
 
 
@@ -175,8 +175,8 @@
 =end item
 
 our sub subst ($text, $regex, $repl, :$global?) {
-    my @matches := $global ?? match($text, $regex, :global)
-                           !! [ $text ~~ $regex ];
+    my @matches := match($text, $regex, $global);
+
     my $is_code := pir::isa($repl, 'Sub');
     my $offset  := 0;
     my $result  := pir::new__Ps('StringBuilder');


More information about the parrot-commits mailing list