line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Parser for YAML::PP::LibYAML |
2
|
|
|
|
|
|
|
package YAML::PP::LibYAML::Parser; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.004'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
509
|
use YAML::LibYAML::API::XS; |
|
1
|
|
|
|
|
494
|
|
|
1
|
|
|
|
|
33
|
|
9
|
1
|
|
|
1
|
|
7
|
use YAML::PP::Reader; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
10
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw/ openhandle /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use base 'YAML::PP::Parser'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
463
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
2
|
|
|
2
|
0
|
6
|
my ($class, %args) = @_; |
16
|
2
|
|
33
|
|
|
19
|
my $reader = delete $args{reader} || YAML::PP::Reader->new; |
17
|
2
|
|
|
|
|
27
|
my $receiver = delete $args{receiver}; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
7
|
my $self = bless { |
20
|
|
|
|
|
|
|
reader => $reader, |
21
|
|
|
|
|
|
|
}, $class; |
22
|
2
|
50
|
|
|
|
7
|
if ($receiver) { |
23
|
0
|
|
|
|
|
0
|
$self->set_receiver($receiver); |
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
|
|
15
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
4
|
0
|
5
|
sub reader { return $_[0]->{reader} } |
29
|
|
|
|
|
|
|
sub set_reader { |
30
|
4
|
|
|
4
|
0
|
2334
|
my ($self, $reader) = @_; |
31
|
4
|
|
|
|
|
26
|
$self->{reader} = $reader; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub parse { |
35
|
4
|
|
|
4
|
0
|
142
|
my ($self) = @_; |
36
|
4
|
|
|
|
|
9
|
my $reader = $self->reader; |
37
|
4
|
|
|
|
|
9
|
my $events = []; |
38
|
4
|
100
|
|
|
|
23
|
if ($reader->can('open_handle')) { |
39
|
2
|
100
|
|
|
|
7
|
if (openhandle($reader->input)) { |
40
|
1
|
|
|
|
|
7
|
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
|
2
|
|
|
|
|
6
|
my $yaml = $reader->read; |
48
|
2
|
|
|
|
|
229
|
my $test = YAML::LibYAML::API::XS::parse_string_events($yaml, $events); |
49
|
|
|
|
|
|
|
} |
50
|
3
|
|
|
|
|
196
|
for my $info (@$events) { |
51
|
33
|
|
|
|
|
1560
|
my $name = $info->{name}; |
52
|
33
|
|
|
|
|
78
|
$self->callback->( $self, $name => $info ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |