Permalink
Browse files

Revert "Comment out split() function for now; it causes the Parrot bu…

…ild to fail"

This reverts commit 5349f17.
  • Loading branch information...
1 parent bffc552 commit 7809892897102386cc8fa84fa877b4f27732fc73 @bacek bacek committed Jan 27, 2011
Showing with 24 additions and 24 deletions.
  1. +24 −24 src/setting/Regex.pm
  2. 0 t/setting/{04-regex.t.skip → 04-regex.t}
View
@@ -60,30 +60,30 @@ our sub subst ($text, $regex, $repl, :$global?) {
Splits C<$text> on occurences of C<$regex>
=end item
-# our sub split ($regex, $text) {
-# my $pos := 0;
-# my @result;
-# my $looking := 1;
-# while $looking {
-# my $match :=
-# Regex::Cursor.parse($text, :rule($regex), :c($pos)) ;
-#
-# if ?$match {
-# my $from := $match.from();
-# my $to := $match.to();
-# my $prefix := pir::substr__sPii($text, $pos, $from-$pos);
-# @result.push($prefix);
-# $pos := $match.to();
-# } else {
-# my $len := pir::length($text);
-# if $pos < $len {
-# @result.push(pir::substr__ssi($text, $pos) );
-# }
-# $looking := 0;
-# }
-# }
-# return @result;
-# }
+our sub split ($regex, $text) {
+ my $pos := 0;
+ my @result;
+ my $looking := 1;
+ while $looking {
+ my $match :=
+ Regex::Cursor.parse($text, :rule($regex), :c($pos)) ;
+
+ if ?$match {
+ my $from := $match.from();
+ my $to := $match.to();
+ my $prefix := pir::substr__sPii($text, $pos, $from-$pos);
+ @result.push($prefix);
+ $pos := $match.to();
+ } else {
+ my $len := pir::length($text);
+ if $pos < $len {
+ @result.push(pir::substr__ssi($text, $pos) );
+ }
+ $looking := 0;
+ }
+ }
+ return @result;
+}
# vim: ft=perl6
File renamed without changes.

0 comments on commit 7809892

Please sign in to comment.