line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Maketext::Utils::Phrase::Norm::NonBytesStr; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
4932
|
use strict; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
197
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1949
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub normalize_maketext_string { |
7
|
74
|
|
|
74
|
0
|
134
|
my ($filter) = @_; |
8
|
|
|
|
|
|
|
|
9
|
74
|
|
|
|
|
22645
|
my $string_sr = $filter->get_string_sr(); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# \x{NNNN…} |
12
|
74
|
100
|
|
|
|
145
|
if ( ${$string_sr} =~ s/(\\x\{[0-9a-fA-F]+\})/[comment,non bytes unicode string “$1”]/g ) { |
|
74
|
|
|
|
|
1327
|
|
13
|
8
|
|
|
|
|
36
|
$filter->add_violation('non-bytes string (perl)'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# \N{…} see `perldoc charnames |
17
|
74
|
100
|
|
|
|
125
|
if ( ${$string_sr} =~ s/(\\N\{[^}]+\})/[comment,charnames.pm type string “$1”]/g ) { |
|
74
|
|
|
|
|
772
|
|
18
|
8
|
|
|
|
|
31
|
$filter->add_violation('charnames.pm string notation'); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# u"\uNNNN…" |
22
|
74
|
100
|
|
|
|
101
|
if ( ${$string_sr} =~ s/([uU])(["'])(\\[uU][0-9a-fA-F]+)\2/[comment,unicode notation “$1“$3””]/g ) { |
|
74
|
|
|
|
|
636
|
|
23
|
8
|
|
|
|
|
28
|
$filter->add_violation('unicode code point notation (Python style)'); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#\uNNNN… |
27
|
74
|
100
|
|
|
|
126
|
if ( ${$string_sr} =~ s/(?
|
|
74
|
|
|
|
|
639
|
|
28
|
8
|
|
|
|
|
32
|
$filter->add_violation('unicode code point notation (C/C++/Java style)'); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# X'NNNN…' |
32
|
|
|
|
|
|
|
# U'NNNN…' |
33
|
74
|
100
|
|
|
|
105
|
if ( ${$string_sr} =~ s/(?:([XxUn])(["'])([0-9a-fA-F]+)\2)/[comment,unicode notation “$1‘$3’”]/g ) { |
|
74
|
|
|
|
|
661
|
|
34
|
8
|
|
|
|
|
30
|
$filter->add_violation('unicode code point notation (alternate style)'); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# U+NNNN… |
38
|
74
|
100
|
|
|
|
130
|
if ( ${$string_sr} =~ s/(?
|
|
74
|
|
|
|
|
325
|
|
39
|
8
|
|
|
|
|
28
|
$filter->add_violation('unicode code point notation (visual notation style)'); # TODO: [output,codepoint,NNNN] |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# UxNNNN… |
43
|
74
|
100
|
|
|
|
195
|
if ( ${$string_sr} =~ s/([Uu]x[0-9a-fA-F]+)/[comment,unicode notation “$1”]/g ) { |
|
74
|
|
|
|
|
296
|
|
44
|
8
|
|
|
|
|
104
|
$filter->add_violation('unicode code point notation (visual notation type 2 style)'); # TODO: [output,codepoint,NNNN] |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
74
|
|
|
|
|
285
|
return $filter->return_value; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |