Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

oops; fixed botched implementation from last commit

'\x' is two characters, not one.
  • Loading branch information...
commit f9583814381b4f5321cc886aa8d8c3bd040b7821 1 parent 131525a
@masak authored
Showing with 5 additions and 5 deletions.
  1. +3 −3 t/perl6regex/01-regex.t
  2. +2 −2 test-regex
View
6 t/perl6regex/01-regex.t
@@ -76,11 +76,11 @@ sub match_perl6regex($pattern, $target) {
sub replace_x($s is copy) {
while defined (my $start = $s.index("\\x")) {
- my $end = $start + 1;
+ my $end = $start + 2;
++$end while $s.substr($end, 1) ~~ /<[0..9a..fA..F]>/;
- my $n = $s.substr($start + 1, $end - $start - 1);
+ my $n = $s.substr($start + 2, $end - $start - 2);
$s = $s.substr(0, $start) ~ chr(:16($n)) ~ $s.substr($end);
- };
+ }
$s
}
View
4 test-regex
@@ -14,9 +14,9 @@ say $match ?? $match.dump_str('mob', ' ', '') !! "No match\n";
sub replace_x($s is copy) {
while defined (my $start = $s.index("\\x")) {
- my $end = $start + 1;
+ my $end = $start + 2;
++$end while $s.substr($end, 1) ~~ /<[0..9a..fA..F]>/;
- my $n = $s.substr($start + 1, $end - $start - 1);
+ my $n = $s.substr($start + 2, $end - $start - 2);
$s = $s.substr(0, $start) ~ chr(:16($n)) ~ $s.substr($end);
}
$s

0 comments on commit f958381

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