This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix intolerance of SWASHes for blank lines
authorGisle Aas <gisle@aas.no>
Thu, 6 Aug 1998 23:28:57 +0000 (01:28 +0200)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 8 Aug 1998 22:38:25 +0000 (22:38 +0000)
Message-ID: <m3emutkdeu.fsf@furu.g.aas.no>
Subject: Re: Re[2]: another joyride begins

p4raw-id: //depot/perl@1767

lib/utf8_heavy.pl

index e00db32..71cbb17 100644 (file)
@@ -69,7 +69,7 @@ sub SWASHNEW {
     my @extras;
     for my $x ($extras) {
        pos $x = 0;
-       while ($x =~ /^([^0-9a-fA-F])(.*)/mg) {
+       while ($x =~ /^([^0-9a-fA-F\n])(.*)/mg) {
            my $char = $1;
            my $name = $2;
            # print STDERR "$1 => $2\n" if $DEBUG;
@@ -99,10 +99,10 @@ sub SWASHNEW {
 sub SWASHGET {
     my ($self, $start, $len) = @_;
     local $^D = 0 if $^D;
-    print STDERR "SWASHGET @_\n" if $DEBUG;
     my $type = $self->{TYPE};
     my $bits = $self->{BITS};
     my $none = $self->{NONE};
+    print STDERR "SWASHGET @_ [$type/$bits/$none]\n" if $DEBUG;
     my $end = $start + $len;
     my $swatch = "";
     my $key;
@@ -166,45 +166,43 @@ sub SWASHGET {
     }
     for my $x ($self->{EXTRAS}) {
        pos $x = 0;
-       while ($x =~ /^([^0-9a-fA-F])(.*)/mg) {
+       while ($x =~ /^([-+!])(.*)/mg) {
            my $char = $1;
            my $name = $2;
            print STDERR "INDIRECT $1 $2\n" if $DEBUG;
-           if ($char =~ /^[-+!]$/) {
-               my $otherbits = $self->{$name}->{BITS};
-               croak("SWASHGET size mismatch") if $bits < $otherbits;
-               my $other = $self->{$name}->SWASHGET($start, $len);
-               if ($char eq '+') {
-                   if ($bits == 1 and $otherbits == 1) {
-                       $swatch |= $other;
-                   }
-                   else {
-                       for ($key = 0; $key < $len; $key++) {
-                           vec($swatch, $key, $bits) = vec($other, $key, $otherbits);
-                       }
-                   }
+           my $otherbits = $self->{$name}->{BITS};
+           croak("SWASHGET size mismatch") if $bits < $otherbits;
+           my $other = $self->{$name}->SWASHGET($start, $len);
+           if ($char eq '+') {
+               if ($bits == 1 and $otherbits == 1) {
+                   $swatch |= $other;
                }
-               elsif ($char eq '!') {
-                   if ($bits == 1 and $otherbits == 1) {
-                       $swatch |= ~$other;
+               else {
+                   for ($key = 0; $key < $len; $key++) {
+                       vec($swatch, $key, $bits) = vec($other, $key, $otherbits);
                    }
-                   else {
-                       for ($key = 0; $key < $len; $key++) {
-                           if (!vec($other, $key, $otherbits)) {
-                               vec($swatch, $key, $bits) = 1;
-                           }
+               }
+           }
+           elsif ($char eq '!') {
+               if ($bits == 1 and $otherbits == 1) {
+                   $swatch |= ~$other;
+               }
+               else {
+                   for ($key = 0; $key < $len; $key++) {
+                       if (!vec($other, $key, $otherbits)) {
+                           vec($swatch, $key, $bits) = 1;
                        }
                    }
                }
-               elsif ($char eq '-') {
-                   if ($bits == 1 and $otherbits == 1) {
-                       $swatch &= ~$other;
-                   }
-                   else {
-                       for ($key = 0; $key < $len; $key++) {
-                           if (vec($other, $key, $otherbits)) {
-                               vec($swatch, $key, $bits) = 0;
-                           }
+           }
+           elsif ($char eq '-') {
+               if ($bits == 1 and $otherbits == 1) {
+                   $swatch &= ~$other;
+               }
+               else {
+                   for ($key = 0; $key < $len; $key++) {
+                       if (vec($other, $key, $otherbits)) {
+                           vec($swatch, $key, $bits) = 0;
                        }
                    }
                }