| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Coverage::TrustMe::Parser; |
|
2
|
10
|
|
|
10
|
|
70
|
use strict; |
|
|
10
|
|
|
|
|
21
|
|
|
|
10
|
|
|
|
|
322
|
|
|
3
|
10
|
|
|
10
|
|
54
|
use warnings; |
|
|
10
|
|
|
|
|
20
|
|
|
|
10
|
|
|
|
|
597
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.001002'; |
|
6
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
|
7
|
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
6986
|
use Pod::Simple (); |
|
|
10
|
|
|
|
|
323379
|
|
|
|
10
|
|
|
|
|
475
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Pod::Simple); |
|
10
|
10
|
|
|
10
|
|
79
|
use Carp qw(croak); |
|
|
10
|
|
|
|
|
29
|
|
|
|
10
|
|
|
|
|
12643
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
50
|
|
|
50
|
1
|
108
|
my $class = shift; |
|
14
|
50
|
|
|
|
|
379
|
my $self = $class->SUPER::new(@_); |
|
15
|
50
|
|
|
|
|
1721
|
$self->accept_targets_as_text('Pod::Coverage'); |
|
16
|
50
|
|
|
|
|
1133
|
$self->{+__PACKAGE__} = {}; |
|
17
|
50
|
|
|
|
|
164
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub parse_lines { |
|
21
|
374
|
|
|
374
|
1
|
74784
|
my $self = shift; |
|
22
|
374
|
|
|
|
|
1458
|
$self->SUPER::parse_lines(@_); |
|
23
|
374
|
|
|
|
|
67132
|
my $me = $self->{+__PACKAGE__}; |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
|
|
|
|
|
|
# these are regexes |
|
26
|
374
|
|
100
|
|
|
1174
|
my $trusted = $me->{trusted} ||= []; |
|
27
|
374
|
|
|
|
|
611
|
my %seen; |
|
28
|
374
|
|
|
|
|
1297
|
@$trusted = sort grep !$seen{$_}++, @$trusted; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
374
|
|
100
|
|
|
650
|
my $links = $me->{links} ||= []; |
|
|
374
|
|
|
|
|
961
|
|
|
32
|
374
|
|
|
|
|
625
|
my %seen; |
|
33
|
374
|
|
|
|
|
1722
|
@$links = sort grep !$seen{$_}++, @$links; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
374
|
|
100
|
|
|
609
|
my $covered = $me->{covered} ||= []; |
|
|
374
|
|
|
|
|
590
|
|
|
|
374
|
|
|
|
|
1066
|
|
|
37
|
374
|
|
|
|
|
579
|
my %seen; |
|
38
|
374
|
|
|
|
|
3838
|
@$covered = sort grep !$seen{$_}++, @$covered; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
374
|
|
|
|
|
1150
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub ignore_empty { |
|
44
|
241
|
|
|
241
|
1
|
427
|
my $self = shift; |
|
45
|
241
|
|
|
|
|
529
|
my $me = $self->{+__PACKAGE__}; |
|
46
|
241
|
100
|
|
|
|
612
|
if (@_) { |
|
47
|
1
|
|
|
|
|
3
|
$me->{ignore_empty} = shift; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
241
|
|
|
|
|
636
|
return $me->{ignore_empty}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _handle_element_start { |
|
53
|
1597
|
|
|
1597
|
|
301792
|
my $self = shift; |
|
54
|
1597
|
|
|
|
|
3199
|
my $me = $self->{+__PACKAGE__}; |
|
55
|
1597
|
|
|
|
|
3069
|
my ($name, $attr) = @_; |
|
56
|
1597
|
100
|
100
|
|
|
10871
|
if ($name eq 'for') { |
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
57
|
6
|
|
|
|
|
12
|
push @{ $me->{in} }, $attr; |
|
|
6
|
|
|
|
|
30
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
elsif ($name eq 'L' && $attr->{type} eq 'pod' && defined $attr->{to}) { |
|
60
|
88
|
|
|
|
|
146
|
push @{ $me->{links} }, "$attr->{to}"; |
|
|
88
|
|
|
|
|
287
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
elsif ($name eq 'item-text' || $name eq 'item-bullet' || $name =~ /\Ahead[2-9]\z/) { |
|
63
|
240
|
|
|
|
|
485
|
delete $me->{maybe_covered}; |
|
64
|
240
|
|
|
|
|
518
|
$me->{consider} = $name; |
|
65
|
240
|
|
|
|
|
492
|
$me->{consider_text} = ''; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
elsif ($name =~ /\Ahead1\z/) { |
|
68
|
96
|
|
|
|
|
226
|
delete $me->{maybe_covered}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
1597
|
|
|
|
|
5283
|
$self->SUPER::_handle_element_start(@_); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
sub _handle_element_end { |
|
73
|
1597
|
|
|
1597
|
|
18183
|
my $self = shift; |
|
74
|
1597
|
|
|
|
|
2690
|
my $me = $self->{+__PACKAGE__}; |
|
75
|
1597
|
|
|
|
|
2771
|
my ($name) = @_; |
|
76
|
1597
|
100
|
100
|
|
|
5745
|
if ($name eq 'for') { |
|
|
|
100
|
|
|
|
|
|
|
77
|
6
|
|
|
|
|
12
|
pop @{ $self->{+__PACKAGE__}{in} }; |
|
|
6
|
|
|
|
|
12
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
elsif ($name eq ($me->{consider}||'')) { |
|
80
|
240
|
|
|
|
|
520
|
delete $me->{consider}; |
|
81
|
240
|
|
|
|
|
470
|
my $text = delete $me->{consider_text}; |
|
82
|
240
|
|
|
|
|
1518
|
my @covered = $text =~ /([^\s\|,\/]+)/g; |
|
83
|
240
|
|
|
|
|
680
|
for my $covered ( @covered ) { |
|
84
|
|
|
|
|
|
|
# looks like a method |
|
85
|
593
|
|
|
|
|
1174
|
$covered =~ s/.*->//; |
|
86
|
|
|
|
|
|
|
# looks fully qualified |
|
87
|
593
|
|
|
|
|
1020
|
$covered =~ s/\A\w+(?:::\w+)*::(\w+)/$1/; |
|
88
|
|
|
|
|
|
|
# looks like it includes parameters |
|
89
|
593
|
|
|
|
|
1713
|
$covered =~ s/(\w+)[;\(].*/$1/; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
240
|
|
|
|
|
1330
|
@covered = grep /\A\w+\z/, @covered; |
|
92
|
240
|
100
|
|
|
|
788
|
if ($self->ignore_empty) { |
|
93
|
2
|
|
|
|
|
3
|
push @{ $me->{maybe_covered} }, @covered; |
|
|
2
|
|
|
|
|
7
|
|
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
else { |
|
96
|
238
|
|
|
|
|
367
|
push @{ $me->{covered} }, @covered; |
|
|
238
|
|
|
|
|
779
|
|
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
} |
|
99
|
1597
|
|
|
|
|
3605
|
$self->SUPER::_handle_element_end(@_); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _handle_text { |
|
103
|
1896
|
|
|
1896
|
|
21298
|
my $self = shift; |
|
104
|
1896
|
|
|
|
|
3242
|
my $me = $self->{+__PACKAGE__}; |
|
105
|
1896
|
|
|
|
|
3576
|
my ($text) = @_; |
|
106
|
1896
|
|
|
|
|
3006
|
my $in = $me->{in}; |
|
107
|
1896
|
100
|
100
|
|
|
6530
|
if ($in && @$in && $in->[-1]{target} eq 'Pod::Coverage') { |
|
|
|
100
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
108
|
7
|
|
|
|
|
14
|
my @trusted; |
|
109
|
7
|
|
|
|
|
33
|
for my $token ($text =~ /(\S+)/g) { |
|
110
|
8
|
100
|
|
|
|
26
|
if ($token eq '*EVERYTHING*') { |
|
111
|
1
|
|
|
|
|
6
|
push @trusted, qr{.?}; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
else { |
|
114
|
7
|
|
|
|
|
12
|
my $re = eval { qr/\A(?:$token)\z/ }; |
|
|
7
|
|
|
|
|
118
|
|
|
115
|
7
|
50
|
|
|
|
25
|
if (!$re) { |
|
116
|
0
|
|
0
|
|
|
0
|
my $file = $self->{source_filename} || ''; |
|
117
|
0
|
|
0
|
|
|
0
|
my $line = $in->[-1]{start_line} || ''; |
|
118
|
0
|
|
|
|
|
0
|
croak "Error compiling Pod::Coverage regex /$token/ at $file line $line: $@"; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
7
|
|
|
|
|
17
|
push @trusted, $re; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
7
|
|
|
|
|
25
|
push @{ $me->{trusted} }, @trusted; |
|
|
7
|
|
|
|
|
22
|
|
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
elsif ($me->{consider}) { |
|
127
|
308
|
|
|
|
|
771
|
$me->{consider_text} .= $text; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
elsif ($me->{maybe_covered}) { |
|
130
|
1
|
|
|
|
|
3
|
push @{ $me->{covered} }, @{ delete $me->{maybe_covered} }; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
2
|
|
|
131
|
|
|
|
|
|
|
} |
|
132
|
1896
|
|
|
|
|
4274
|
$self->SUPER::_handle_text(@_); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub links { |
|
136
|
6
|
|
|
6
|
1
|
10
|
my $self = shift; |
|
137
|
6
|
|
|
|
|
31
|
return $self->{+__PACKAGE__}{links}; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub trusted { |
|
141
|
22
|
|
|
22
|
1
|
45
|
my $self = shift; |
|
142
|
22
|
|
|
|
|
262
|
return $self->{+__PACKAGE__}{trusted}; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub covered { |
|
146
|
50
|
|
|
50
|
1
|
100
|
my $self = shift; |
|
147
|
50
|
|
|
|
|
512
|
return $self->{+__PACKAGE__}{covered}; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; |
|
151
|
|
|
|
|
|
|
__END__ |