line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# pyyaml/lib/yaml/loader.py |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package YAML::Perl::Loader; |
4
|
6
|
|
|
6
|
|
3679
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
209
|
|
5
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
211
|
|
6
|
6
|
|
|
6
|
|
2369
|
use YAML::Perl::Processor -base; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
field 'next_layer' => 'constructor'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# These fields are chained together such that you can access any lower |
11
|
|
|
|
|
|
|
# level from any higher level. |
12
|
|
|
|
|
|
|
field 'constructor', -chain, -init => '$self->create("constructor")'; |
13
|
|
|
|
|
|
|
field 'composer', -chain, -init => '$self->constructor->composer'; |
14
|
|
|
|
|
|
|
field 'parser', -chain, -init => '$self->composer->parser'; |
15
|
|
|
|
|
|
|
field 'scanner', -chain, -init => '$self->parser->scanner'; |
16
|
|
|
|
|
|
|
field 'reader', -chain, -init => '$self->scanner->reader'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Setting a class name from the loader will set it in the appropriate |
19
|
|
|
|
|
|
|
# class. When setting class names it is important to set the higher |
20
|
|
|
|
|
|
|
# level ones first since accessing a lower level one will instantiate |
21
|
|
|
|
|
|
|
# any higher level objects with their default class names. |
22
|
|
|
|
|
|
|
field 'constructor_class', -chain => -init => '"YAML::Perl::Constructor"'; |
23
|
|
|
|
|
|
|
field 'composer_class', -chain => -onset => '$self->constructor->composer_class($_)'; |
24
|
|
|
|
|
|
|
field 'parser_class', -chain => -onset => '$self->composer->parser_class($_)'; |
25
|
|
|
|
|
|
|
field 'scanner_class', -chain => -onset => '$self->parser->scanner_class($_)'; |
26
|
|
|
|
|
|
|
field 'reader_class', -chain => -onset => '$self->scanner->reader_class($_)'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub load { |
29
|
9
|
|
|
9
|
0
|
57
|
my $self = shift; |
30
|
9
|
50
|
|
|
|
35
|
if (wantarray) { |
31
|
9
|
|
|
|
|
22
|
my @data = (); |
32
|
9
|
|
|
|
|
285
|
while ($self->constructor->check_data()) { |
33
|
9
|
|
|
|
|
582
|
push @data, $self->constructor->get_data(); |
34
|
|
|
|
|
|
|
} |
35
|
9
|
|
|
|
|
353
|
return @data; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
0
|
|
|
|
|
return $self->constructor->check_data() |
39
|
|
|
|
|
|
|
? $self->constructor->get_data() |
40
|
|
|
|
|
|
|
: (); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |