line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Parser for YAML::PP::LibYAML |
2
|
|
|
|
|
|
|
package YAML::PP::LibYAML::Parser; |
3
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
58
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
79
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.005'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
912
|
use YAML::LibYAML::API::XS; |
|
2
|
|
|
|
|
1052
|
|
|
2
|
|
|
|
|
63
|
|
9
|
2
|
|
|
2
|
|
14
|
use YAML::PP::Reader; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
45
|
|
10
|
2
|
|
|
2
|
|
11
|
use Scalar::Util qw/ openhandle /; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
91
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
12
|
use base 'YAML::PP::Parser'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
850
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
4
|
|
|
4
|
0
|
11
|
my ($class, %args) = @_; |
16
|
4
|
|
33
|
|
|
33
|
my $reader = delete $args{reader} || YAML::PP::Reader->new; |
17
|
4
|
|
|
|
|
56
|
my $receiver = delete $args{receiver}; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
12
|
my $self = bless { |
20
|
|
|
|
|
|
|
reader => $reader, |
21
|
|
|
|
|
|
|
}, $class; |
22
|
4
|
50
|
|
|
|
13
|
if ($receiver) { |
23
|
0
|
|
|
|
|
0
|
$self->set_receiver($receiver); |
24
|
|
|
|
|
|
|
} |
25
|
4
|
|
|
|
|
33
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
5
|
0
|
9
|
sub reader { return $_[0]->{reader} } |
29
|
|
|
|
|
|
|
sub set_reader { |
30
|
5
|
|
|
5
|
0
|
2355
|
my ($self, $reader) = @_; |
31
|
5
|
|
|
|
|
33
|
$self->{reader} = $reader; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub parse { |
35
|
5
|
|
|
5
|
0
|
179
|
my ($self) = @_; |
36
|
5
|
|
|
|
|
14
|
my $reader = $self->reader; |
37
|
5
|
|
|
|
|
9
|
my $events = []; |
38
|
5
|
100
|
|
|
|
42
|
if ($reader->can('open_handle')) { |
39
|
2
|
100
|
|
|
|
9
|
if (openhandle($reader->input)) { |
40
|
1
|
|
|
|
|
6
|
my $test = YAML::LibYAML::API::XS::parse_filehandle_events($reader->open_handle, $events); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
else { |
43
|
1
|
|
|
|
|
12
|
my $test = YAML::LibYAML::API::XS::parse_file_events($reader->input, $events); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
3
|
|
|
|
|
12
|
my $yaml = $reader->read; |
48
|
3
|
|
|
|
|
322
|
my $test = YAML::LibYAML::API::XS::parse_string_events($yaml, $events); |
49
|
|
|
|
|
|
|
} |
50
|
4
|
|
|
|
|
187
|
for my $info (@$events) { |
51
|
43
|
|
|
|
|
1964
|
my $name = $info->{name}; |
52
|
43
|
|
|
|
|
110
|
$self->callback->( $self, $name => $info ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |