line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::CharClasses; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
342866
|
use strict; |
|
11
|
|
|
|
|
33
|
|
|
11
|
|
|
|
|
848
|
|
4
|
11
|
|
|
11
|
|
63
|
use warnings; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
305
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
294
|
use 5.010; |
|
11
|
|
|
|
|
44
|
|
|
11
|
|
|
|
|
558
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
57
|
use Exporter (); |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
315
|
|
9
|
11
|
|
|
11
|
|
24080
|
use charnames (); |
|
11
|
|
|
|
|
4151355
|
|
|
11
|
|
|
|
|
6010477
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw (Exporter); |
12
|
|
|
|
|
|
|
our $VERSION = '2009102801'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
15
|
|
|
|
|
|
|
digits => [qw [IsDigit0 IsDigit1 IsDigit2 IsDigit3 IsDigit4 |
16
|
|
|
|
|
|
|
IsDigit5 IsDigit6 IsDigit7 IsDigit8 IsDigit9 |
17
|
|
|
|
|
|
|
IsLatinDigit]], |
18
|
|
|
|
|
|
|
perl => [qw [IsPerlSigil IsLeftParen IsRightParen IsParen]], |
19
|
|
|
|
|
|
|
english => [qw [IsLcVowel IsUcVowel IsVowel |
20
|
|
|
|
|
|
|
IsLcConsonant IsUcConsonant IsConsonant]], |
21
|
|
|
|
|
|
|
encode => [qw [IsUuencode IsBase64 IsBase64url IsBase32 IsBase32hex |
22
|
|
|
|
|
|
|
IsBase16 IsBinHex]], |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# @EXPORT is defined at the bottom of the file. |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _d { |
30
|
31
|
|
|
31
|
|
84
|
my $number = shift; |
31
|
899
|
100
|
|
|
|
231327
|
join "\n" => map { |
32
|
31
|
|
|
|
|
85
|
my $char = $_ ? "$_ DIGIT $number" : "DIGIT $number"; |
33
|
899
|
|
|
|
|
2261
|
sprintf "%04X" => charnames::vianame ($char) |
34
|
|
|
|
|
|
|
} @_; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _n { |
38
|
113
|
|
|
|
|
95801
|
join "\n" => map { |
39
|
14
|
|
|
14
|
|
108
|
s/^\s+//; |
40
|
113
|
|
|
|
|
329
|
sprintf "%04X" => charnames::vianame ($_) |
41
|
|
|
|
|
|
|
} split "\n" => shift; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub __ { |
45
|
32
|
|
|
32
|
|
112
|
my $_ = shift; |
46
|
32
|
|
|
|
|
250
|
s/^\s+//mg; |
47
|
32
|
|
|
|
|
138
|
$_; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# |
51
|
|
|
|
|
|
|
# I'd prefer 'state', but that gives errors. |
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
my $digits = [map {s/^\s+//; $_} split "\n" => <<"--"]; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
ARABIC-INDIC |
56
|
|
|
|
|
|
|
EXTENDED ARABIC-INDIC |
57
|
|
|
|
|
|
|
NKO |
58
|
|
|
|
|
|
|
DEVANAGARI |
59
|
|
|
|
|
|
|
BENGALI |
60
|
|
|
|
|
|
|
GURMUKHI |
61
|
|
|
|
|
|
|
GUJARATI |
62
|
|
|
|
|
|
|
ORIYA |
63
|
|
|
|
|
|
|
TAMIL |
64
|
|
|
|
|
|
|
TELUGU |
65
|
|
|
|
|
|
|
KANNADA |
66
|
|
|
|
|
|
|
MALAYALAM |
67
|
|
|
|
|
|
|
THAI |
68
|
|
|
|
|
|
|
LAO |
69
|
|
|
|
|
|
|
TIBETAN |
70
|
|
|
|
|
|
|
MYANMAR |
71
|
|
|
|
|
|
|
KHMER |
72
|
|
|
|
|
|
|
MONGOLIAN |
73
|
|
|
|
|
|
|
LIMBU |
74
|
|
|
|
|
|
|
NEW TAI LUE |
75
|
|
|
|
|
|
|
BALINESE |
76
|
|
|
|
|
|
|
FULLWIDTH |
77
|
|
|
|
|
|
|
OSMANYA |
78
|
|
|
|
|
|
|
MATHEMATICAL BOLD |
79
|
|
|
|
|
|
|
MATHEMATICAL DOUBLE-STRUCK |
80
|
|
|
|
|
|
|
MATHEMATICAL SANS-SERIF |
81
|
|
|
|
|
|
|
MATHEMATICAL SANS-SERIF BOLD |
82
|
|
|
|
|
|
|
MATHEMATICAL MONOSPACE |
83
|
|
|
|
|
|
|
-- |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $numbers = [map {s/^\s+//; $_} split "\n" => <<"--"]; |
86
|
|
|
|
|
|
|
ZERO |
87
|
|
|
|
|
|
|
ONE |
88
|
|
|
|
|
|
|
TWO |
89
|
|
|
|
|
|
|
THREE |
90
|
|
|
|
|
|
|
FOUR |
91
|
|
|
|
|
|
|
FIVE |
92
|
|
|
|
|
|
|
SIX |
93
|
|
|
|
|
|
|
SEVEN |
94
|
|
|
|
|
|
|
EIGHT |
95
|
|
|
|
|
|
|
NINE |
96
|
|
|
|
|
|
|
-- |
97
|
|
|
|
|
|
|
|
98
|
1327
|
|
|
1327
|
0
|
1017911
|
sub IsDigit0 {state $return = _d ZERO => @$digits} |
99
|
1349
|
|
|
1349
|
0
|
869210
|
sub IsDigit1 {state $return = _d ONE => @$digits} |
100
|
1304
|
|
|
1304
|
0
|
875610
|
sub IsDigit2 {state $return = _d TWO => @$digits} |
101
|
1311
|
|
|
1311
|
0
|
882195
|
sub IsDigit3 {state $return = _d THREE => @$digits} |
102
|
1313
|
|
|
1313
|
0
|
848950
|
sub IsDigit4 {state $return = _d FOUR => @$digits} |
103
|
1345
|
|
|
1345
|
0
|
847260
|
sub IsDigit5 {state $return = _d FIVE => @$digits} |
104
|
1320
|
|
|
1320
|
0
|
792349
|
sub IsDigit6 {state $return = _d SIX => @$digits} |
105
|
1303
|
|
|
1303
|
0
|
757192
|
sub IsDigit7 {state $return = _d SEVEN => @$digits} |
106
|
1306
|
|
|
1306
|
0
|
780578
|
sub IsDigit8 {state $return = _d EIGHT => @$digits} |
107
|
767
|
|
|
767
|
0
|
555286
|
sub IsDigit9 {state $return = _d NINE => @$digits} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
foreach my $language (@$digits) { |
110
|
|
|
|
|
|
|
next if !$language; |
111
|
|
|
|
|
|
|
my $t_name = join "" => map {ucfirst lc} split /\W+/ => $language; |
112
|
|
|
|
|
|
|
my $sub_name = "Is${t_name}Digit"; |
113
|
|
|
|
|
|
|
push @{$EXPORT_TAGS {digits}} => $sub_name; |
114
|
|
|
|
|
|
|
if ($language eq "FULLWIDTH" || $language =~ /^MATHEMATICAL/ |
115
|
|
|
|
|
|
|
|| $language =~ /ARABIC-INDIC$/) { |
116
|
22
|
|
|
22
|
0
|
35671
|
eval <<" --"; |
|
10
|
|
|
22
|
0
|
26
|
|
|
22
|
|
|
22
|
0
|
37354
|
|
|
10
|
|
|
22
|
0
|
23
|
|
|
22
|
|
|
22
|
0
|
24720
|
|
|
10
|
|
|
22
|
0
|
26
|
|
|
22
|
|
|
22
|
0
|
22234
|
|
|
10
|
|
|
22
|
0
|
30
|
|
|
22
|
|
|
|
|
21548
|
|
|
10
|
|
|
|
|
26
|
|
|
22
|
|
|
|
|
25906
|
|
|
10
|
|
|
|
|
33
|
|
|
22
|
|
|
|
|
27464
|
|
|
10
|
|
|
|
|
28
|
|
|
22
|
|
|
|
|
34064
|
|
|
10
|
|
|
|
|
23
|
|
117
|
|
|
|
|
|
|
sub $sub_name { |
118
|
|
|
|
|
|
|
state \$return = _n join "\n" => |
119
|
|
|
|
|
|
|
map {"$language DIGIT \$_"} \@\$numbers; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
-- |
122
|
|
|
|
|
|
|
die $@ if $@; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
else { |
125
|
22
|
|
|
22
|
0
|
25117
|
eval <<" --"; |
|
22
|
|
|
22
|
0
|
29240
|
|
|
22
|
|
|
22
|
0
|
40064
|
|
|
22
|
|
|
22
|
0
|
56363
|
|
|
22
|
|
|
22
|
0
|
27639
|
|
|
22
|
|
|
22
|
0
|
27456
|
|
|
22
|
|
|
22
|
0
|
50388
|
|
|
22
|
|
|
22
|
0
|
41329
|
|
|
22
|
|
|
22
|
0
|
33565
|
|
|
22
|
|
|
22
|
0
|
37682
|
|
|
22
|
|
|
22
|
0
|
39369
|
|
|
22
|
|
|
22
|
0
|
30788
|
|
|
22
|
|
|
22
|
0
|
26943
|
|
|
22
|
|
|
22
|
0
|
34813
|
|
|
22
|
|
|
22
|
0
|
50756
|
|
|
22
|
|
|
22
|
0
|
24847
|
|
|
22
|
|
|
22
|
0
|
47094
|
|
|
22
|
|
|
22
|
0
|
29764
|
|
|
22
|
|
|
22
|
0
|
29053
|
|
|
22
|
|
|
22
|
0
|
42585
|
|
126
|
|
|
|
|
|
|
sub $sub_name {state \$return = __ <<" --"} |
127
|
|
|
|
|
|
|
+utf8::Is${t_name} |
128
|
|
|
|
|
|
|
&utf8::IsDigit |
129
|
|
|
|
|
|
|
-- |
130
|
|
|
|
|
|
|
-- |
131
|
|
|
|
|
|
|
die $@ if $@; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub IsLatinDigit { |
136
|
3
|
|
|
3
|
0
|
5724
|
state $return = _n join "\n" => map {"DIGIT $_"} @$numbers |
|
10
|
|
|
|
|
24
|
|
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
2
|
|
|
2
|
0
|
13666
|
sub IsPerlSigil {state $return = _n <<"--"} |
140
|
|
|
|
|
|
|
DOLLAR SIGN |
141
|
|
|
|
|
|
|
PERCENT SIGN |
142
|
|
|
|
|
|
|
AMPERSAND |
143
|
|
|
|
|
|
|
ASTERISK |
144
|
|
|
|
|
|
|
COMMERCIAL AT |
145
|
|
|
|
|
|
|
-- |
146
|
|
|
|
|
|
|
|
147
|
5
|
|
|
5
|
0
|
4596
|
sub IsLeftParen {state $return = _n <<"--"} |
148
|
|
|
|
|
|
|
LEFT PARENTHESIS |
149
|
|
|
|
|
|
|
LESS-THAN SIGN |
150
|
|
|
|
|
|
|
LEFT SQUARE BRACKET |
151
|
|
|
|
|
|
|
LEFT CURLY BRACKET |
152
|
|
|
|
|
|
|
-- |
153
|
|
|
|
|
|
|
|
154
|
5
|
|
|
5
|
0
|
852
|
sub IsRightParen {state $return = _n <<"--"} |
155
|
|
|
|
|
|
|
RIGHT PARENTHESIS |
156
|
|
|
|
|
|
|
GREATER-THAN SIGN |
157
|
|
|
|
|
|
|
RIGHT SQUARE BRACKET |
158
|
|
|
|
|
|
|
RIGHT CURLY BRACKET |
159
|
|
|
|
|
|
|
-- |
160
|
|
|
|
|
|
|
|
161
|
3
|
|
|
3
|
0
|
734
|
sub IsParen {state $return = __ <<"--"} |
162
|
|
|
|
|
|
|
+Regexp::CharClasses::IsLeftParen |
163
|
|
|
|
|
|
|
+Regexp::CharClasses::IsRightParen |
164
|
|
|
|
|
|
|
-- |
165
|
|
|
|
|
|
|
|
166
|
10
|
|
|
10
|
0
|
5980
|
sub IsLcVowel {state $return = _n <<"--"} |
167
|
|
|
|
|
|
|
LATIN SMALL LETTER A |
168
|
|
|
|
|
|
|
LATIN SMALL LETTER E |
169
|
|
|
|
|
|
|
LATIN SMALL LETTER I |
170
|
|
|
|
|
|
|
LATIN SMALL LETTER O |
171
|
|
|
|
|
|
|
LATIN SMALL LETTER U |
172
|
|
|
|
|
|
|
-- |
173
|
|
|
|
|
|
|
|
174
|
10
|
|
|
10
|
0
|
1456
|
sub IsUcVowel {state $return = _n <<"--"} |
175
|
|
|
|
|
|
|
LATIN CAPITAL LETTER A |
176
|
|
|
|
|
|
|
LATIN CAPITAL LETTER E |
177
|
|
|
|
|
|
|
LATIN CAPITAL LETTER I |
178
|
|
|
|
|
|
|
LATIN CAPITAL LETTER O |
179
|
|
|
|
|
|
|
LATIN CAPITAL LETTER U |
180
|
|
|
|
|
|
|
-- |
181
|
|
|
|
|
|
|
|
182
|
3
|
|
|
3
|
0
|
776
|
sub IsVowel {state $return = __ <<"--"} |
183
|
|
|
|
|
|
|
+Regexp::CharClasses::IsLcVowel |
184
|
|
|
|
|
|
|
+Regexp::CharClasses::IsUcVowel |
185
|
|
|
|
|
|
|
-- |
186
|
|
|
|
|
|
|
|
187
|
5
|
|
|
5
|
0
|
644
|
sub IsLcConsonant {state $return = __ <<"--"} |
188
|
|
|
|
|
|
|
0061 007A |
189
|
|
|
|
|
|
|
-Regexp::CharClasses::IsLcVowel |
190
|
|
|
|
|
|
|
-- |
191
|
|
|
|
|
|
|
|
192
|
5
|
|
|
5
|
0
|
1101
|
sub IsUcConsonant {state $return = __ <<"--"} |
193
|
|
|
|
|
|
|
0041 005A |
194
|
|
|
|
|
|
|
-Regexp::CharClasses::IsUcVowel |
195
|
|
|
|
|
|
|
-- |
196
|
|
|
|
|
|
|
|
197
|
3
|
|
|
3
|
0
|
613
|
sub IsConsonant {state $return = __ <<"--"} |
198
|
|
|
|
|
|
|
+Regexp::CharClasses::IsLcConsonant |
199
|
|
|
|
|
|
|
+Regexp::CharClasses::IsUcConsonant |
200
|
|
|
|
|
|
|
-- |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
# Space to grave accent. |
203
|
2
|
|
|
2
|
0
|
32212
|
sub IsUuencode {state $return = __ <<"--"} |
204
|
|
|
|
|
|
|
0020 0060 |
205
|
|
|
|
|
|
|
-- |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
# A-Z, a-z, 0-9, '+' and '/'; '=' is use for padding. (RFC 4648) |
208
|
2
|
|
|
2
|
0
|
33419
|
sub IsBase64 {state $return = __ <<"--"} |
209
|
|
|
|
|
|
|
0030 0039 |
210
|
|
|
|
|
|
|
0041 005A |
211
|
|
|
|
|
|
|
0061 007A |
212
|
|
|
|
|
|
|
002B |
213
|
|
|
|
|
|
|
002F |
214
|
|
|
|
|
|
|
003D |
215
|
|
|
|
|
|
|
-- |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
# A-Z, a-z, 0-9, '-' and '_'; '=' is use for padding. (RFC 4648) |
218
|
2
|
|
|
2
|
0
|
34489
|
sub IsBase64url {state $return = __ <<"--"} |
219
|
|
|
|
|
|
|
0030 0039 |
220
|
|
|
|
|
|
|
0041 005A |
221
|
|
|
|
|
|
|
0061 007A |
222
|
|
|
|
|
|
|
002D |
223
|
|
|
|
|
|
|
005F |
224
|
|
|
|
|
|
|
003D |
225
|
|
|
|
|
|
|
-- |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
# A-Z, 2-7; '=' is use for padding. (RFC 4648) |
228
|
2
|
|
|
2
|
0
|
60786
|
sub IsBase32 {state $return = __ <<"--"} |
229
|
|
|
|
|
|
|
0032 0037 |
230
|
|
|
|
|
|
|
0041 005A |
231
|
|
|
|
|
|
|
003D |
232
|
|
|
|
|
|
|
-- |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
# 0-9, A-V; '=' is use for padding. (RFC 4648) |
236
|
2
|
|
|
2
|
0
|
96001
|
sub IsBase32hex {state $return = __ <<"--"} |
237
|
|
|
|
|
|
|
0030 0039 |
238
|
|
|
|
|
|
|
0041 0056 |
239
|
|
|
|
|
|
|
003D |
240
|
|
|
|
|
|
|
-- |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
# 0-9, A-F. (RFC 4648) |
244
|
2
|
|
|
2
|
0
|
26952
|
sub IsBase16 {state $return = __ <<"--"} |
245
|
|
|
|
|
|
|
0030 0039 |
246
|
|
|
|
|
|
|
0041 0046 |
247
|
|
|
|
|
|
|
-- |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# !"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr |
250
|
|
|
|
|
|
|
# Note, no 'O', no 'W', no 'g', no 'n', no 'o' |
251
|
2
|
|
|
2
|
0
|
30547
|
sub IsBinHex {state $return = __ <<"--"} |
252
|
|
|
|
|
|
|
0021 002D |
253
|
|
|
|
|
|
|
0030 0039 |
254
|
|
|
|
|
|
|
0040 004E |
255
|
|
|
|
|
|
|
0050 0056 |
256
|
|
|
|
|
|
|
0058 005B |
257
|
|
|
|
|
|
|
0060 0066 |
258
|
|
|
|
|
|
|
0068 006D |
259
|
|
|
|
|
|
|
0070 0072 |
260
|
|
|
|
|
|
|
-- |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
our @EXPORT = map {@$_} values %EXPORT_TAGS; |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
1; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
__END__ |