| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package String::Downgrade::Amharic; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# If either of these next two lines are inside |
|
4
|
|
|
|
|
|
|
# the BEGIN block the package will break. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
1
|
|
|
1
|
|
760
|
use utf8; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
7
|
1
|
|
|
1
|
|
822
|
use Regexp::Ethiopic::Amharic qw(:forms overload setForm subForm); |
|
|
1
|
|
|
|
|
35204
|
|
|
|
1
|
|
|
|
|
5
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN |
|
10
|
|
|
|
|
|
|
{ |
|
11
|
1
|
|
|
1
|
|
677
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use base qw( Exporter ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
84
|
|
|
13
|
1
|
|
|
1
|
|
4
|
use vars qw( $VERSION @EXPORT %HaMaps ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
136
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
2
|
$VERSION = "0.03"; |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
3
|
@EXPORT = qw( &downgrade ); |
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
216
|
%HaMaps =( |
|
20
|
|
|
|
|
|
|
ሐ => "ኀኃሀሃ", |
|
21
|
|
|
|
|
|
|
ኀ => "ሐኃሀሃ", |
|
22
|
|
|
|
|
|
|
ኃ => "ኀሐሀሃ", |
|
23
|
|
|
|
|
|
|
ሓ => "ሐኀኃሀሃ", |
|
24
|
|
|
|
|
|
|
ኻ => "ሀሃ", |
|
25
|
|
|
|
|
|
|
ኍ => "ኁሁሑ" |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub new |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
1
|
|
|
1
|
0
|
521
|
bless ( {}, shift ); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _downgradeMultiTarget |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
1
|
|
|
1
|
|
3
|
my ( $list, $re, $from, $targets ) = @_; |
|
39
|
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
4
|
my @to = split ( //, $targets ); |
|
41
|
1
|
|
|
|
|
4
|
my @outList = (); |
|
42
|
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
2
|
foreach my $to (@to) { |
|
44
|
4
|
|
|
|
|
6
|
my @newList; |
|
45
|
4
|
|
|
|
|
5
|
for (my $i=0; $i < @{$list}; $i++) { |
|
|
12
|
|
|
|
|
25
|
|
|
46
|
8
|
|
|
|
|
13
|
$newList[$i] = $list->[$i]; # copy old list |
|
47
|
8
|
|
|
|
|
32
|
$newList[$i] =~ s/$from/$to/; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
4
|
|
|
|
|
12
|
push ( @outList, @newList ); # add new keys to old keys |
|
50
|
|
|
|
|
|
|
} |
|
51
|
1
|
|
|
|
|
2
|
push ( @{$list}, @outList ); # add new keys to old keys |
|
|
1
|
|
|
|
|
3
|
|
|
52
|
1
|
|
|
|
|
19
|
$$re =~ s/$from(?!\])/[$from$targets]/; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _downgrade |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
1
|
|
|
1
|
|
3
|
my ( $list, $re, $from, $to ) = @_; |
|
59
|
|
|
|
|
|
|
|
|
60
|
1
|
50
|
|
|
|
4
|
unless ( $to ) { |
|
61
|
1
|
|
|
|
|
5
|
$to = $from; |
|
62
|
1
|
|
|
|
|
14
|
$to =~ tr/ሀሃሗሠ-ሧኣእኧቍኵጕቈኰጐቆኮጎዑዒዔዕዖፀ-ፆኹኺኼኽኾ/ሃሀኋሰ-ሷአእቁኩጉቆኮጎቈኰጐዕኡኢኤእኦጸ-ጾሁሂሄህሆ/; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
2
|
my @newList; |
|
66
|
1
|
|
|
|
|
2
|
for (my $i=0; $i < @{$list}; $i++) { |
|
|
2
|
|
|
|
|
7
|
|
|
67
|
1
|
|
|
|
|
3
|
$newList[$i] = $list->[$i]; # copy old list |
|
68
|
1
|
|
|
|
|
18
|
$newList[$i] =~ s/$from/$to/; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
1
|
|
|
|
|
2
|
push ( @{$list}, @newList ); # add new keys to old keys |
|
|
1
|
|
|
|
|
3
|
|
|
71
|
1
|
|
|
|
|
19
|
$$re =~ s/$from(?!\])/[$from$to]/; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub downgrade |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
1
|
|
|
1
|
0
|
307
|
my $self; |
|
78
|
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
3
|
($self, $_) = @_; |
|
80
|
1
|
50
|
|
|
|
6
|
$_ = $self unless ( ref($self) ); |
|
81
|
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
2
|
my @list = ( $_ ); |
|
83
|
1
|
|
|
|
|
2
|
my $re = $_; |
|
84
|
|
|
|
|
|
|
|
|
85
|
1
|
|
|
|
|
4
|
my @letters = split ( // ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
2
|
foreach ( @letters ) { |
|
88
|
3
|
100
|
|
|
|
15
|
if ( /([#ሠፀ#]|[ሀሃሗኣእኧቍኵጕቈኰጐቆኮጎዑዒዔዕዖኹኺኼኽኾ])/ ) { |
|
89
|
1
|
|
|
|
|
2
|
my $from = $1; |
|
90
|
1
|
50
|
33
|
|
|
8
|
_downgrade ( \@list, \$re, $from ) |
|
91
|
|
|
|
|
|
|
unless ( $from eq "እ" && $re =~ /^እ/ ); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
3
|
50
|
|
|
|
11
|
if ( /([ዓዐ])/ ) { |
|
94
|
0
|
0
|
|
|
|
0
|
my $to = ( $1 eq "ዓ" ) ? "አዐ" : "አዓ" ; |
|
95
|
0
|
|
|
|
|
0
|
_downgradeMultiTarget ( \@list, \$re, $1, $to ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
3
|
50
|
|
|
|
10
|
if ( /([ሑሒሔሕሖኁኂኄኅኆ])/ ) { |
|
98
|
0
|
|
|
|
|
0
|
my $from = $1; |
|
99
|
0
|
|
|
|
|
0
|
my $to = subForm ( 'ሀ', $from ); |
|
100
|
0
|
0
|
|
|
|
0
|
my $compliment = ( $from =~ /[#ኀ#]/ ) ? "ሐ" : "ኀ" ; |
|
101
|
0
|
|
|
|
|
0
|
$to .= subForm ( $compliment, $from ); |
|
102
|
0
|
|
|
|
|
0
|
_downgradeMultiTarget ( \@list, \$re, $from, $to ); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
3
|
100
|
|
|
|
12
|
if ( /([ሐኀኃሓኻኍ])/ ) { |
|
105
|
1
|
|
|
|
|
3
|
my $to = $HaMaps{$1}; |
|
106
|
1
|
|
|
|
|
5
|
_downgradeMultiTarget ( \@list, \$re, $1, $to ); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
1
|
|
|
|
|
8
|
( @list, $re ); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
######################################################### |
|
117
|
|
|
|
|
|
|
# Do not change this, Do not put anything below this. |
|
118
|
|
|
|
|
|
|
# File must return "true" value at termination |
|
119
|
|
|
|
|
|
|
1; |
|
120
|
|
|
|
|
|
|
########################################################## |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
__END__ |