line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# pyyaml/lib/yaml/resolver.py |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package YAML::Perl::Resolver; |
4
|
9
|
|
|
9
|
|
1474
|
use strict; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
354
|
|
5
|
9
|
|
|
9
|
|
49
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
394
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# package YAML::Perl::Resolver::Base; |
8
|
9
|
|
|
9
|
|
50
|
use YAML::Perl::Base -base; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
78
|
|
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
|
53
|
use constant DEFAULT_SCALAR_TAG => 'tag:yaml.org,2002:str'; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
715
|
|
11
|
9
|
|
|
9
|
|
47
|
use constant DEFAULT_SEQUENCE_TAG => 'tag:yaml.org,2002:seq'; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
440
|
|
12
|
9
|
|
|
9
|
|
62
|
use constant DEFAULT_MAPPING_TAG => 'tag:yaml.org,2002:map'; |
|
9
|
|
|
|
|
69
|
|
|
9
|
|
|
|
|
2828
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $yaml_implicit_resolvers = {}; |
15
|
|
|
|
|
|
|
my $yaml_path_resolvers = {}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
field resolver_exact_paths => []; |
18
|
|
|
|
|
|
|
field resolver_prefix_paths => []; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub add_implicit_resolver { |
21
|
0
|
|
|
0
|
0
|
0
|
die "add_implicit_resolver"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub add_path_resolver { |
25
|
0
|
|
|
0
|
0
|
0
|
die "add_path_resolver"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub descend_resolver { |
29
|
79
|
|
|
79
|
0
|
187
|
return; |
30
|
0
|
|
|
|
|
0
|
die "descend_resolver"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub ascend_resolver { |
34
|
79
|
|
|
79
|
0
|
245
|
return; |
35
|
0
|
|
|
|
|
0
|
die "ascend_resolver"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub check_resolver_prefix { |
39
|
0
|
|
|
0
|
0
|
0
|
die "check_resolver_prefix"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub resolve { |
43
|
148
|
|
|
148
|
0
|
269
|
my $self = shift; |
44
|
148
|
|
|
|
|
201
|
my $kind = shift; |
45
|
148
|
|
|
|
|
212
|
my $value = shift; |
46
|
148
|
|
|
|
|
206
|
my $implicit = shift; |
47
|
|
|
|
|
|
|
|
48
|
148
|
100
|
100
|
|
|
710
|
if ($kind eq 'YAML::Perl::Node::Scalar' and $implicit->[0]) { |
49
|
|
|
|
|
|
|
# my $resolvers; |
50
|
|
|
|
|
|
|
# if ($value eq '') { |
51
|
|
|
|
|
|
|
# $resolvers = $self->yaml_implicit_resolvers->{''} || []; |
52
|
|
|
|
|
|
|
# } |
53
|
|
|
|
|
|
|
# else { |
54
|
|
|
|
|
|
|
# $resolvers = $self->yaml_implicit_resolvers->{$value->[0]} || []; |
55
|
|
|
|
|
|
|
# } |
56
|
|
|
|
|
|
|
# resolvers += self.yaml_implicit_resolvers.get(None, []) |
57
|
|
|
|
|
|
|
# for tag, regexp in resolvers: |
58
|
|
|
|
|
|
|
# if regexp.match(value): |
59
|
|
|
|
|
|
|
# return tag |
60
|
48
|
|
|
|
|
93
|
$implicit = $implicit->[1]; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
# if self.yaml_path_resolvers: |
63
|
|
|
|
|
|
|
# exact_paths = self.resolver_exact_paths[-1] |
64
|
|
|
|
|
|
|
# if kind in exact_paths: |
65
|
|
|
|
|
|
|
# return exact_paths[kind] |
66
|
|
|
|
|
|
|
# if None in exact_paths: |
67
|
|
|
|
|
|
|
# return exact_paths[None] |
68
|
|
|
|
|
|
|
# if kind is ScalarNode: |
69
|
|
|
|
|
|
|
# return self.DEFAULT_SCALAR_TAG |
70
|
|
|
|
|
|
|
# elif kind is SequenceNode: |
71
|
|
|
|
|
|
|
# return self.DEFAULT_SEQUENCE_TAG |
72
|
|
|
|
|
|
|
# elif kind is MappingNode: |
73
|
|
|
|
|
|
|
# return self.DEFAULT_MAPPING_TAG |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
148
|
|
|
|
|
440
|
return ''; # XXX |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |