summaryrefslogtreecommitdiff
path: root/lib/utf8_heavy.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-06-26 11:50:18 -0600
committerKarl Williamson <khw@cpan.org>2015-07-28 22:15:54 -0600
commite1dc048de90000f9564119c20e47a19339c00b54 (patch)
tree9f3b94274dba864b211086bb22c5ec9328cae041 /lib/utf8_heavy.pl
parent9346f59aba14d38666cd1fa8abd9bd959a73cbe5 (diff)
downloadperl-e1dc048de90000f9564119c20e47a19339c00b54.tar.gz
mktables: Allow strictly named map tables
There are several types of tables generated by mktables. Most are binary (match) tables, but another class is mapping tables. The names for these may be loosely matched, but until this commit only the match tables could have strict matching applied. Strict matching is used for certain table names where loose could be ambiguous, and for all names that aren't to be used by anything except the perl core.
Diffstat (limited to 'lib/utf8_heavy.pl')
-rw-r--r--lib/utf8_heavy.pl22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl
index 1ba73b2874..89b146c75c 100644
--- a/lib/utf8_heavy.pl
+++ b/lib/utf8_heavy.pl
@@ -404,7 +404,11 @@ sub _loose_name ($) {
# If didn't find it, try again with looser matching by editing
# out the applicable characters on the rhs and looking up
# again.
+ my $strict_property_and_table;
if (! defined $file) {
+
+ # This isn't used unless the name begins with 'to'
+ $strict_property_and_table = $property_and_table =~ s/^to//r;
$table = _loose_name($table);
$property_and_table = "$prefix$table";
print STDERR __LINE__, ": $property_and_table\n" if DEBUG;
@@ -444,10 +448,19 @@ sub _loose_name ($) {
##
# Only check if caller wants non-binary
my $retried = 0;
- if ($minbits != 1 && $property_and_table =~ s/^to//) {{
+ if ($minbits != 1) {
+ if ($property_and_table =~ s/^to//) {
# Look input up in list of properties for which we have
- # mapping files.
- if (defined ($file =
+ # mapping files. First do it with the strict approach
+ if (defined ($file =
+ $utf8::strict_property_to_file_of{$strict_property_and_table}))
+ {
+ $type = $utf8::file_to_swash_name{$file};
+ print STDERR __LINE__, ": type set to $type\n" if DEBUG;
+ $file = "$unicore_dir/$file.pl";
+ last GETFILE;
+ }
+ elsif (defined ($file =
$utf8::loose_property_to_file_of{$property_and_table}))
{
$type = $utf8::file_to_swash_name{$file};
@@ -497,7 +510,8 @@ sub _loose_name ($) {
$file = "$unicore_dir/lib/$file.pl" unless $file =~ m!^#/!;
last GETFILE;
}
- } }
+ }
+ }
##
## If we reach this line, it's because we couldn't figure