diff options
author | Karl Williamson <khw@cpan.org> | 2019-03-09 09:43:45 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-03-12 09:53:21 -0600 |
commit | 98a1b8f75b3617ff62804a29d59d65bad554e835 (patch) | |
tree | ad3df93ee36ba35e2b207d6d7215e1c069a6aaee /regen/mk_invlists.pl | |
parent | 6f954d4263d065602e00e32f5adfe997abeedfea (diff) | |
download | perl-98a1b8f75b3617ff62804a29d59d65bad554e835.tar.gz |
regen/mk_invlists.pl, lib/utf8_heavy.pl: Rename variable
This renames a variable to more accurately reflect its content, and adds
a new one which has the old name but with an accurate content.
Diffstat (limited to 'regen/mk_invlists.pl')
-rw-r--r-- | regen/mk_invlists.pl | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl index e286eb735c..147ce0101e 100644 --- a/regen/mk_invlists.pl +++ b/regen/mk_invlists.pl @@ -31,8 +31,11 @@ my $VERSION_DATA_STRUCTURE_TYPE = 148565664; # charclass_invlists.h now also contains inversion maps and enum definitions # for those maps that have a finite number of possible values -# integer or float -my $numeric_re = qr/ ^ -? \d+ (:? \. \d+ )? $ /x; +# integer or float (no exponent) +my $integer_or_float_re = qr/ ^ -? \d+ (:? \. \d+ )? $ /x; + +# Also includes rationals +my $numeric_re = qr! $integer_or_float_re | ^ -? \d+ / \d+ $ !x; # More than one code point may have the same code point as their fold. This # gives the maximum number in the current Unicode release. (The folded-to @@ -164,7 +167,7 @@ sub a2n($) { # Returns the input Unicode code point translated to native. - return $cp if $cp !~ $numeric_re || $cp > 255; + return $cp if $cp !~ $integer_or_float_re || $cp > 255; return $a2n[$cp]; } @@ -2693,7 +2696,9 @@ foreach my $prop (@props) { if (ref $invmap[0]) { $bucket = join "\cK", map { a2n($_) } @{$invmap[0]}; } - elsif ($maps_to_code_point && $invmap[0] =~ $numeric_re) { + elsif ( $maps_to_code_point + && $invmap[0] =~ $integer_or_float_re) + { # Do convert to native for maps to single code points. # There are some properties that have a few outlier @@ -2716,7 +2721,7 @@ foreach my $prop (@props) { # Skip any non-numeric maps: these are outliers # that aren't code points. - && $base_map =~ $numeric_re + && $base_map =~ $integer_or_float_re # 'ne' because the default can be a string && $base_map ne $map_default) @@ -2804,8 +2809,10 @@ foreach my $prop (@props) { for my $i (0 .. @new_invlist - 1) { next if $i > 0 && $new_invlist[$i-1] + 1 == $new_invlist[$i] - && $xlated{$new_invlist[$i-1]} =~ $numeric_re - && $xlated{$new_invlist[$i]} =~ $numeric_re + && $xlated{$new_invlist[$i-1]} + =~ $integer_or_float_re + && $xlated{$new_invlist[$i]} + =~ $integer_or_float_re && $xlated{$new_invlist[$i-1]} + 1 == $xlated{$new_invlist[$i]}; push @temp, $new_invlist[$i]; } |