@@ -2189,6 +2189,27 @@ ($)
2189
2189
my @deprecated_messages = " " ; # Element [0] is a placeholder
2190
2190
my %deprecated_tags ;
2191
2191
2192
+ my $float_e_format = qr / ^ -? \d \. \d + e [-+] \d + $ / x ;
2193
+
2194
+ # Create another hash that maps floating point x.yyEzz representation to what
2195
+ # %stricter_to_file_of does for the equivalent rational. A typical entry in
2196
+ # the latter hash is
2197
+ #
2198
+ # 'nv=1/2' => 'Nv/1_2',
2199
+ #
2200
+ # From that, this loop creates an entry
2201
+ #
2202
+ # 'nv=5.00e-01' => 'Nv/1_2',
2203
+ #
2204
+ # %stricter_to_file_of contains far more than just the rationals. Instead we
2205
+ # use %utf8::nv_floating_to_rational which should have an entry for each
2206
+ # nv in the former hash.
2207
+ my %floating_to_file_of ;
2208
+ foreach my $key (keys %utf8::nv_floating_to_rational ) {
2209
+ my $value = $utf8::nv_floating_to_rational {$key };
2210
+ $floating_to_file_of {$key } = $utf8::stricter_to_file_of {" nv=$value " };
2211
+ }
2212
+
2192
2213
# Collect all the binary properties from data in lib/unicore
2193
2214
# Sort so that complements come after the main table, and the shortest
2194
2215
# names first, finally alphabetically. Also, sort together the tables we want
@@ -2198,23 +2219,29 @@ ($)
2198
2219
{ exists $keep_together {lc $b } <=> exists $keep_together {lc $a }
2199
2220
or $b =~ / posix/i <=> $a =~ / posix/i
2200
2221
or $b =~ / perl/i <=> $a =~ / perl/i
2222
+ or $a =~ $float_e_format <=> $b =~ $float_e_format
2201
2223
or $a =~ / !/ <=> $b =~ / !/
2202
2224
or length $a <=> length $b
2203
2225
or $a cmp $b
2204
2226
} keys %utf8::loose_to_file_of ,
2205
- keys %utf8::stricter_to_file_of
2227
+ keys %utf8::stricter_to_file_of ,
2228
+ keys %floating_to_file_of
2206
2229
) {
2207
2230
2208
2231
# These two hashes map properties to values that can be considered to
2209
2232
# be checksums. If two properties have the same checksum, they have
2210
2233
# identical entries. Otherwise they differ in some way.
2211
2234
my $tag = $utf8::loose_to_file_of {$property };
2212
2235
$tag = $utf8::stricter_to_file_of {$property } unless defined $tag ;
2236
+ $tag = $floating_to_file_of {$property } unless defined $tag ;
2213
2237
2214
2238
# The tag may contain an '!' meaning it is identical to the one formed
2215
2239
# by removing the !, except that it is inverted.
2216
2240
my $inverted = $tag =~ s / !// ;
2217
2241
2242
+ # This hash is lacking the property name
2243
+ $property = " nv=$property " if $property =~ $float_e_format ;
2244
+
2218
2245
# The list of 'prop=value' entries that this single entry expands to
2219
2246
my @this_entries ;
2220
2247
@@ -2803,6 +2830,13 @@ sub token_name
2803
2830
{style => ' *' , by => ' regen/mk_invlists.pl' ,
2804
2831
from => " mph.pl" });
2805
2832
2833
+ no warnings ' once' ;
2834
+ print $keywords_fh <<"EOF" ;
2835
+ /* The precisionn to use in "%.*e" formats */
2836
+ #define PL_E_FORMAT_PRECISION $utf8::e_precision
2837
+
2838
+ EOF
2839
+
2806
2840
my ($second_level , $seed1 , $length_all_keys , $smart_blob , $rows ) = MinimalPerfectHash::make_mph_from_hash(\%keywords );
2807
2841
print $keywords_fh MinimalPerfectHash::make_algo($second_level , $seed1 , $length_all_keys , $smart_blob , $rows , undef , undef , undef , ' match_uniprop' );
2808
2842
0 commit comments