line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Multibyte::UHC; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
258
|
|
4
|
|
|
|
|
|
|
$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
|
|
|
|
|
|
|
cmpchar => sub { $_[0] cmp $_[1] }, |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
nextchar => sub { |
22
|
|
|
|
|
|
|
my $ch = shift; |
23
|
|
|
|
|
|
|
my $len = length $ch; |
24
|
|
|
|
|
|
|
if ($len == 1) { |
25
|
|
|
|
|
|
|
return $ch eq "\x7F" |
26
|
|
|
|
|
|
|
? "\x81\x41" |
27
|
|
|
|
|
|
|
: chr(ord($ch)+1); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
elsif ($len == 2) { |
30
|
|
|
|
|
|
|
my($c, $d) = unpack('CC', $ch); |
31
|
|
|
|
|
|
|
return $ch eq "\xFE\xFE" |
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
|
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |