Don't need to require utf8_pva.pl at top of file
[p5sagit/p5-mst-13.2.git] / lib / utf8_pva.pl
CommitLineData
12ac2576 1package utf8;
2
3##
4## Store the alias definitions for later use.
5##
6
7my $dir;
8for (@INC) {
9 $dir = $_, last if -e "$_/unicore/PropertyAliases.txt";
10}
11
12use Carp 'confess';
13
21235083 14local *_;
15local $.; # localizes Pl_last_in_gv
12ac2576 16
c26e4df9 17open PA, "< $dir/unicore/PropertyAliases.txt"
18 or confess "Can't open PropertyAliases.txt: $!";
19while (<PA>) {
20 s/#.*//;
21 s/\s+$//;
22 next if /^$/;
23
24 my ($abbrev, $name) = split /\s*;\s*/;
25 next if $abbrev eq "n/a";
26 tr/ _-//d for $abbrev, $name;
27 $PropertyAlias{lc $abbrev} = $name;
28 $PA_reverse{lc $name} = $abbrev;
29}
30close PA;
31
32open PVA, "< $dir/unicore/PropValueAliases.txt"
33 or confess "Can't open PropValueAliases.txt: $!";
34while (<PVA>) {
35 s/#.*//;
36 s/\s+$//;
37 next if /^$/;
38
39 my ($prop, @data) = split /\s*;\s*/;
40 shift @data if $prop eq 'ccc';
41 next if $data[0] eq "n/a";
42
43 $data[1] =~ tr/ _-//d;
44 $PropValueAlias{$prop}{lc $data[0]} = $data[1];
45 $PVA_reverse{$prop}{lc $data[1]} = $data[0];
46
47 my $abbr_class = ($prop eq 'gc' or $prop eq 'sc') ? 'gc_sc' : $prop;
48 $PVA_abbr_map{$abbr_class}{lc $data[0]} = $data[0];
49}
50close PVA;
51
52# backwards compatibility for L& -> LC
53$PropValueAlias{gc}{'l&'} = $PropValueAlias{gc}{lc};
54$PVA_abbr_map{gc_sc}{'l&'} = $PVA_abbr_map{gc_sc}{lc};
12ac2576 55
561;