Multibyte/UHC.pm

filter: Statementstmt 38.4% 5 / 13 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 1 / 3 Podpod n/a totaltotal 17.6% 6 / 34 CC 10 SCAR 45.2
CC
10
Cov
16%
__ANON__
110.0
__ANON__
2.0
BEGIN
1.0
CRAP 91.9
« Multibyte/EUC_TW.pm ↑ Summary Multibyte/Big5.pm »
1 package String::Multibyte::UHC;
2  
3 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 $VERSION = '1.12';
5  
6 # HANGUL SYLLABLE 11172
7 # [\x81-\xA0][\x41-\x5A\x61-\x7A\x81-\xFE] 32 * 178 = 5696
8 # [\xA1-\xAF][\x41-\x5A\x61-\x7A\x81-\xA0] 15 * 84 = 1260
9 # [\xB0-\xC5][\x41-\x5A\x61-\x7A\x81-\xFE] 22 * 178 = 3916
10 # \xC6[\x41-\x52\xA1-\xFE] 18 + 94 = 112
11 # [\xC7-\xC8][\xA1-\xFE] 2 * 94 = 188
12  
13 +{
14 charset => 'UHC',
15  
16 regexp => '(?:[\x00-\x7F]|[\x81-\xC5][\x41-\x5A\x61-\x7A\x81-\xFE]|'
17 . '\xC6[\x41-\x52\xA1-\xFE]|[\xC7-\xFE][\xA1-\xFE])',
18  
19 0 ▶ cmpchar => sub { $_[0] cmp $_[1] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
20  
21 0 ▶ nextchar => sub {
Subroutine __ANON__: not called CC=10 SCAR=47.0
22 0 my $ch = shift;
23 0 my $len = length $ch;
24 0 ▶ if ($len == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($len == 1) { } 0 0 0
elsif ($len == 2) { } 0 0 0
25 0 ▶ return $ch eq "\x7F"
Branch: 1 branch
BranchTrueFalseTotal
$ch eq "\177" ? : 0 0 0
26 ? "\x81\x41"
27 : chr(ord($ch)+1);
28 }
29 elsif ($len == 2) {
30 0 my($c, $d) = unpack('CC', $ch);
31 0 ▶ return $ch eq "\xFE\xFE"
Branch: 6 branches
BranchTrueFalseTotal
$ch eq "\376\376" ? : 0 0 0
$ch eq "\306R" ? : 0 0 0
$d == 254 ? : 0 0 0
$c < 198 ? : 0 0 0
$d == 90 ? : 0 0 0
$d == 122 ? : 0 0 0
32 ? undef
33 : $ch eq "\xC6\x52"
34 ? "\xC6\xA1"
35 : $d == 0xFE
36 ? pack('CC', $c+1, $c < 0xC6 ? 0x41 : 0xA1)
37 : $d == 0x5A
38 ? chr($c) ."\x61"
39 : $d == 0x7A
40 ? chr($c) ."\x81"
41 : pack('CC', $c, $d+1);
42 }
43 else {
44 0 return;
45 }
46 },
47 1 };
48  
49 __END__
« Multibyte/EUC_TW.pm ↑ Summary Multibyte/Big5.pm »