Can't get #17492 to work with -Uuseperlio otherwise (either
[p5sagit/p5-mst-13.2.git] / lib / utf8_heavy.pl
index 29d4ac2..1839d21 100644 (file)
@@ -6,10 +6,10 @@ sub DEBUG () { 0 }
 
 sub DESTROY {}
 
-sub croak { require Carp; Carp::croak(@_) }
-
 my %Cache;
 
+sub croak { require Carp; Carp::croak(@_) }
+
 ##
 ## "SWASH" == "SWATCH HASH". A "swatch" is a swatch of the Unicode landscape
 ##
@@ -184,7 +184,13 @@ sub SWASHNEW {
            print STDERR "$1 => $2\n" if DEBUG;
            if ($char =~ /[-+!]/) {
                my ($c,$t) = split(/::/, $name, 2);     # bogus use of ::, really
-               my $subobj = $c->SWASHNEW($t, "", 0, 0, 0);
+               my $subobj;
+               if ($c eq 'utf8') {
+                   $subobj = $c->SWASHNEW($t, "", 0, 0, 0);
+               }
+               elsif ($c =~ /^([0-9a-fA-F]+)/) {
+                   $subobj = utf8->SWASHNEW("", $c, 0, 0, 0);
+               }
                return $subobj unless ref $subobj;
                push @extras, $name => $subobj;
                $bits = $subobj->{BITS} if $bits < $subobj->{BITS};
@@ -265,7 +271,7 @@ sub SWASHGET {
        }
        else {
          LINE:
-           while (/^([0-9a-fA-F]+)(?:\t([0-9a-fA-F]+))?/mg) {
+           while (/^([0-9a-fA-F]+)(?:[ \t]+([0-9a-fA-F]+))?/mg) {
                my $min = hex $1;
                my $max = (defined $2 ? hex $2 : $min);
                next if $max < $start;