line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Invisible::Receiver; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
41
|
|
5
|
2
|
|
|
2
|
|
7
|
use base 'Pegex::Receiver'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
764
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub gotrule { |
8
|
125
|
|
|
125
|
1
|
193394
|
my $self = shift; |
9
|
125
|
100
|
|
|
|
242
|
my $param = (@_ == 1) ? $_[0] : [ @_ ]; |
10
|
125
|
50
|
|
|
|
201
|
return unless defined $param; |
11
|
125
|
|
|
|
|
153
|
my $parser = $self->{parser}; |
12
|
125
|
|
|
|
|
143
|
my $rule = $parser->{rule}; |
13
|
125
|
|
|
|
|
139
|
my $parentrule = $parser->{parent}; |
14
|
125
|
|
|
|
|
133
|
my ($attr, $flatten) = @{$parentrule}{qw(-wrap -flat)}; |
|
125
|
|
|
|
|
199
|
|
15
|
125
|
100
|
|
|
|
210
|
return $param if $flatten; |
16
|
112
|
100
|
|
|
|
211
|
$param = [ $param ] if ref $param ne 'ARRAY'; |
17
|
112
|
|
|
|
|
216
|
$param = $self->flatten($param); |
18
|
112
|
100
|
|
|
|
1117
|
my %ret = (nodename => $rule, type => ($attr ? 'attr' : 'element')); |
19
|
112
|
|
|
|
|
179
|
for (@$param) { |
20
|
120
|
100
|
100
|
|
|
304
|
if (!ref $_ or !$_->{type}) { |
|
|
50
|
|
|
|
|
|
21
|
108
|
|
|
|
|
115
|
push @{ $ret{children} }, $_; |
|
108
|
|
|
|
|
199
|
|
22
|
|
|
|
|
|
|
} elsif ($_->{type} eq 'attr') { |
23
|
12
|
|
|
|
|
22
|
$ret{attributes}{$_->{nodename}} = join '', _get_values($_); |
24
|
|
|
|
|
|
|
} else { |
25
|
0
|
|
|
|
|
0
|
die "Unknown entity type '$_->{type}'"; # uncoverable statement |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
112
|
100
|
|
|
|
224
|
delete $ret{type} if $ret{type} eq 'element'; |
29
|
112
|
|
|
|
|
298
|
\%ret; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _get_values { |
33
|
12
|
|
|
12
|
|
18
|
my ($node) = @_; |
34
|
12
|
50
|
|
|
|
14
|
map ref($_) ? _get_values($_) : $_, @{ $node->{children} }; |
|
12
|
|
|
|
|
61
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |