diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-07-01 09:38:03 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-07-03 14:05:49 -0600 |
commit | a6517ebfb58d661124e8ecb0a759cba9ba607e76 (patch) | |
tree | d6aa4399dafcce90007c920170ea33c7d414afad /lib/utf8_heavy.pl | |
parent | 77f9f1269361fb5553d7dde5338d210cedd76e80 (diff) | |
download | perl-a6517ebfb58d661124e8ecb0a759cba9ba607e76.tar.gz |
utf8_heavy.pl: Add INVERT_IT to swash
set a new key "INVERT_IT" in the swash object to whether or not
the file name for a property-value in Heavy.pl begins with a "!".
(No such entry currently exists.) This will mean that the file's
contents need to be inverted to get the correct values for the
property-value.
Diffstat (limited to 'lib/utf8_heavy.pl')
-rw-r--r-- | lib/utf8_heavy.pl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index 13caa39800..569c3365ee 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -74,13 +74,14 @@ sub croak { require Carp; Carp::croak(@_) } # Upon success, a new (or cached) blessed object is returned with # keys TYPE, BITS, EXTRAS, LIST, and NONE with values having the # same meanings as the input parameters. - # And if there is a special-treatment hash in the file, a reference - # to it is returned in the entry with key SPECIALS + # SPECIALS contains a reference to any special-treatment hash in the + # INVERT_IT is non-zero if the result should be inverted before use my $file; ## file to load data from, and also part of the %Cache key. my $ListSorted = 0; # Change this to get a different set of Unicode tables my $unicore_dir = 'unicore'; + my $invert_it = 0; if ($type) { @@ -377,6 +378,10 @@ sub croak { require Carp; Carp::croak(@_) } # Add the constant and go fetch it in. if (defined $file) { + + # A beginning ! means to invert + $invert_it = $file =~ s/^!//; + if ($utf8::why_deprecated{$file}) { warnings::warnif('deprecated', "Use of '$type' in \\p{} or \\P{} is deprecated because: $utf8::why_deprecated{$file};"); } @@ -442,8 +447,9 @@ sub croak { require Carp; Carp::croak(@_) } ## my $found = $Cache{$class, $file}; if ($found and ref($found) eq $class) { - print STDERR __LINE__, ": Returning cached '$file' for \\p{$type}\n" if DEBUG; + print STDERR __LINE__, ": Returning cached '$file' for \\p{$type}; invert_it=$invert_it\n" if DEBUG; pop @recursed if @recursed; + $found->{'INVERT_IT'} = $invert_it; return $found; } @@ -525,7 +531,7 @@ sub croak { require Carp; Carp::croak(@_) } } if (DEBUG) { - print STDERR __LINE__, ": CLASS = $class, TYPE => $type, BITS => $bits, NONE => $none"; + print STDERR __LINE__, ": CLASS = $class, TYPE => $type, BITS => $bits, NONE => $none, INVERT_IT => $invert_it"; print STDERR "\nLIST =>\n$list" if defined $list; print STDERR "\nEXTRAS =>\n$extras" if defined $extras; print STDERR "\n"; @@ -551,6 +557,7 @@ sub croak { require Carp; Carp::croak(@_) } print STDERR "\nspecials_name => $SWASH->{'SPECIALS'}\n" if DEBUG; $SWASH->{'SPECIALS'} = \%$specials_name; } + $SWASH->{'INVERT_IT'} = $invert_it; } pop @recursed if @recursed && $type; |