This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove spurious intentation in utf8_pva.pl
[perl5.git] / lib / utf8_pva.pl
1 package utf8;
2
3 ##
4 ## Store the alias definitions for later use.
5 ##
6
7 my $dir;
8 for (@INC) {
9   $dir = $_, last if -e "$_/unicore/PropertyAliases.txt";
10 }
11
12 use Carp 'confess';
13
14 local *_;
15 local $.; # localizes Pl_last_in_gv
16
17 open PA, "< $dir/unicore/PropertyAliases.txt"
18     or confess "Can't open PropertyAliases.txt: $!";
19 while (<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 }
30 close PA;
31
32 open PVA, "< $dir/unicore/PropValueAliases.txt"
33     or confess "Can't open PropValueAliases.txt: $!";
34 while (<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 }
50 close 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};
55
56 1;