Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

oops; fixed botched implementation from last commit

'\x' is two characters, not one.
  • Loading branch information...
commit f9583814381b4f5321cc886aa8d8c3bd040b7821 1 parent 131525a
Carl Mäsak authored April 18, 2010
6  t/perl6regex/01-regex.t
@@ -76,11 +76,11 @@ sub match_perl6regex($pattern, $target) {
76 76
 
77 77
 sub replace_x($s is copy) {
78 78
     while defined (my $start = $s.index("\\x")) {
79  
-        my $end = $start + 1;
  79
+        my $end = $start + 2;
80 80
         ++$end while $s.substr($end, 1) ~~ /<[0..9a..fA..F]>/;
81  
-        my $n = $s.substr($start + 1, $end - $start - 1);
  81
+        my $n = $s.substr($start + 2, $end - $start - 2);
82 82
         $s = $s.substr(0, $start) ~ chr(:16($n)) ~ $s.substr($end);
83  
-    };
  83
+    }
84 84
     $s
85 85
 }
86 86
 
4  test-regex
@@ -14,9 +14,9 @@ say $match ?? $match.dump_str('mob', ' ', '') !! "No match\n";
14 14
 
15 15
 sub replace_x($s is copy) {
16 16
     while defined (my $start = $s.index("\\x")) {
17  
-        my $end = $start + 1;
  17
+        my $end = $start + 2;
18 18
         ++$end while $s.substr($end, 1) ~~ /<[0..9a..fA..F]>/;
19  
-        my $n = $s.substr($start + 1, $end - $start - 1);
  19
+        my $n = $s.substr($start + 2, $end - $start - 2);
20 20
         $s = $s.substr(0, $start) ~ chr(:16($n)) ~ $s.substr($end);
21 21
     }
22 22
     $s

0 notes on commit f958381

Please sign in to comment.
Something went wrong with that request. Please try again.