| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: YAML Parser |
|
2
|
42
|
|
|
42
|
|
370311
|
use strict; |
|
|
42
|
|
|
|
|
132
|
|
|
|
42
|
|
|
|
|
1185
|
|
|
3
|
42
|
|
|
42
|
|
202
|
use warnings; |
|
|
42
|
|
|
|
|
87
|
|
|
|
42
|
|
|
|
|
2556
|
|
|
4
|
|
|
|
|
|
|
package YAML::PP::Parser; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.036'; # VERSION |
|
7
|
|
|
|
|
|
|
|
|
8
|
42
|
50
|
|
42
|
|
252
|
use constant TRACE => $ENV{YAML_PP_TRACE} ? 1 : 0; |
|
|
42
|
|
|
|
|
115
|
|
|
|
42
|
|
|
|
|
3769
|
|
|
9
|
42
|
100
|
66
|
42
|
|
296
|
use constant DEBUG => ($ENV{YAML_PP_DEBUG} || $ENV{YAML_PP_TRACE}) ? 1 : 0; |
|
|
42
|
|
|
|
|
91
|
|
|
|
42
|
|
|
|
|
3098
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
42
|
|
|
|
|
2803
|
use YAML::PP::Common qw/ |
|
12
|
|
|
|
|
|
|
YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE |
|
13
|
|
|
|
|
|
|
YAML_DOUBLE_QUOTED_SCALAR_STYLE |
|
14
|
|
|
|
|
|
|
YAML_LITERAL_SCALAR_STYLE YAML_FOLDED_SCALAR_STYLE |
|
15
|
|
|
|
|
|
|
YAML_FLOW_SEQUENCE_STYLE YAML_FLOW_MAPPING_STYLE |
|
16
|
42
|
|
|
42
|
|
2727
|
/; |
|
|
42
|
|
|
|
|
84
|
|
|
17
|
42
|
|
|
42
|
|
17157
|
use YAML::PP::Render; |
|
|
42
|
|
|
|
|
131
|
|
|
|
42
|
|
|
|
|
1215
|
|
|
18
|
42
|
|
|
42
|
|
21259
|
use YAML::PP::Lexer; |
|
|
42
|
|
|
|
|
147
|
|
|
|
42
|
|
|
|
|
1787
|
|
|
19
|
42
|
|
|
42
|
|
330
|
use YAML::PP::Grammar qw/ $GRAMMAR /; |
|
|
42
|
|
|
|
|
88
|
|
|
|
42
|
|
|
|
|
3723
|
|
|
20
|
42
|
|
|
42
|
|
18556
|
use YAML::PP::Exception; |
|
|
42
|
|
|
|
|
109
|
|
|
|
42
|
|
|
|
|
1345
|
|
|
21
|
42
|
|
|
42
|
|
16615
|
use YAML::PP::Reader; |
|
|
42
|
|
|
|
|
104
|
|
|
|
42
|
|
|
|
|
1298
|
|
|
22
|
42
|
|
|
42
|
|
309
|
use Carp qw/ croak /; |
|
|
42
|
|
|
|
|
82
|
|
|
|
42
|
|
|
|
|
38866
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
|
26
|
450
|
|
|
450
|
0
|
297687
|
my ($class, %args) = @_; |
|
27
|
450
|
|
33
|
|
|
2163
|
my $reader = delete $args{reader} || YAML::PP::Reader->new; |
|
28
|
450
|
|
|
|
|
912
|
my $default_yaml_version = delete $args{default_yaml_version}; |
|
29
|
450
|
|
100
|
|
|
2255
|
my $self = bless { |
|
30
|
|
|
|
|
|
|
default_yaml_version => $default_yaml_version || '1.2', |
|
31
|
|
|
|
|
|
|
lexer => YAML::PP::Lexer->new( |
|
32
|
|
|
|
|
|
|
reader => $reader, |
|
33
|
|
|
|
|
|
|
), |
|
34
|
|
|
|
|
|
|
}, $class; |
|
35
|
450
|
|
|
|
|
914
|
my $receiver = delete $args{receiver}; |
|
36
|
450
|
100
|
|
|
|
1087
|
if ($receiver) { |
|
37
|
265
|
|
|
|
|
589
|
$self->set_receiver($receiver); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
450
|
|
|
|
|
3389
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub clone { |
|
43
|
9
|
|
|
9
|
0
|
15
|
my ($self) = @_; |
|
44
|
9
|
|
|
|
|
21
|
my $clone = { |
|
45
|
|
|
|
|
|
|
default_yaml_version => $self->default_yaml_version, |
|
46
|
|
|
|
|
|
|
lexer => YAML::PP::Lexer->new(), |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
9
|
|
|
|
|
44
|
return bless $clone, ref $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
185
|
|
|
185
|
0
|
682
|
sub receiver { return $_[0]->{receiver} } |
|
52
|
|
|
|
|
|
|
sub set_receiver { |
|
53
|
459
|
|
|
459
|
0
|
899
|
my ($self, $receiver) = @_; |
|
54
|
459
|
|
|
|
|
712
|
my $callback; |
|
55
|
459
|
100
|
|
|
|
1271
|
if (ref $receiver eq 'CODE') { |
|
56
|
265
|
|
|
|
|
403
|
$callback = $receiver; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
else { |
|
59
|
|
|
|
|
|
|
$callback = sub { |
|
60
|
12648
|
|
|
12648
|
|
21087
|
my ($self, $event, $info) = @_; |
|
61
|
12648
|
|
|
|
|
38657
|
return $receiver->$event($info); |
|
62
|
194
|
|
|
|
|
1042
|
}; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
459
|
|
|
|
|
981
|
$self->{callback} = $callback; |
|
65
|
459
|
|
|
|
|
961
|
$self->{receiver} = $receiver; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
4
|
|
|
4
|
0
|
11
|
sub reader { return $_[0]->lexer->{reader} } |
|
68
|
|
|
|
|
|
|
sub set_reader { |
|
69
|
1727
|
|
|
1727
|
0
|
2911
|
my ($self, $reader) = @_; |
|
70
|
1727
|
|
|
|
|
3085
|
$self->lexer->set_reader($reader); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
25613
|
|
|
25613
|
0
|
67910
|
sub lexer { return $_[0]->{lexer} } |
|
73
|
20119
|
|
|
20119
|
0
|
48975
|
sub callback { return $_[0]->{callback} } |
|
74
|
0
|
|
|
0
|
0
|
0
|
sub set_callback { $_[0]->{callback} = $_[1] } |
|
75
|
4584
|
|
|
4584
|
0
|
6496
|
sub level { return $#{ $_[0]->{offset} } } |
|
|
4584
|
|
|
|
|
13531
|
|
|
76
|
25344
|
|
|
25344
|
0
|
41839
|
sub offset { return $_[0]->{offset} } |
|
77
|
1727
|
|
|
1727
|
0
|
3231
|
sub set_offset { $_[0]->{offset} = $_[1] } |
|
78
|
40793
|
|
|
40793
|
0
|
65701
|
sub events { return $_[0]->{events} } |
|
79
|
1727
|
|
|
1727
|
0
|
3017
|
sub set_events { $_[0]->{events} = $_[1] } |
|
80
|
11527
|
|
|
11527
|
0
|
23512
|
sub new_node { return $_[0]->{new_node} } |
|
81
|
17665
|
|
|
17665
|
0
|
32762
|
sub set_new_node { $_[0]->{new_node} = $_[1] } |
|
82
|
1148
|
|
|
1148
|
0
|
2654
|
sub tagmap { return $_[0]->{tagmap} } |
|
83
|
3474
|
|
|
3474
|
0
|
7357
|
sub set_tagmap { $_[0]->{tagmap} = $_[1] } |
|
84
|
5431
|
|
|
5431
|
0
|
8893
|
sub tokens { return $_[0]->{tokens} } |
|
85
|
1727
|
|
|
1727
|
0
|
10128
|
sub set_tokens { $_[0]->{tokens} = $_[1] } |
|
86
|
25365
|
|
|
25365
|
0
|
39451
|
sub event_stack { return $_[0]->{event_stack} } |
|
87
|
1727
|
|
|
1727
|
0
|
3041
|
sub set_event_stack { $_[0]->{event_stack} = $_[1] } |
|
88
|
1736
|
|
|
1736
|
0
|
4314
|
sub default_yaml_version { return $_[0]->{default_yaml_version} } |
|
89
|
1840
|
|
|
1840
|
0
|
4915
|
sub yaml_version { return $_[0]->{yaml_version} } |
|
90
|
1774
|
|
|
1774
|
0
|
3029
|
sub set_yaml_version { $_[0]->{yaml_version} = $_[1] } |
|
91
|
1874
|
|
|
1874
|
0
|
3090
|
sub yaml_version_directive { return $_[0]->{yaml_version_directive} } |
|
92
|
3601
|
|
|
3601
|
0
|
5772
|
sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] } |
|
93
|
|
|
|
|
|
|
|
|
94
|
5560
|
|
|
5560
|
0
|
11658
|
sub rule { return $_[0]->{rule} } |
|
95
|
|
|
|
|
|
|
sub set_rule { |
|
96
|
38073
|
|
|
38073
|
0
|
64509
|
my ($self, $name) = @_; |
|
97
|
42
|
|
|
42
|
|
337
|
no warnings 'uninitialized'; |
|
|
42
|
|
|
|
|
108
|
|
|
|
42
|
|
|
|
|
405687
|
|
|
98
|
38073
|
|
|
|
|
47328
|
DEBUG and $self->info("set_rule($name)"); |
|
99
|
38073
|
|
|
|
|
61623
|
$self->{rule} = $name; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub init { |
|
103
|
1727
|
|
|
1727
|
0
|
2904
|
my ($self) = @_; |
|
104
|
1727
|
|
|
|
|
4358
|
$self->set_offset([]); |
|
105
|
1727
|
|
|
|
|
4349
|
$self->set_events([]); |
|
106
|
1727
|
|
|
|
|
3766
|
$self->set_new_node(0); |
|
107
|
1727
|
|
|
|
|
5271
|
$self->set_tagmap({ |
|
108
|
|
|
|
|
|
|
'!!' => "tag:yaml.org,2002:", |
|
109
|
|
|
|
|
|
|
}); |
|
110
|
1727
|
|
|
|
|
4472
|
$self->set_tokens([]); |
|
111
|
1727
|
|
|
|
|
4211
|
$self->set_rule(undef); |
|
112
|
1727
|
|
|
|
|
4131
|
$self->set_event_stack([]); |
|
113
|
1727
|
|
|
|
|
3239
|
$self->set_yaml_version($self->default_yaml_version); |
|
114
|
1727
|
|
|
|
|
4155
|
$self->set_yaml_version_directive(undef); |
|
115
|
1727
|
|
|
|
|
3017
|
$self->lexer->init; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub parse_string { |
|
119
|
393
|
|
|
393
|
0
|
26975
|
my ($self, $yaml) = @_; |
|
120
|
393
|
|
|
|
|
1070
|
$self->set_reader(YAML::PP::Reader->new( input => $yaml )); |
|
121
|
393
|
|
|
|
|
838
|
$self->parse(); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub parse_file { |
|
125
|
0
|
|
|
0
|
0
|
0
|
my ($self, $file) = @_; |
|
126
|
0
|
|
|
|
|
0
|
$self->set_reader(YAML::PP::Reader::File->new( input => $file )); |
|
127
|
0
|
|
|
|
|
0
|
$self->parse(); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my %nodetypes = ( |
|
131
|
|
|
|
|
|
|
MAPVALUE => 'NODETYPE_COMPLEX', |
|
132
|
|
|
|
|
|
|
MAP => 'NODETYPE_MAP', |
|
133
|
|
|
|
|
|
|
# IMAP => 'NODETYPE_SEQ', |
|
134
|
|
|
|
|
|
|
SEQ => 'NODETYPE_SEQ', |
|
135
|
|
|
|
|
|
|
SEQ0 => 'NODETYPE_SEQ', |
|
136
|
|
|
|
|
|
|
FLOWMAP => 'NODETYPE_FLOWMAP', |
|
137
|
|
|
|
|
|
|
FLOWMAPVALUE => 'NODETYPE_FLOWMAPVALUE', |
|
138
|
|
|
|
|
|
|
FLOWSEQ => 'NODETYPE_FLOWSEQ', |
|
139
|
|
|
|
|
|
|
FLOWSEQ_NEXT => 'FLOWSEQ_NEXT', |
|
140
|
|
|
|
|
|
|
DOC => 'FULLNODE', |
|
141
|
|
|
|
|
|
|
DOC_END => 'DOCUMENT_END', |
|
142
|
|
|
|
|
|
|
STR => 'STREAM', |
|
143
|
|
|
|
|
|
|
END_FLOW => 'END_FLOW', |
|
144
|
|
|
|
|
|
|
); |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub parse { |
|
147
|
1727
|
|
|
1727
|
0
|
3073
|
my ($self) = @_; |
|
148
|
1727
|
|
|
|
|
2215
|
TRACE and warn "=== parse()\n"; |
|
149
|
1727
|
|
|
|
|
2368
|
TRACE and $self->debug_yaml; |
|
150
|
1727
|
|
|
|
|
4105
|
$self->init; |
|
151
|
1727
|
|
|
|
|
3206
|
$self->lexer->init; |
|
152
|
1727
|
|
|
|
|
2743
|
eval { |
|
153
|
1727
|
|
|
|
|
4273
|
$self->start_stream; |
|
154
|
1727
|
|
|
|
|
5442
|
$self->set_rule( 'STREAM' ); |
|
155
|
|
|
|
|
|
|
|
|
156
|
1727
|
|
|
|
|
4079
|
$self->parse_tokens(); |
|
157
|
|
|
|
|
|
|
|
|
158
|
1662
|
|
|
|
|
3293
|
$self->end_stream; |
|
159
|
|
|
|
|
|
|
}; |
|
160
|
1727
|
100
|
|
|
|
6012
|
if (my $error = $@) { |
|
161
|
65
|
100
|
|
|
|
171
|
if (ref $error) { |
|
162
|
38
|
|
|
|
|
114
|
croak "$error\n "; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
27
|
|
|
|
|
2366
|
croak $error; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
1662
|
|
|
|
|
2337
|
DEBUG and $self->highlight_yaml; |
|
168
|
1662
|
|
|
|
|
3517
|
TRACE and $self->debug_tokens; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub lex_next_tokens { |
|
172
|
7260
|
|
|
7260
|
0
|
11751
|
my ($self) = @_; |
|
173
|
|
|
|
|
|
|
|
|
174
|
7260
|
|
|
|
|
8955
|
DEBUG and $self->info("----------------> lex_next_tokens"); |
|
175
|
7260
|
|
|
|
|
9116
|
TRACE and $self->debug_events; |
|
176
|
|
|
|
|
|
|
|
|
177
|
7260
|
|
|
|
|
12305
|
my $indent = $self->offset->[-1]; |
|
178
|
7260
|
|
|
|
|
12094
|
my $event_types = $self->events; |
|
179
|
7260
|
|
|
|
|
12581
|
my $next_tokens = $self->lexer->fetch_next_tokens($indent); |
|
180
|
7229
|
100
|
|
|
|
16653
|
return unless @$next_tokens; |
|
181
|
|
|
|
|
|
|
|
|
182
|
5560
|
|
|
|
|
8363
|
my $next = $next_tokens->[0]; |
|
183
|
|
|
|
|
|
|
|
|
184
|
5560
|
100
|
|
|
|
14133
|
return 1 if ($next->{name} ne 'SPACE'); |
|
185
|
3681
|
|
|
|
|
7200
|
my $flow = $event_types->[-1] =~ m/^FLOW/; |
|
186
|
3681
|
|
|
|
|
6645
|
my $space = length $next->{value}; |
|
187
|
3681
|
|
|
|
|
7754
|
my $tokens = $self->tokens; |
|
188
|
|
|
|
|
|
|
|
|
189
|
3681
|
100
|
|
|
|
7432
|
if (not $space) { |
|
190
|
2655
|
|
|
|
|
4081
|
shift @$next_tokens; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
else { |
|
193
|
1026
|
|
|
|
|
1819
|
push @$tokens, shift @$next_tokens; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
3681
|
100
|
|
|
|
6866
|
if ($flow) { |
|
196
|
87
|
50
|
|
|
|
245
|
if ($space >= $indent) { |
|
197
|
87
|
|
|
|
|
233
|
return 1; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
0
|
|
|
|
|
0
|
$self->exception("Bad indendation in " . $self->events->[-1]); |
|
200
|
|
|
|
|
|
|
} |
|
201
|
3594
|
|
|
|
|
7452
|
$next = $next_tokens->[0]; |
|
202
|
3594
|
100
|
|
|
|
7800
|
if ($space > $indent ) { |
|
203
|
1116
|
100
|
|
|
|
3200
|
return 1 if $indent < 0; |
|
204
|
438
|
50
|
|
|
|
789
|
unless ($self->new_node) { |
|
205
|
0
|
|
|
|
|
0
|
$self->exception("Bad indendation in " . $self->events->[-1]); |
|
206
|
|
|
|
|
|
|
} |
|
207
|
438
|
|
|
|
|
1134
|
return 1; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
2478
|
100
|
|
|
|
4665
|
if ($self->new_node) { |
|
210
|
511
|
100
|
|
|
|
932
|
if ($space < $indent) { |
|
211
|
342
|
|
|
|
|
1379
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
212
|
342
|
|
|
|
|
703
|
$self->remove_nodes($space); |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
else { |
|
215
|
|
|
|
|
|
|
# unindented sequence starts |
|
216
|
169
|
|
|
|
|
397
|
my $exp = $self->events->[-1]; |
|
217
|
169
|
|
|
|
|
367
|
my $seq_start = $next->{name} eq 'DASH'; |
|
218
|
169
|
100
|
66
|
|
|
719
|
if ( $seq_start and ($exp eq 'MAPVALUE' or $exp eq 'MAP')) { |
|
|
|
|
100
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
else { |
|
221
|
92
|
|
|
|
|
328
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
else { |
|
226
|
1967
|
100
|
|
|
|
3952
|
if ($space < $indent) { |
|
227
|
548
|
|
|
|
|
1208
|
$self->remove_nodes($space); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
2478
|
|
|
|
|
4645
|
my $exp = $self->events->[-1]; |
|
232
|
|
|
|
|
|
|
|
|
233
|
2478
|
100
|
100
|
|
|
5871
|
if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') { |
|
234
|
29
|
|
|
|
|
53
|
TRACE and $self->info("In unindented sequence"); |
|
235
|
29
|
|
|
|
|
107
|
$self->end_sequence; |
|
236
|
29
|
|
|
|
|
92
|
$exp = $self->events->[-1]; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
2478
|
50
|
|
|
|
4480
|
if ($self->offset->[-1] != $space) { |
|
240
|
0
|
|
|
|
|
0
|
$self->exception("Expected " . $self->events->[-1]); |
|
241
|
|
|
|
|
|
|
} |
|
242
|
2478
|
|
|
|
|
6089
|
return 1; |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my %next_event = ( |
|
246
|
|
|
|
|
|
|
MAP => 'MAPVALUE', |
|
247
|
|
|
|
|
|
|
IMAP => 'IMAPVALUE', |
|
248
|
|
|
|
|
|
|
MAPVALUE => 'MAP', |
|
249
|
|
|
|
|
|
|
IMAPVALUE => 'IMAP', |
|
250
|
|
|
|
|
|
|
SEQ => 'SEQ', |
|
251
|
|
|
|
|
|
|
SEQ0 => 'SEQ0', |
|
252
|
|
|
|
|
|
|
DOC => 'DOC_END', |
|
253
|
|
|
|
|
|
|
STR => 'STR', |
|
254
|
|
|
|
|
|
|
FLOWSEQ => 'FLOWSEQ_NEXT', |
|
255
|
|
|
|
|
|
|
FLOWSEQ_NEXT => 'FLOWSEQ', |
|
256
|
|
|
|
|
|
|
FLOWMAP => 'FLOWMAPVALUE', |
|
257
|
|
|
|
|
|
|
FLOWMAPVALUE => 'FLOWMAP', |
|
258
|
|
|
|
|
|
|
); |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
my %event_to_method = ( |
|
261
|
|
|
|
|
|
|
MAP => 'mapping', |
|
262
|
|
|
|
|
|
|
IMAP => 'mapping', |
|
263
|
|
|
|
|
|
|
FLOWMAP => 'mapping', |
|
264
|
|
|
|
|
|
|
SEQ => 'sequence', |
|
265
|
|
|
|
|
|
|
SEQ0 => 'sequence', |
|
266
|
|
|
|
|
|
|
FLOWSEQ => 'sequence', |
|
267
|
|
|
|
|
|
|
DOC => 'document', |
|
268
|
|
|
|
|
|
|
STR => 'stream', |
|
269
|
|
|
|
|
|
|
VAL => 'scalar', |
|
270
|
|
|
|
|
|
|
ALI => 'alias', |
|
271
|
|
|
|
|
|
|
MAPVALUE => 'mapping', |
|
272
|
|
|
|
|
|
|
IMAPVALUE => 'mapping', |
|
273
|
|
|
|
|
|
|
); |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
#sub process_events { |
|
276
|
|
|
|
|
|
|
# my ($self, $res) = @_; |
|
277
|
|
|
|
|
|
|
# |
|
278
|
|
|
|
|
|
|
# my $event_stack = $self->event_stack; |
|
279
|
|
|
|
|
|
|
# return unless @$event_stack; |
|
280
|
|
|
|
|
|
|
# |
|
281
|
|
|
|
|
|
|
# if (@$event_stack == 1 and $event_stack->[0]->[0] eq 'properties') { |
|
282
|
|
|
|
|
|
|
# return; |
|
283
|
|
|
|
|
|
|
# } |
|
284
|
|
|
|
|
|
|
# |
|
285
|
|
|
|
|
|
|
# my $event_types = $self->events; |
|
286
|
|
|
|
|
|
|
# my $properties; |
|
287
|
|
|
|
|
|
|
# my @send_events; |
|
288
|
|
|
|
|
|
|
# for my $event (@$event_stack) { |
|
289
|
|
|
|
|
|
|
# TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$event], ['event']); |
|
290
|
|
|
|
|
|
|
# my ($type, $info) = @$event; |
|
291
|
|
|
|
|
|
|
# if ($type eq 'properties') { |
|
292
|
|
|
|
|
|
|
# $properties = $info; |
|
293
|
|
|
|
|
|
|
# } |
|
294
|
|
|
|
|
|
|
# elsif ($type eq 'scalar') { |
|
295
|
|
|
|
|
|
|
# $info->{name} = 'scalar_event'; |
|
296
|
|
|
|
|
|
|
# $event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
297
|
|
|
|
|
|
|
# push @send_events, $info; |
|
298
|
|
|
|
|
|
|
# } |
|
299
|
|
|
|
|
|
|
# elsif ($type eq 'begin') { |
|
300
|
|
|
|
|
|
|
# my $name = $info->{name}; |
|
301
|
|
|
|
|
|
|
# $info->{name} = $event_to_method{ $name } . '_start_event'; |
|
302
|
|
|
|
|
|
|
# push @{ $event_types }, $name; |
|
303
|
|
|
|
|
|
|
# push @{ $self->offset }, $info->{offset}; |
|
304
|
|
|
|
|
|
|
# push @send_events, $info; |
|
305
|
|
|
|
|
|
|
# } |
|
306
|
|
|
|
|
|
|
# elsif ($type eq 'end') { |
|
307
|
|
|
|
|
|
|
# my $name = $info->{name}; |
|
308
|
|
|
|
|
|
|
# $info->{name} = $event_to_method{ $name } . '_end_event'; |
|
309
|
|
|
|
|
|
|
# $self->$type($name, $info); |
|
310
|
|
|
|
|
|
|
# push @send_events, $info; |
|
311
|
|
|
|
|
|
|
# if (@$event_types) { |
|
312
|
|
|
|
|
|
|
# $event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
313
|
|
|
|
|
|
|
# } |
|
314
|
|
|
|
|
|
|
# } |
|
315
|
|
|
|
|
|
|
# elsif ($type eq 'alias') { |
|
316
|
|
|
|
|
|
|
# if ($properties) { |
|
317
|
|
|
|
|
|
|
# $self->exception("Parse error: Alias not allowed in this context"); |
|
318
|
|
|
|
|
|
|
# } |
|
319
|
|
|
|
|
|
|
# $info->{name} = 'alias_event'; |
|
320
|
|
|
|
|
|
|
# $event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
321
|
|
|
|
|
|
|
# push @send_events, $info; |
|
322
|
|
|
|
|
|
|
# } |
|
323
|
|
|
|
|
|
|
# } |
|
324
|
|
|
|
|
|
|
# @$event_stack = (); |
|
325
|
|
|
|
|
|
|
# for my $info (@send_events) { |
|
326
|
|
|
|
|
|
|
# DEBUG and $self->debug_event( $info ); |
|
327
|
|
|
|
|
|
|
# $self->callback->($self, $info->{name}, $info); |
|
328
|
|
|
|
|
|
|
# } |
|
329
|
|
|
|
|
|
|
#} |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
my %fetch_method = ( |
|
332
|
|
|
|
|
|
|
'"' => 'fetch_quoted', |
|
333
|
|
|
|
|
|
|
"'" => 'fetch_quoted', |
|
334
|
|
|
|
|
|
|
'|' => 'fetch_block', |
|
335
|
|
|
|
|
|
|
'>' => 'fetch_block', |
|
336
|
|
|
|
|
|
|
'' => 'fetch_plain', |
|
337
|
|
|
|
|
|
|
); |
|
338
|
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub parse_tokens { |
|
340
|
1727
|
|
|
1727
|
0
|
2710
|
my ($self) = @_; |
|
341
|
1727
|
|
|
|
|
3045
|
my $event_types = $self->events; |
|
342
|
1727
|
|
|
|
|
2894
|
my $offsets = $self->offset; |
|
343
|
1727
|
|
|
|
|
3088
|
my $tokens = $self->tokens; |
|
344
|
1727
|
|
|
|
|
2968
|
my $next_tokens = $self->lexer->next_tokens; |
|
345
|
|
|
|
|
|
|
|
|
346
|
1727
|
50
|
|
|
|
3253
|
unless ($self->lex_next_tokens) { |
|
347
|
0
|
|
|
|
|
0
|
$self->end_document(1); |
|
348
|
0
|
|
|
|
|
0
|
return 0; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
1696
|
50
|
|
|
|
3581
|
unless ($self->new_node) { |
|
351
|
1696
|
50
|
|
|
|
3442
|
if ($self->level > 0) { |
|
352
|
0
|
0
|
|
|
|
0
|
my $new_rule = $nodetypes{ $event_types->[-1] } |
|
353
|
|
|
|
|
|
|
or die "Did not find '$event_types->[-1]'"; |
|
354
|
0
|
|
|
|
|
0
|
$self->set_rule( $new_rule ); |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
1696
|
|
|
|
|
3605
|
my $rule_name = $self->rule; |
|
359
|
1696
|
|
|
|
|
2348
|
DEBUG and $self->info("----------------> parse_tokens($rule_name)"); |
|
360
|
1696
|
50
|
|
|
|
4380
|
my $rule = $GRAMMAR->{ $rule_name } |
|
361
|
|
|
|
|
|
|
or die "Could not find rule $rule_name"; |
|
362
|
|
|
|
|
|
|
|
|
363
|
1696
|
|
|
|
|
2169
|
TRACE and $self->debug_rules($rule); |
|
364
|
1696
|
|
|
|
|
2132
|
TRACE and $self->debug_yaml; |
|
365
|
1696
|
|
|
|
|
2349
|
DEBUG and $self->debug_next_line; |
|
366
|
|
|
|
|
|
|
|
|
367
|
1696
|
|
|
|
|
3450
|
RULE: while ($rule_name) { |
|
368
|
52246
|
|
|
|
|
63156
|
DEBUG and $self->info("RULE: $rule_name"); |
|
369
|
52246
|
|
|
|
|
58926
|
TRACE and $self->debug_tokens($next_tokens); |
|
370
|
|
|
|
|
|
|
|
|
371
|
52246
|
50
|
|
|
|
85099
|
unless (@$next_tokens) { |
|
372
|
0
|
|
|
|
|
0
|
$self->exception("No more tokens"); |
|
373
|
|
|
|
|
|
|
} |
|
374
|
52246
|
|
|
|
|
60178
|
TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']); |
|
375
|
52246
|
|
|
|
|
76054
|
my $got = $next_tokens->[0]->{name}; |
|
376
|
52246
|
100
|
|
|
|
87574
|
if ($got eq 'CONTEXT') { |
|
377
|
5703
|
|
|
|
|
8120
|
my $context = shift @$next_tokens; |
|
378
|
5703
|
|
|
|
|
9012
|
my $indent = $offsets->[-1]; |
|
379
|
5703
|
100
|
|
|
|
10709
|
$indent++ unless $self->lexer->flowcontext; |
|
380
|
5703
|
|
|
|
|
11604
|
my $method = $fetch_method{ $context->{value} }; |
|
381
|
5703
|
|
|
|
|
8992
|
my $partial = $self->lexer->$method($indent, $context->{value}); |
|
382
|
5698
|
|
|
|
|
19753
|
next RULE; |
|
383
|
|
|
|
|
|
|
} |
|
384
|
46543
|
|
|
|
|
71059
|
my $def = $rule->{ $got }; |
|
385
|
46543
|
100
|
|
|
|
80709
|
if ($def) { |
|
|
|
100
|
|
|
|
|
|
|
386
|
30097
|
|
|
|
|
50773
|
push @$tokens, shift @$next_tokens; |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
elsif ($def = $rule->{DEFAULT}) { |
|
389
|
16444
|
|
|
|
|
22268
|
$got = 'DEFAULT'; |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
else { |
|
392
|
2
|
|
|
|
|
13
|
$self->expected( |
|
393
|
|
|
|
|
|
|
expected => [keys %$rule], |
|
394
|
|
|
|
|
|
|
got => $next_tokens->[0], |
|
395
|
|
|
|
|
|
|
); |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
46541
|
|
|
|
|
57248
|
DEBUG and $self->got("---got $got"); |
|
399
|
46541
|
100
|
|
|
|
88893
|
if (my $sub = $def->{match}) { |
|
400
|
20972
|
|
|
|
|
26313
|
DEBUG and $self->info("CALLBACK $sub"); |
|
401
|
20972
|
100
|
|
|
|
62168
|
$self->$sub(@$tokens ? $tokens->[-1] : ()); |
|
402
|
|
|
|
|
|
|
} |
|
403
|
46521
|
|
|
|
|
70886
|
my $eol = $got eq 'EOL'; |
|
404
|
46521
|
|
|
|
|
67929
|
my $new = $def->{new}; |
|
405
|
46521
|
100
|
|
|
|
85121
|
if ($new) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
406
|
25667
|
|
|
|
|
30101
|
DEBUG and $self->got("NEW: $new"); |
|
407
|
25667
|
|
|
|
|
34075
|
$rule_name = $new; |
|
408
|
25667
|
|
|
|
|
43138
|
$self->set_rule($rule_name); |
|
409
|
|
|
|
|
|
|
} |
|
410
|
|
|
|
|
|
|
elsif ($eol) { |
|
411
|
|
|
|
|
|
|
} |
|
412
|
|
|
|
|
|
|
elsif ($def->{return}) { |
|
413
|
2570
|
50
|
|
|
|
6290
|
$rule_name = $nodetypes{ $event_types->[-1] } |
|
414
|
|
|
|
|
|
|
or die "Unexpected event type $event_types->[-1]"; |
|
415
|
2570
|
|
|
|
|
4466
|
$self->set_rule($rule_name); |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
else { |
|
418
|
14398
|
|
|
|
|
27868
|
$rule_name .= " - $got"; # for debugging |
|
419
|
14398
|
|
|
|
|
19155
|
$rule = $def; |
|
420
|
14398
|
|
|
|
|
32489
|
next RULE; |
|
421
|
|
|
|
|
|
|
} |
|
422
|
32123
|
100
|
|
|
|
54860
|
if ($eol) { |
|
423
|
5533
|
100
|
|
|
|
10386
|
unless ($self->lex_next_tokens) { |
|
424
|
1669
|
50
|
|
|
|
3497
|
if ($rule_name eq 'DIRECTIVE') { |
|
425
|
0
|
|
|
|
|
0
|
$self->exception("Directive needs document start"); |
|
426
|
|
|
|
|
|
|
} |
|
427
|
1669
|
|
|
|
|
4135
|
$self->end_document(1); |
|
428
|
1662
|
|
|
|
|
3887
|
return 0; |
|
429
|
|
|
|
|
|
|
} |
|
430
|
3864
|
100
|
|
|
|
6765
|
unless ($self->new_node) { |
|
431
|
2888
|
100
|
|
|
|
5119
|
if ($self->level > 0) { |
|
432
|
2762
|
50
|
|
|
|
7873
|
$rule_name = $nodetypes{ $event_types->[-1] } |
|
433
|
|
|
|
|
|
|
or die "Did not find '$event_types->[-1]'"; |
|
434
|
2762
|
|
|
|
|
5054
|
$self->set_rule( $rule_name ); |
|
435
|
|
|
|
|
|
|
} |
|
436
|
|
|
|
|
|
|
} |
|
437
|
3864
|
|
|
|
|
7006
|
$rule_name = $self->rule; |
|
438
|
|
|
|
|
|
|
} |
|
439
|
30454
|
50
|
|
|
|
82106
|
$rule = $GRAMMAR->{ $rule_name } |
|
440
|
|
|
|
|
|
|
or die "Unexpected rule $rule_name"; |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
} |
|
443
|
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
0
|
die "Unexpected"; |
|
445
|
|
|
|
|
|
|
} |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
sub end_sequence { |
|
448
|
29
|
|
|
29
|
0
|
78
|
my ($self) = @_; |
|
449
|
29
|
|
|
|
|
64
|
my $event_types = $self->events; |
|
450
|
29
|
|
|
|
|
47
|
pop @{ $event_types }; |
|
|
29
|
|
|
|
|
57
|
|
|
451
|
29
|
|
|
|
|
48
|
pop @{ $self->offset }; |
|
|
29
|
|
|
|
|
96
|
|
|
452
|
29
|
|
|
|
|
78
|
my $info = { name => 'sequence_end_event' }; |
|
453
|
29
|
|
|
|
|
95
|
$self->callback->($self, $info->{name} => $info ); |
|
454
|
29
|
|
|
|
|
128
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
455
|
|
|
|
|
|
|
} |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
sub remove_nodes { |
|
458
|
2807
|
|
|
2807
|
0
|
4549
|
my ($self, $space) = @_; |
|
459
|
2807
|
|
|
|
|
5002
|
my $offset = $self->offset; |
|
460
|
2807
|
|
|
|
|
4798
|
my $event_types = $self->events; |
|
461
|
|
|
|
|
|
|
|
|
462
|
2807
|
|
|
|
|
4378
|
my $exp = $event_types->[-1]; |
|
463
|
2807
|
|
|
|
|
5720
|
while (@$offset) { |
|
464
|
4469
|
100
|
|
|
|
8535
|
if ($offset->[ -1 ] <= $space) { |
|
465
|
2800
|
|
|
|
|
4378
|
last; |
|
466
|
|
|
|
|
|
|
} |
|
467
|
1669
|
100
|
|
|
|
3139
|
if ($exp eq 'MAPVALUE') { |
|
468
|
9
|
|
|
|
|
64
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
469
|
9
|
|
|
|
|
35
|
$exp = 'MAP'; |
|
470
|
|
|
|
|
|
|
} |
|
471
|
1669
|
|
|
|
|
3318
|
my $info = { name => $exp }; |
|
472
|
1669
|
|
|
|
|
4170
|
$info->{name} = $event_to_method{ $exp } . '_end_event'; |
|
473
|
1669
|
|
|
|
|
2288
|
pop @{ $event_types }; |
|
|
1669
|
|
|
|
|
2460
|
|
|
474
|
1669
|
|
|
|
|
2329
|
pop @{ $offset }; |
|
|
1669
|
|
|
|
|
2269
|
|
|
475
|
1669
|
|
|
|
|
3363
|
$self->callback->($self, $info->{name} => $info ); |
|
476
|
1662
|
|
|
|
|
4546
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
477
|
1662
|
|
|
|
|
4291
|
$exp = $event_types->[-1]; |
|
478
|
|
|
|
|
|
|
} |
|
479
|
2800
|
|
|
|
|
4611
|
return $exp; |
|
480
|
|
|
|
|
|
|
} |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub start_stream { |
|
483
|
1727
|
|
|
1727
|
0
|
2693
|
my ($self) = @_; |
|
484
|
1727
|
|
|
|
|
2411
|
push @{ $self->events }, 'STR'; |
|
|
1727
|
|
|
|
|
2921
|
|
|
485
|
1727
|
|
|
|
|
2461
|
push @{ $self->offset }, -1; |
|
|
1727
|
|
|
|
|
3181
|
|
|
486
|
1727
|
|
|
|
|
5557
|
$self->callback->($self, 'stream_start_event', { |
|
487
|
|
|
|
|
|
|
name => 'stream_start_event', |
|
488
|
|
|
|
|
|
|
}); |
|
489
|
|
|
|
|
|
|
} |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub start_document { |
|
492
|
1827
|
|
|
1827
|
0
|
3206
|
my ($self, $implicit) = @_; |
|
493
|
1827
|
|
|
|
|
2589
|
push @{ $self->events }, 'DOC'; |
|
|
1827
|
|
|
|
|
3454
|
|
|
494
|
1827
|
|
|
|
|
2692
|
push @{ $self->offset }, -1; |
|
|
1827
|
|
|
|
|
3176
|
|
|
495
|
1827
|
|
|
|
|
3368
|
my $directive = $self->yaml_version_directive; |
|
496
|
1827
|
|
|
|
|
2446
|
my %directive; |
|
497
|
1827
|
100
|
|
|
|
3615
|
if ($directive) { |
|
498
|
47
|
|
|
|
|
160
|
my ($major, $minor) = split m/\./, $self->yaml_version; |
|
499
|
47
|
|
|
|
|
224
|
%directive = ( version_directive => { major => $major, minor => $minor } ); |
|
500
|
|
|
|
|
|
|
} |
|
501
|
1827
|
|
|
|
|
6439
|
$self->callback->($self, 'document_start_event', { |
|
502
|
|
|
|
|
|
|
name => 'document_start_event', |
|
503
|
|
|
|
|
|
|
implicit => $implicit, |
|
504
|
|
|
|
|
|
|
%directive, |
|
505
|
|
|
|
|
|
|
}); |
|
506
|
1827
|
|
|
|
|
5937
|
$self->set_yaml_version_directive(undef); |
|
507
|
1827
|
|
|
|
|
3988
|
$self->set_rule( 'FULLNODE' ); |
|
508
|
1827
|
|
|
|
|
3303
|
$self->set_new_node(1); |
|
509
|
|
|
|
|
|
|
} |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
sub start_sequence { |
|
512
|
713
|
|
|
713
|
0
|
1148
|
my ($self, $offset) = @_; |
|
513
|
713
|
|
|
|
|
1189
|
my $offsets = $self->offset; |
|
514
|
713
|
100
|
|
|
|
1527
|
if ($offsets->[-1] == $offset) { |
|
515
|
77
|
|
|
|
|
130
|
push @{ $self->events }, 'SEQ0'; |
|
|
77
|
|
|
|
|
157
|
|
|
516
|
|
|
|
|
|
|
} |
|
517
|
|
|
|
|
|
|
else { |
|
518
|
636
|
|
|
|
|
925
|
push @{ $self->events }, 'SEQ'; |
|
|
636
|
|
|
|
|
1122
|
|
|
519
|
|
|
|
|
|
|
} |
|
520
|
713
|
|
|
|
|
1067
|
push @{ $offsets }, $offset; |
|
|
713
|
|
|
|
|
1049
|
|
|
521
|
713
|
|
|
|
|
1311
|
my $event_stack = $self->event_stack; |
|
522
|
713
|
|
|
|
|
1589
|
my $info = { name => 'sequence_start_event' }; |
|
523
|
713
|
100
|
66
|
|
|
1772
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
524
|
19
|
|
|
|
|
40
|
my $properties = pop @$event_stack; |
|
525
|
19
|
|
|
|
|
66
|
$self->node_properties($properties->[1], $info); |
|
526
|
|
|
|
|
|
|
} |
|
527
|
713
|
|
|
|
|
1454
|
$self->callback->($self, 'sequence_start_event', $info); |
|
528
|
|
|
|
|
|
|
} |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
sub start_flow_sequence { |
|
531
|
809
|
|
|
809
|
0
|
1381
|
my ($self, $offset) = @_; |
|
532
|
809
|
|
|
|
|
1420
|
my $offsets = $self->offset; |
|
533
|
809
|
|
|
|
|
1188
|
my $new_offset = $offsets->[-1]; |
|
534
|
809
|
|
|
|
|
1245
|
my $event_types = $self->events; |
|
535
|
809
|
100
|
|
|
|
1794
|
if ($new_offset < 0) { |
|
|
|
100
|
|
|
|
|
|
|
536
|
11
|
|
|
|
|
24
|
$new_offset = 0; |
|
537
|
|
|
|
|
|
|
} |
|
538
|
|
|
|
|
|
|
elsif ($self->new_node) { |
|
539
|
776
|
100
|
|
|
|
1800
|
if ($event_types->[-1] !~ m/^FLOW/) { |
|
540
|
771
|
|
|
|
|
1105
|
$new_offset++; |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
} |
|
543
|
809
|
|
|
|
|
1118
|
push @{ $self->events }, 'FLOWSEQ'; |
|
|
809
|
|
|
|
|
1186
|
|
|
544
|
809
|
|
|
|
|
1023
|
push @{ $offsets }, $new_offset; |
|
|
809
|
|
|
|
|
1140
|
|
|
545
|
|
|
|
|
|
|
|
|
546
|
809
|
|
|
|
|
1342
|
my $event_stack = $self->event_stack; |
|
547
|
809
|
|
|
|
|
2139
|
my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' }; |
|
548
|
809
|
100
|
66
|
|
|
1897
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
549
|
10
|
|
|
|
|
34
|
$self->fetch_inline_properties($event_stack, $info); |
|
550
|
|
|
|
|
|
|
} |
|
551
|
809
|
|
|
|
|
1572
|
$self->callback->($self, 'sequence_start_event', $info); |
|
552
|
|
|
|
|
|
|
} |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub start_flow_mapping { |
|
555
|
349
|
|
|
349
|
0
|
779
|
my ($self, $offset, $implicit_flowseq_map) = @_; |
|
556
|
349
|
|
|
|
|
618
|
my $offsets = $self->offset; |
|
557
|
349
|
|
|
|
|
567
|
my $new_offset = $offsets->[-1]; |
|
558
|
349
|
|
|
|
|
602
|
my $event_types = $self->events; |
|
559
|
349
|
100
|
|
|
|
889
|
if ($new_offset < 0) { |
|
|
|
100
|
|
|
|
|
|
|
560
|
13
|
|
|
|
|
23
|
$new_offset = 0; |
|
561
|
|
|
|
|
|
|
} |
|
562
|
|
|
|
|
|
|
elsif ($self->new_node) { |
|
563
|
309
|
100
|
|
|
|
731
|
if ($event_types->[-1] !~ m/^FLOW/) { |
|
564
|
302
|
|
|
|
|
459
|
$new_offset++; |
|
565
|
|
|
|
|
|
|
} |
|
566
|
|
|
|
|
|
|
} |
|
567
|
349
|
50
|
|
|
|
470
|
push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP'; |
|
|
349
|
|
|
|
|
571
|
|
|
568
|
349
|
|
|
|
|
470
|
push @{ $offsets }, $new_offset; |
|
|
349
|
|
|
|
|
530
|
|
|
569
|
|
|
|
|
|
|
|
|
570
|
349
|
|
|
|
|
642
|
my $event_stack = $self->event_stack; |
|
571
|
349
|
|
|
|
|
1005
|
my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE }; |
|
572
|
349
|
100
|
66
|
|
|
923
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
573
|
25
|
|
|
|
|
59
|
$self->fetch_inline_properties($event_stack, $info); |
|
574
|
|
|
|
|
|
|
} |
|
575
|
349
|
|
|
|
|
714
|
$self->callback->($self, 'mapping_start_event', $info); |
|
576
|
|
|
|
|
|
|
} |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub end_flow_sequence { |
|
579
|
809
|
|
|
809
|
0
|
1401
|
my ($self) = @_; |
|
580
|
809
|
|
|
|
|
1347
|
my $event_types = $self->events; |
|
581
|
809
|
|
|
|
|
1187
|
pop @{ $event_types }; |
|
|
809
|
|
|
|
|
1123
|
|
|
582
|
809
|
|
|
|
|
1066
|
pop @{ $self->offset }; |
|
|
809
|
|
|
|
|
1469
|
|
|
583
|
809
|
|
|
|
|
1759
|
my $info = { name => 'sequence_end_event' }; |
|
584
|
809
|
|
|
|
|
1701
|
$self->callback->($self, $info->{name}, $info); |
|
585
|
809
|
100
|
|
|
|
3655
|
if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { |
|
586
|
27
|
|
|
|
|
63
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
587
|
|
|
|
|
|
|
} |
|
588
|
|
|
|
|
|
|
else { |
|
589
|
782
|
|
|
|
|
1746
|
push @$event_types, 'END_FLOW'; |
|
590
|
|
|
|
|
|
|
} |
|
591
|
|
|
|
|
|
|
} |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
sub end_flow_mapping { |
|
594
|
348
|
|
|
348
|
0
|
570
|
my ($self) = @_; |
|
595
|
348
|
|
|
|
|
551
|
my $event_types = $self->events; |
|
596
|
348
|
|
|
|
|
469
|
pop @{ $event_types }; |
|
|
348
|
|
|
|
|
520
|
|
|
597
|
348
|
|
|
|
|
499
|
pop @{ $self->offset }; |
|
|
348
|
|
|
|
|
578
|
|
|
598
|
348
|
|
|
|
|
750
|
my $info = { name => 'mapping_end_event' }; |
|
599
|
348
|
|
|
|
|
699
|
$self->callback->($self, $info->{name}, $info); |
|
600
|
340
|
100
|
|
|
|
1547
|
if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { |
|
601
|
34
|
|
|
|
|
86
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
602
|
|
|
|
|
|
|
} |
|
603
|
|
|
|
|
|
|
else { |
|
604
|
306
|
|
|
|
|
618
|
push @$event_types, 'END_FLOW'; |
|
605
|
|
|
|
|
|
|
} |
|
606
|
|
|
|
|
|
|
} |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub cb_end_outer_flow { |
|
609
|
1087
|
|
|
1087
|
0
|
1857
|
my ($self) = @_; |
|
610
|
1087
|
|
|
|
|
1720
|
my $event_types = $self->events; |
|
611
|
1087
|
|
|
|
|
1577
|
pop @$event_types; |
|
612
|
1087
|
|
|
|
|
2261
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
613
|
|
|
|
|
|
|
} |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
sub start_mapping { |
|
616
|
1006
|
|
|
1006
|
0
|
1711
|
my ($self, $offset) = @_; |
|
617
|
1006
|
|
|
|
|
1818
|
my $offsets = $self->offset; |
|
618
|
1006
|
|
|
|
|
1396
|
push @{ $self->events }, 'MAP'; |
|
|
1006
|
|
|
|
|
1794
|
|
|
619
|
1006
|
|
|
|
|
1399
|
push @{ $offsets }, $offset; |
|
|
1006
|
|
|
|
|
1516
|
|
|
620
|
1006
|
|
|
|
|
1871
|
my $event_stack = $self->event_stack; |
|
621
|
1006
|
|
|
|
|
2170
|
my $info = { name => 'mapping_start_event' }; |
|
622
|
1006
|
100
|
66
|
|
|
2458
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
623
|
54
|
|
|
|
|
94
|
my $properties = pop @$event_stack; |
|
624
|
54
|
|
|
|
|
122
|
$self->node_properties($properties->[1], $info); |
|
625
|
|
|
|
|
|
|
} |
|
626
|
1006
|
|
|
|
|
1986
|
$self->callback->($self, 'mapping_start_event', $info); |
|
627
|
|
|
|
|
|
|
} |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
sub end_document { |
|
630
|
1917
|
|
|
1917
|
0
|
3379
|
my ($self, $implicit) = @_; |
|
631
|
|
|
|
|
|
|
|
|
632
|
1917
|
|
|
|
|
3152
|
my $event_types = $self->events; |
|
633
|
1917
|
50
|
|
|
|
5215
|
if ($event_types->[-1] =~ m/FLOW/) { |
|
634
|
0
|
|
|
|
|
0
|
die "Unexpected end of flow context"; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
1917
|
100
|
|
|
|
3943
|
if ($self->new_node) { |
|
637
|
50
|
|
|
|
|
225
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
638
|
|
|
|
|
|
|
} |
|
639
|
1917
|
|
|
|
|
4939
|
$self->remove_nodes(-1); |
|
640
|
|
|
|
|
|
|
|
|
641
|
1910
|
100
|
|
|
|
4037
|
if ($event_types->[-1] eq 'STR') { |
|
642
|
117
|
|
|
|
|
190
|
return; |
|
643
|
|
|
|
|
|
|
} |
|
644
|
1793
|
|
|
|
|
2461
|
my $last = pop @{ $event_types }; |
|
|
1793
|
|
|
|
|
2827
|
|
|
645
|
1793
|
50
|
33
|
|
|
7021
|
if ($last ne 'DOC' and $last ne 'DOC_END') { |
|
646
|
0
|
|
|
|
|
0
|
$self->exception("Unexpected event type $last"); |
|
647
|
|
|
|
|
|
|
} |
|
648
|
1793
|
|
|
|
|
2513
|
pop @{ $self->offset }; |
|
|
1793
|
|
|
|
|
3158
|
|
|
649
|
1793
|
|
|
|
|
6201
|
$self->callback->($self, 'document_end_event', { |
|
650
|
|
|
|
|
|
|
name => 'document_end_event', |
|
651
|
|
|
|
|
|
|
implicit => $implicit, |
|
652
|
|
|
|
|
|
|
}); |
|
653
|
1793
|
100
|
|
|
|
4930
|
if ($self->yaml_version eq '1.2') { |
|
654
|
|
|
|
|
|
|
# In YAML 1.2, directives are only for the following |
|
655
|
|
|
|
|
|
|
# document. In YAML 1.1, they are global |
|
656
|
1747
|
|
|
|
|
4533
|
$self->set_tagmap({ '!!' => "tag:yaml.org,2002:" }); |
|
657
|
|
|
|
|
|
|
} |
|
658
|
1793
|
|
|
|
|
3976
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
659
|
1793
|
|
|
|
|
3452
|
$self->set_rule('STREAM'); |
|
660
|
|
|
|
|
|
|
} |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
sub end_stream { |
|
663
|
1662
|
|
|
1662
|
0
|
2832
|
my ($self) = @_; |
|
664
|
1662
|
|
|
|
|
2258
|
my $last = pop @{ $self->events }; |
|
|
1662
|
|
|
|
|
2780
|
|
|
665
|
1662
|
50
|
|
|
|
3977
|
$self->exception("Unexpected event type $last") unless $last eq 'STR'; |
|
666
|
1662
|
|
|
|
|
2199
|
pop @{ $self->offset }; |
|
|
1662
|
|
|
|
|
2765
|
|
|
667
|
1662
|
|
|
|
|
4512
|
$self->callback->($self, 'stream_end_event', { |
|
668
|
|
|
|
|
|
|
name => 'stream_end_event', |
|
669
|
|
|
|
|
|
|
}); |
|
670
|
|
|
|
|
|
|
} |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
sub fetch_inline_properties { |
|
673
|
1228
|
|
|
1228
|
0
|
2295
|
my ($self, $stack, $info) = @_; |
|
674
|
1228
|
|
|
|
|
1877
|
my $properties = $stack->[-1]; |
|
675
|
|
|
|
|
|
|
|
|
676
|
1228
|
|
|
|
|
1725
|
$properties = $properties->[1]; |
|
677
|
1228
|
|
|
|
|
1779
|
my $property_offset; |
|
678
|
1228
|
50
|
|
|
|
2358
|
if ($properties) { |
|
679
|
1228
|
|
|
|
|
1645
|
for my $p (@{ $properties->{inline} }) { |
|
|
1228
|
|
|
|
|
2637
|
|
|
680
|
1440
|
|
|
|
|
2187
|
my $type = $p->{type}; |
|
681
|
1440
|
50
|
|
|
|
2812
|
if (exists $info->{ $type }) { |
|
682
|
0
|
|
|
|
|
0
|
$self->exception("A node can only have one $type"); |
|
683
|
|
|
|
|
|
|
} |
|
684
|
1440
|
|
|
|
|
2604
|
$info->{ $type } = $p->{value}; |
|
685
|
1440
|
100
|
|
|
|
2896
|
unless (defined $property_offset) { |
|
686
|
1175
|
|
|
|
|
1743
|
$property_offset = $p->{offset}; |
|
687
|
1175
|
|
|
|
|
2325
|
$info->{offset} = $p->{offset}; |
|
688
|
|
|
|
|
|
|
} |
|
689
|
|
|
|
|
|
|
} |
|
690
|
1228
|
|
|
|
|
3241
|
delete $properties->{inline}; |
|
691
|
1228
|
100
|
|
|
|
3606
|
undef $properties unless $properties->{newline}; |
|
692
|
|
|
|
|
|
|
} |
|
693
|
|
|
|
|
|
|
|
|
694
|
1228
|
100
|
|
|
|
2510
|
unless ($properties) { |
|
695
|
1175
|
|
|
|
|
2138
|
pop @$stack; |
|
696
|
|
|
|
|
|
|
} |
|
697
|
|
|
|
|
|
|
} |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
sub node_properties { |
|
700
|
246
|
|
|
246
|
0
|
469
|
my ($self, $properties, $info) = @_; |
|
701
|
246
|
50
|
|
|
|
604
|
if ($properties) { |
|
702
|
246
|
|
|
|
|
365
|
for my $p (@{ $properties->{newline} }) { |
|
|
246
|
|
|
|
|
536
|
|
|
703
|
355
|
|
|
|
|
579
|
my $type = $p->{type}; |
|
704
|
355
|
50
|
|
|
|
730
|
if (exists $info->{ $type }) { |
|
705
|
0
|
|
|
|
|
0
|
$self->exception("A node can only have one $type"); |
|
706
|
|
|
|
|
|
|
} |
|
707
|
355
|
|
|
|
|
763
|
$info->{ $type } = $p->{value}; |
|
708
|
|
|
|
|
|
|
} |
|
709
|
246
|
|
|
|
|
943
|
undef $properties; |
|
710
|
|
|
|
|
|
|
} |
|
711
|
|
|
|
|
|
|
} |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
sub scalar_event { |
|
714
|
7240
|
|
|
7240
|
0
|
11755
|
my ($self, $info) = @_; |
|
715
|
7240
|
|
|
|
|
12831
|
my $event_types = $self->events; |
|
716
|
7240
|
|
|
|
|
11882
|
my $event_stack = $self->event_stack; |
|
717
|
7240
|
100
|
66
|
|
|
15528
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
718
|
173
|
|
|
|
|
280
|
my $properties = pop @$event_stack; |
|
719
|
173
|
|
|
|
|
372
|
$properties = $self->node_properties($properties->[1], $info); |
|
720
|
|
|
|
|
|
|
} |
|
721
|
|
|
|
|
|
|
|
|
722
|
7240
|
|
|
|
|
13129
|
$info->{name} = 'scalar_event'; |
|
723
|
7240
|
|
|
|
|
13731
|
$self->callback->($self, 'scalar_event', $info); |
|
724
|
7231
|
|
|
|
|
21586
|
$self->set_new_node(0); |
|
725
|
7231
|
|
|
|
|
16688
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
726
|
|
|
|
|
|
|
} |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
sub alias_event { |
|
729
|
138
|
|
|
138
|
0
|
223
|
my ($self, $info) = @_; |
|
730
|
138
|
|
|
|
|
264
|
my $event_stack = $self->event_stack; |
|
731
|
138
|
50
|
33
|
|
|
396
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
732
|
0
|
|
|
|
|
0
|
$self->exception("Parse error: Alias not allowed in this context"); |
|
733
|
|
|
|
|
|
|
} |
|
734
|
138
|
|
|
|
|
291
|
my $event_types = $self->events; |
|
735
|
138
|
|
|
|
|
282
|
$info->{name} = 'alias_event'; |
|
736
|
138
|
|
|
|
|
335
|
$self->callback->($self, 'alias_event', $info); |
|
737
|
136
|
|
|
|
|
435
|
$self->set_new_node(0); |
|
738
|
136
|
|
|
|
|
412
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
739
|
|
|
|
|
|
|
} |
|
740
|
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
sub yaml_to_tokens { |
|
742
|
5
|
|
|
5
|
0
|
5075
|
my ($class, $type, $input) = @_; |
|
743
|
5
|
|
|
38
|
|
32
|
my $yp = YAML::PP::Parser->new( receiver => sub {} ); |
|
744
|
5
|
|
|
|
|
8
|
my @docs = eval { |
|
745
|
5
|
50
|
|
|
|
19
|
$type eq 'string' ? $yp->parse_string($input) : $yp->parse_file($input); |
|
746
|
|
|
|
|
|
|
}; |
|
747
|
5
|
|
|
|
|
11
|
my $error = $@; |
|
748
|
|
|
|
|
|
|
|
|
749
|
5
|
|
|
|
|
11
|
my $tokens = $yp->tokens; |
|
750
|
5
|
100
|
|
|
|
11
|
if ($error) { |
|
751
|
1
|
|
|
|
|
6
|
my $remaining_tokens = $yp->_remaining_tokens; |
|
752
|
1
|
|
|
|
|
4
|
push @$tokens, map { +{ %$_, name => 'ERROR' } } @$remaining_tokens; |
|
|
1
|
|
|
|
|
7
|
|
|
753
|
|
|
|
|
|
|
} |
|
754
|
5
|
|
|
|
|
71
|
return $error, $tokens; |
|
755
|
|
|
|
|
|
|
} |
|
756
|
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
sub _remaining_tokens { |
|
758
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
|
759
|
1
|
|
|
|
|
2
|
my @tokens; |
|
760
|
1
|
|
|
|
|
4
|
my $next = $self->lexer->next_tokens; |
|
761
|
1
|
|
|
|
|
3
|
push @tokens, @$next; |
|
762
|
1
|
|
|
|
|
3
|
my $next_line = $self->lexer->next_line; |
|
763
|
1
|
|
|
|
|
3
|
my $remaining = ''; |
|
764
|
1
|
50
|
|
|
|
3
|
if ($next_line) { |
|
765
|
1
|
50
|
|
|
|
4
|
if ($self->lexer->offset > 0) { |
|
766
|
1
|
|
|
|
|
3
|
$remaining = $next_line->[1] . $next_line->[2]; |
|
767
|
|
|
|
|
|
|
} |
|
768
|
|
|
|
|
|
|
else { |
|
769
|
0
|
|
|
|
|
0
|
$remaining = join '', @$next_line; |
|
770
|
|
|
|
|
|
|
} |
|
771
|
|
|
|
|
|
|
} |
|
772
|
1
|
|
|
|
|
4
|
$remaining .= $self->reader->read; |
|
773
|
1
|
50
|
|
|
|
6
|
$remaining = '' unless defined $remaining; |
|
774
|
1
|
|
|
|
|
5
|
push @tokens, { name => "ERROR", value => $remaining }; |
|
775
|
1
|
|
|
|
|
3
|
return \@tokens; |
|
776
|
|
|
|
|
|
|
} |
|
777
|
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
# deprecated |
|
779
|
|
|
|
|
|
|
sub event_to_test_suite { |
|
780
|
|
|
|
|
|
|
# uncoverable subroutine |
|
781
|
0
|
|
|
0
|
0
|
0
|
my ($self, $event) = @_; # uncoverable statement |
|
782
|
0
|
0
|
|
|
|
0
|
if (ref $event eq 'ARRAY') { # uncoverable statement |
|
783
|
0
|
|
|
|
|
0
|
return YAML::PP::Common::event_to_test_suite($event->[1]); # uncoverable statement |
|
784
|
|
|
|
|
|
|
} |
|
785
|
0
|
|
|
|
|
0
|
return YAML::PP::Common::event_to_test_suite($event); # uncoverable statement |
|
786
|
|
|
|
|
|
|
} |
|
787
|
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
sub debug_events { |
|
789
|
|
|
|
|
|
|
# uncoverable subroutine |
|
790
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; # uncoverable statement |
|
791
|
|
|
|
|
|
|
$self->note("EVENTS: (" # uncoverable statement |
|
792
|
0
|
|
|
|
|
0
|
. join (' | ', @{ $_[0]->events }) . ')' # uncoverable statement |
|
|
0
|
|
|
|
|
0
|
|
|
793
|
|
|
|
|
|
|
); |
|
794
|
0
|
|
|
|
|
0
|
$self->debug_offset; # uncoverable statement |
|
795
|
|
|
|
|
|
|
} |
|
796
|
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
sub debug_offset { |
|
798
|
|
|
|
|
|
|
# uncoverable subroutine |
|
799
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; # uncoverable statement |
|
800
|
|
|
|
|
|
|
$self->note( |
|
801
|
|
|
|
|
|
|
qq{OFFSET: (} |
|
802
|
|
|
|
|
|
|
# uncoverable statement count:1 |
|
803
|
|
|
|
|
|
|
# uncoverable statement count:2 |
|
804
|
|
|
|
|
|
|
# uncoverable statement count:3 |
|
805
|
0
|
0
|
|
|
|
0
|
. join (' | ', map { defined $_ ? sprintf "%-3d", $_ : '?' } @{ $_[0]->offset }) |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
806
|
|
|
|
|
|
|
# uncoverable statement |
|
807
|
0
|
|
|
|
|
0
|
. qq/) level=@{[ $_[0]->level ]}]}/ |
|
808
|
|
|
|
|
|
|
); |
|
809
|
|
|
|
|
|
|
} |
|
810
|
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
sub debug_yaml { |
|
812
|
|
|
|
|
|
|
# uncoverable subroutine |
|
813
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; # uncoverable statement |
|
814
|
0
|
|
|
|
|
0
|
my $line = $self->lexer->line; # uncoverable statement |
|
815
|
0
|
|
|
|
|
0
|
$self->note("LINE NUMBER: $line"); # uncoverable statement |
|
816
|
0
|
|
|
|
|
0
|
my $next_tokens = $self->lexer->next_tokens; # uncoverable statement |
|
817
|
0
|
0
|
|
|
|
0
|
if (@$next_tokens) { # uncoverable statement |
|
818
|
0
|
|
|
|
|
0
|
$self->debug_tokens($next_tokens); # uncoverable statement |
|
819
|
|
|
|
|
|
|
} |
|
820
|
|
|
|
|
|
|
} |
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
sub debug_next_line { |
|
823
|
1
|
|
|
1
|
0
|
8
|
my ($self) = @_; |
|
824
|
1
|
|
50
|
|
|
4
|
my $next_line = $self->lexer->next_line || []; |
|
825
|
1
|
|
|
|
|
3
|
my $line = $next_line->[0]; |
|
826
|
1
|
50
|
|
|
|
14
|
$line = '' unless defined $line; |
|
827
|
1
|
|
|
|
|
4
|
$line =~ s/( +)$/'·' x length $1/e; |
|
|
0
|
|
|
|
|
0
|
|
|
828
|
1
|
|
|
|
|
2
|
$line =~ s/\t/â–¸/g; |
|
829
|
1
|
|
|
|
|
8
|
$self->note("NEXT LINE: >>$line<<"); |
|
830
|
|
|
|
|
|
|
} |
|
831
|
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
sub note { |
|
833
|
1
|
|
|
1
|
0
|
3
|
my ($self, $msg) = @_; |
|
834
|
1
|
|
|
|
|
7
|
$self->_colorize_warn(["yellow"], "============ $msg"); |
|
835
|
|
|
|
|
|
|
} |
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
sub info { |
|
838
|
28
|
|
|
28
|
0
|
44
|
my ($self, $msg) = @_; |
|
839
|
28
|
|
|
|
|
86
|
$self->_colorize_warn(["cyan"], "============ $msg"); |
|
840
|
|
|
|
|
|
|
} |
|
841
|
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
sub got { |
|
843
|
14
|
|
|
14
|
0
|
22
|
my ($self, $msg) = @_; |
|
844
|
14
|
|
|
|
|
38
|
$self->_colorize_warn(["green"], "============ $msg"); |
|
845
|
|
|
|
|
|
|
} |
|
846
|
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
sub _colorize_warn { |
|
848
|
|
|
|
|
|
|
# uncoverable subroutine |
|
849
|
0
|
|
|
0
|
|
0
|
my ($self, $colors, $text) = @_; # uncoverable statement |
|
850
|
0
|
|
|
|
|
0
|
require Term::ANSIColor; # uncoverable statement |
|
851
|
0
|
|
|
|
|
0
|
warn Term::ANSIColor::colored($colors, $text), "\n"; # uncoverable statement |
|
852
|
|
|
|
|
|
|
} |
|
853
|
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
sub debug_event { |
|
855
|
|
|
|
|
|
|
# uncoverable subroutine |
|
856
|
0
|
|
|
0
|
0
|
0
|
my ($self, $event) = @_; # uncoverable statement |
|
857
|
0
|
|
|
|
|
0
|
my $str = YAML::PP::Common::event_to_test_suite($event); # uncoverable statement |
|
858
|
0
|
|
|
|
|
0
|
require Term::ANSIColor; # uncoverable statement |
|
859
|
0
|
|
|
|
|
0
|
warn Term::ANSIColor::colored(["magenta"], "============ $str"), "\n"; # uncoverable statement |
|
860
|
|
|
|
|
|
|
} |
|
861
|
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
sub debug_rules { |
|
863
|
|
|
|
|
|
|
# uncoverable subroutine |
|
864
|
0
|
|
|
0
|
0
|
0
|
my ($self, $rules) = @_; # uncoverable statement |
|
865
|
0
|
|
|
|
|
0
|
local $Data::Dumper::Maxdepth = 2; # uncoverable statement |
|
866
|
0
|
|
|
|
|
0
|
$self->note("RULES:"); # uncoverable statement |
|
867
|
0
|
|
|
|
|
0
|
for my $rule ($rules) { # uncoverable statement |
|
868
|
0
|
0
|
|
|
|
0
|
if (ref $rule eq 'ARRAY') { # uncoverable statement |
|
869
|
0
|
|
|
|
|
0
|
my $first = $rule->[0]; # uncoverable statement |
|
870
|
0
|
0
|
|
|
|
0
|
if (ref $first eq 'SCALAR') { # uncoverable statement |
|
871
|
0
|
|
|
|
|
0
|
$self->info("-> $$first"); # uncoverable statement |
|
872
|
|
|
|
|
|
|
} |
|
873
|
|
|
|
|
|
|
else { # uncoverable statement |
|
874
|
0
|
0
|
|
|
|
0
|
if (ref $first eq 'ARRAY') { # uncoverable statement |
|
875
|
0
|
|
|
|
|
0
|
$first = $first->[0]; # uncoverable statement |
|
876
|
|
|
|
|
|
|
} |
|
877
|
0
|
|
|
|
|
0
|
$self->info("TYPE $first"); # uncoverable statement |
|
878
|
|
|
|
|
|
|
} |
|
879
|
|
|
|
|
|
|
} |
|
880
|
|
|
|
|
|
|
else { # uncoverable statement |
|
881
|
0
|
|
|
|
|
0
|
eval { # uncoverable statement |
|
882
|
0
|
|
|
|
|
0
|
my @keys = sort keys %$rule; # uncoverable statement |
|
883
|
0
|
|
|
|
|
0
|
$self->info("@keys"); # uncoverable statement |
|
884
|
|
|
|
|
|
|
}; |
|
885
|
|
|
|
|
|
|
} |
|
886
|
|
|
|
|
|
|
} |
|
887
|
|
|
|
|
|
|
} |
|
888
|
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
sub debug_tokens { |
|
890
|
|
|
|
|
|
|
# uncoverable subroutine |
|
891
|
0
|
|
|
0
|
0
|
0
|
my ($self, $tokens) = @_; # uncoverable statement |
|
892
|
0
|
|
0
|
|
|
0
|
$tokens ||= $self->tokens; # uncoverable statement |
|
893
|
0
|
|
|
|
|
0
|
require Term::ANSIColor; # uncoverable statement |
|
894
|
0
|
|
|
|
|
0
|
for my $token (@$tokens) { # uncoverable statement |
|
895
|
|
|
|
|
|
|
my $type = Term::ANSIColor::colored(["green"], # uncoverable statement |
|
896
|
|
|
|
|
|
|
sprintf "%-22s L %2d C %2d ", # uncoverable statement |
|
897
|
0
|
|
|
|
|
0
|
$token->{name}, $token->{line}, $token->{column} + 1 # uncoverable statement |
|
898
|
|
|
|
|
|
|
); |
|
899
|
0
|
|
|
|
|
0
|
local $Data::Dumper::Useqq = 1; # uncoverable statement |
|
900
|
0
|
|
|
|
|
0
|
local $Data::Dumper::Terse = 1; # uncoverable statement |
|
901
|
0
|
|
|
|
|
0
|
require Data::Dumper; # uncoverable statement |
|
902
|
0
|
|
|
|
|
0
|
my $str = Data::Dumper->Dump([$token->{value}], ['str']); # uncoverable statement |
|
903
|
0
|
|
|
|
|
0
|
chomp $str; # uncoverable statement |
|
904
|
0
|
|
|
|
|
0
|
$str =~ s/(^.|.$)/Term::ANSIColor::colored(['blue'], $1)/ge; # uncoverable statement |
|
|
0
|
|
|
|
|
0
|
|
|
905
|
0
|
|
|
|
|
0
|
warn "$type$str\n"; # uncoverable statement |
|
906
|
|
|
|
|
|
|
} |
|
907
|
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
} |
|
909
|
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
sub highlight_yaml { |
|
911
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
|
912
|
0
|
|
|
|
|
0
|
require YAML::PP::Highlight; |
|
913
|
0
|
|
|
|
|
0
|
my $tokens = $self->tokens; |
|
914
|
0
|
|
|
|
|
0
|
my $highlighted = YAML::PP::Highlight->ansicolored($tokens); |
|
915
|
0
|
|
|
|
|
0
|
warn $highlighted; |
|
916
|
|
|
|
|
|
|
} |
|
917
|
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
sub exception { |
|
919
|
2
|
|
|
2
|
0
|
8
|
my ($self, $msg, %args) = @_; |
|
920
|
2
|
|
|
|
|
7
|
my $next = $self->lexer->next_tokens; |
|
921
|
2
|
50
|
|
|
|
8
|
my $line = @$next ? $next->[0]->{line} : $self->lexer->line; |
|
922
|
2
|
50
|
|
|
|
8
|
my $offset = @$next ? $next->[0]->{column} : $self->lexer->offset; |
|
923
|
2
|
|
|
|
|
6
|
$offset++; |
|
924
|
2
|
|
|
|
|
4
|
my $next_line = $self->lexer->next_line; |
|
925
|
2
|
|
|
|
|
4
|
my $remaining = ''; |
|
926
|
2
|
50
|
|
|
|
6
|
if ($next_line) { |
|
927
|
2
|
50
|
|
|
|
15
|
if ($self->lexer->offset > 0) { |
|
928
|
2
|
|
|
|
|
7
|
$remaining = $next_line->[1] . $next_line->[2]; |
|
929
|
|
|
|
|
|
|
} |
|
930
|
|
|
|
|
|
|
else { |
|
931
|
0
|
|
|
|
|
0
|
$remaining = join '', @$next_line; |
|
932
|
|
|
|
|
|
|
} |
|
933
|
|
|
|
|
|
|
} |
|
934
|
2
|
|
50
|
|
|
7
|
my $caller = $args{caller} || [ caller(0) ]; |
|
935
|
|
|
|
|
|
|
my $e = YAML::PP::Exception->new( |
|
936
|
|
|
|
|
|
|
got => $args{got}, |
|
937
|
|
|
|
|
|
|
expected => $args{expected}, |
|
938
|
2
|
|
|
|
|
13
|
line => $line, |
|
939
|
|
|
|
|
|
|
column => $offset, |
|
940
|
|
|
|
|
|
|
msg => $msg, |
|
941
|
|
|
|
|
|
|
next => $next, |
|
942
|
|
|
|
|
|
|
where => $caller->[1] . ' line ' . $caller->[2], |
|
943
|
|
|
|
|
|
|
yaml => $remaining, |
|
944
|
|
|
|
|
|
|
); |
|
945
|
2
|
|
|
|
|
50
|
croak $e; |
|
946
|
|
|
|
|
|
|
} |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
sub expected { |
|
949
|
2
|
|
|
2
|
0
|
8
|
my ($self, %args) = @_; |
|
950
|
2
|
|
|
|
|
5
|
my $expected = $args{expected}; |
|
951
|
2
|
|
|
|
|
5
|
@$expected = sort grep { m/^[A-Z_]+$/ } @$expected; |
|
|
9
|
|
|
|
|
33
|
|
|
952
|
2
|
|
|
|
|
5
|
my $got = $args{got}->{name}; |
|
953
|
2
|
|
|
|
|
55
|
my @caller = caller(0); |
|
954
|
|
|
|
|
|
|
$self->exception("Expected (@$expected), but got $got", |
|
955
|
|
|
|
|
|
|
caller => \@caller, |
|
956
|
|
|
|
|
|
|
expected => $expected, |
|
957
|
|
|
|
|
|
|
got => $args{got}, |
|
958
|
2
|
|
|
|
|
16
|
); |
|
959
|
|
|
|
|
|
|
} |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
sub cb_tag { |
|
962
|
1137
|
|
|
1137
|
0
|
1974
|
my ($self, $token) = @_; |
|
963
|
1137
|
|
|
|
|
1982
|
my $stack = $self->event_stack; |
|
964
|
1137
|
100
|
66
|
|
|
3423
|
if (! @$stack or $stack->[-1]->[0] ne 'properties') { |
|
965
|
839
|
|
|
|
|
2017
|
push @$stack, [ properties => {} ]; |
|
966
|
|
|
|
|
|
|
} |
|
967
|
1137
|
|
|
|
|
1859
|
my $last = $stack->[-1]->[1]; |
|
968
|
1137
|
|
|
|
|
2270
|
my $tag = $self->_read_tag($token->{value}, $self->tagmap); |
|
969
|
1136
|
|
100
|
|
|
5019
|
$last->{inline} ||= []; |
|
970
|
1136
|
|
|
|
|
4437
|
push @{ $last->{inline} }, { |
|
971
|
|
|
|
|
|
|
type => 'tag', |
|
972
|
|
|
|
|
|
|
value => $tag, |
|
973
|
|
|
|
|
|
|
offset => $token->{column}, |
|
974
|
1136
|
|
|
|
|
1604
|
}; |
|
975
|
|
|
|
|
|
|
} |
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
sub _read_tag { |
|
978
|
1137
|
|
|
1137
|
|
2300
|
my ($self, $tag, $map) = @_; |
|
979
|
1137
|
50
|
|
|
|
7798
|
if ($tag eq '!') { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
980
|
0
|
|
|
|
|
0
|
return "!"; |
|
981
|
|
|
|
|
|
|
} |
|
982
|
|
|
|
|
|
|
elsif ($tag =~ m/^!<(.*)>/) { |
|
983
|
1
|
|
|
|
|
5
|
return $1; |
|
984
|
|
|
|
|
|
|
} |
|
985
|
|
|
|
|
|
|
elsif ($tag =~ m/^(![^!]*!|!)(.+)/) { |
|
986
|
1136
|
|
|
|
|
2870
|
my $alias = $1; |
|
987
|
1136
|
|
|
|
|
1974
|
my $name = $2; |
|
988
|
1136
|
|
|
|
|
2457
|
$name =~ s/%([0-9a-fA-F]{2})/chr hex $1/eg; |
|
|
4
|
|
|
|
|
33
|
|
|
989
|
1136
|
100
|
|
|
|
2780
|
if (exists $map->{ $alias }) { |
|
990
|
1041
|
|
|
|
|
2942
|
$tag = $map->{ $alias }. $name; |
|
991
|
|
|
|
|
|
|
} |
|
992
|
|
|
|
|
|
|
else { |
|
993
|
95
|
100
|
66
|
|
|
288
|
if ($alias ne '!' and $alias ne '!!') { |
|
994
|
1
|
|
|
|
|
13
|
die "Found undefined tag handle '$alias'"; |
|
995
|
|
|
|
|
|
|
} |
|
996
|
94
|
|
|
|
|
207
|
$tag = "!$name"; |
|
997
|
|
|
|
|
|
|
} |
|
998
|
|
|
|
|
|
|
} |
|
999
|
|
|
|
|
|
|
else { |
|
1000
|
0
|
|
|
|
|
0
|
die "Invalid tag"; |
|
1001
|
|
|
|
|
|
|
} |
|
1002
|
1135
|
|
|
|
|
2457
|
return $tag; |
|
1003
|
|
|
|
|
|
|
} |
|
1004
|
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
sub cb_anchor { |
|
1006
|
660
|
|
|
660
|
0
|
1134
|
my ($self, $token) = @_; |
|
1007
|
660
|
|
|
|
|
1067
|
my $anchor = $token->{value}; |
|
1008
|
660
|
|
|
|
|
1815
|
$anchor = substr($anchor, 1); |
|
1009
|
660
|
|
|
|
|
1251
|
my $stack = $self->event_stack; |
|
1010
|
660
|
100
|
66
|
|
|
1938
|
if (! @$stack or $stack->[-1]->[0] ne 'properties') { |
|
1011
|
584
|
|
|
|
|
1465
|
push @$stack, [ properties => {} ]; |
|
1012
|
|
|
|
|
|
|
} |
|
1013
|
660
|
|
|
|
|
1043
|
my $last = $stack->[-1]->[1]; |
|
1014
|
660
|
|
100
|
|
|
3030
|
$last->{inline} ||= []; |
|
1015
|
660
|
|
|
|
|
2728
|
push @{ $last->{inline} }, { |
|
1016
|
|
|
|
|
|
|
type => 'anchor', |
|
1017
|
|
|
|
|
|
|
value => $anchor, |
|
1018
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1019
|
660
|
|
|
|
|
884
|
}; |
|
1020
|
|
|
|
|
|
|
} |
|
1021
|
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
sub cb_property_eol { |
|
1023
|
246
|
|
|
246
|
0
|
470
|
my ($self, $res) = @_; |
|
1024
|
246
|
|
|
|
|
459
|
my $stack = $self->event_stack; |
|
1025
|
246
|
|
|
|
|
391
|
my $last = $stack->[-1]->[1]; |
|
1026
|
246
|
50
|
|
|
|
1391
|
my $inline = delete $last->{inline} or return; |
|
1027
|
246
|
|
50
|
|
|
938
|
my $newline = $last->{newline} ||= []; |
|
1028
|
246
|
|
|
|
|
656
|
push @$newline, @$inline; |
|
1029
|
|
|
|
|
|
|
} |
|
1030
|
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
sub cb_mapkey { |
|
1032
|
454
|
|
|
454
|
0
|
1116
|
my ($self, $token) = @_; |
|
1033
|
454
|
|
|
|
|
895
|
my $stack = $self->event_stack; |
|
1034
|
|
|
|
|
|
|
my $info = { |
|
1035
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1036
|
|
|
|
|
|
|
value => $token->{value}, |
|
1037
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1038
|
454
|
|
|
|
|
1562
|
}; |
|
1039
|
454
|
50
|
33
|
|
|
1260
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1040
|
0
|
|
|
|
|
0
|
$self->fetch_inline_properties($stack, $info); |
|
1041
|
|
|
|
|
|
|
} |
|
1042
|
454
|
|
|
|
|
623
|
push @{ $stack }, [ scalar => $info ]; |
|
|
454
|
|
|
|
|
1070
|
|
|
1043
|
|
|
|
|
|
|
} |
|
1044
|
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
sub cb_send_mapkey { |
|
1046
|
756
|
|
|
756
|
0
|
1409
|
my ($self, $res) = @_; |
|
1047
|
756
|
|
|
|
|
973
|
my $last = pop @{ $self->event_stack }; |
|
|
756
|
|
|
|
|
1182
|
|
|
1048
|
756
|
|
|
|
|
2044
|
$self->scalar_event($last->[1]); |
|
1049
|
756
|
|
|
|
|
1393
|
$self->set_new_node(1); |
|
1050
|
|
|
|
|
|
|
} |
|
1051
|
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
sub cb_send_scalar { |
|
1053
|
4542
|
|
|
4542
|
0
|
7788
|
my ($self, $res) = @_; |
|
1054
|
4542
|
|
|
|
|
5870
|
my $last = pop @{ $self->event_stack }; |
|
|
4542
|
|
|
|
|
7281
|
|
|
1055
|
4542
|
100
|
|
|
|
9410
|
return unless $last; |
|
1056
|
4132
|
|
|
|
|
10542
|
$self->scalar_event($last->[1]); |
|
1057
|
4123
|
|
|
|
|
7491
|
my $e = $self->events; |
|
1058
|
4123
|
50
|
|
|
|
13939
|
if ($e->[-1] eq 'IMAP') { |
|
1059
|
0
|
|
|
|
|
0
|
$self->end_flow_mapping; |
|
1060
|
|
|
|
|
|
|
} |
|
1061
|
|
|
|
|
|
|
} |
|
1062
|
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
sub cb_empty_mapkey { |
|
1064
|
19
|
|
|
19
|
0
|
49
|
my ($self, $token) = @_; |
|
1065
|
19
|
|
|
|
|
38
|
my $stack = $self->event_stack; |
|
1066
|
|
|
|
|
|
|
my $info = { |
|
1067
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1068
|
|
|
|
|
|
|
value => '', |
|
1069
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1070
|
19
|
|
|
|
|
86
|
}; |
|
1071
|
19
|
50
|
33
|
|
|
72
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1072
|
0
|
|
|
|
|
0
|
$self->fetch_inline_properties($stack, $info); |
|
1073
|
|
|
|
|
|
|
} |
|
1074
|
19
|
|
|
|
|
61
|
$self->scalar_event($info); |
|
1075
|
19
|
|
|
|
|
46
|
$self->set_new_node(1); |
|
1076
|
|
|
|
|
|
|
} |
|
1077
|
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
sub cb_send_flow_alias { |
|
1079
|
8
|
|
|
8
|
0
|
17
|
my ($self, $token) = @_; |
|
1080
|
8
|
|
|
|
|
18
|
my $alias = substr($token->{value}, 1); |
|
1081
|
8
|
|
|
|
|
24
|
$self->alias_event({ value => $alias }); |
|
1082
|
|
|
|
|
|
|
} |
|
1083
|
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
sub cb_send_alias { |
|
1085
|
32
|
|
|
32
|
0
|
66
|
my ($self, $token) = @_; |
|
1086
|
32
|
|
|
|
|
82
|
my $alias = substr($token->{value}, 1); |
|
1087
|
32
|
|
|
|
|
112
|
$self->alias_event({ value => $alias }); |
|
1088
|
|
|
|
|
|
|
} |
|
1089
|
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
sub cb_send_alias_key { |
|
1091
|
40
|
|
|
40
|
0
|
81
|
my ($self, $token) = @_; |
|
1092
|
40
|
|
|
|
|
112
|
my $alias = substr($token->{value}, 1); |
|
1093
|
40
|
|
|
|
|
162
|
$self->alias_event({ value => $alias }); |
|
1094
|
40
|
|
|
|
|
90
|
$self->set_new_node(1); |
|
1095
|
|
|
|
|
|
|
} |
|
1096
|
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
sub cb_send_alias_from_stack { |
|
1098
|
57
|
|
|
57
|
0
|
100
|
my ($self, $token) = @_; |
|
1099
|
57
|
|
|
|
|
68
|
my $last = pop @{ $self->event_stack }; |
|
|
57
|
|
|
|
|
93
|
|
|
1100
|
57
|
|
|
|
|
127
|
$self->alias_event($last->[1]); |
|
1101
|
|
|
|
|
|
|
} |
|
1102
|
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
sub cb_alias { |
|
1104
|
58
|
|
|
58
|
0
|
103
|
my ($self, $token) = @_; |
|
1105
|
58
|
|
|
|
|
132
|
my $alias = substr($token->{value}, 1); |
|
1106
|
58
|
|
|
|
|
112
|
push @{ $self->event_stack }, [ alias => { |
|
1107
|
|
|
|
|
|
|
value => $alias, |
|
1108
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1109
|
58
|
|
|
|
|
83
|
}]; |
|
1110
|
|
|
|
|
|
|
} |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
sub cb_question { |
|
1113
|
32
|
|
|
32
|
0
|
80
|
my ($self, $res) = @_; |
|
1114
|
32
|
|
|
|
|
92
|
$self->set_new_node(1); |
|
1115
|
|
|
|
|
|
|
} |
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
sub cb_flow_question { |
|
1118
|
73
|
|
|
73
|
0
|
155
|
my ($self, $res) = @_; |
|
1119
|
73
|
|
|
|
|
156
|
$self->set_new_node(2); |
|
1120
|
|
|
|
|
|
|
} |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
sub cb_empty_complexvalue { |
|
1123
|
0
|
|
|
0
|
0
|
0
|
my ($self, $res) = @_; |
|
1124
|
0
|
|
|
|
|
0
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
1125
|
|
|
|
|
|
|
} |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
sub cb_questionstart { |
|
1128
|
57
|
|
|
57
|
0
|
120
|
my ($self, $token) = @_; |
|
1129
|
57
|
|
|
|
|
138
|
$self->start_mapping($token->{column}); |
|
1130
|
|
|
|
|
|
|
} |
|
1131
|
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
sub cb_complexcolon { |
|
1133
|
80
|
|
|
80
|
0
|
170
|
my ($self, $res) = @_; |
|
1134
|
80
|
|
|
|
|
166
|
$self->set_new_node(1); |
|
1135
|
|
|
|
|
|
|
} |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
sub cb_seqstart { |
|
1138
|
713
|
|
|
713
|
0
|
1319
|
my ($self, $token) = @_; |
|
1139
|
713
|
|
|
|
|
1149
|
my $column = $token->{column}; |
|
1140
|
713
|
|
|
|
|
1825
|
$self->start_sequence($column); |
|
1141
|
713
|
|
|
|
|
2024
|
$self->set_new_node(1); |
|
1142
|
|
|
|
|
|
|
} |
|
1143
|
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
sub cb_seqitem { |
|
1145
|
1474
|
|
|
1474
|
0
|
2549
|
my ($self, $res) = @_; |
|
1146
|
1474
|
|
|
|
|
2682
|
$self->set_new_node(1); |
|
1147
|
|
|
|
|
|
|
} |
|
1148
|
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
sub cb_take_quoted { |
|
1150
|
2286
|
|
|
2286
|
0
|
4213
|
my ($self, $token) = @_; |
|
1151
|
2286
|
|
|
|
|
3377
|
my $subtokens = $token->{subtokens}; |
|
1152
|
2286
|
|
|
|
|
4273
|
my $stack = $self->event_stack; |
|
1153
|
|
|
|
|
|
|
my $info = { |
|
1154
|
|
|
|
|
|
|
style => $subtokens->[0]->{value} eq '"' |
|
1155
|
|
|
|
|
|
|
? YAML_DOUBLE_QUOTED_SCALAR_STYLE |
|
1156
|
|
|
|
|
|
|
: YAML_SINGLE_QUOTED_SCALAR_STYLE, |
|
1157
|
|
|
|
|
|
|
value => $token->{value}, |
|
1158
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1159
|
2286
|
100
|
|
|
|
9576
|
}; |
|
1160
|
2286
|
100
|
66
|
|
|
5558
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1161
|
22
|
|
|
|
|
53
|
$self->fetch_inline_properties($stack, $info); |
|
1162
|
|
|
|
|
|
|
} |
|
1163
|
2286
|
|
|
|
|
2968
|
push @{ $stack }, [ scalar => $info ]; |
|
|
2286
|
|
|
|
|
5674
|
|
|
1164
|
|
|
|
|
|
|
} |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
sub cb_quoted_multiline { |
|
1167
|
112
|
|
|
112
|
0
|
246
|
my ($self, $token) = @_; |
|
1168
|
112
|
|
|
|
|
229
|
my $subtokens = $token->{subtokens}; |
|
1169
|
112
|
|
|
|
|
250
|
my $stack = $self->event_stack; |
|
1170
|
|
|
|
|
|
|
my $info = { |
|
1171
|
|
|
|
|
|
|
style => $subtokens->[0]->{value} eq '"' |
|
1172
|
|
|
|
|
|
|
? YAML_DOUBLE_QUOTED_SCALAR_STYLE |
|
1173
|
|
|
|
|
|
|
: YAML_SINGLE_QUOTED_SCALAR_STYLE, |
|
1174
|
|
|
|
|
|
|
value => $token->{value}, |
|
1175
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1176
|
112
|
50
|
|
|
|
511
|
}; |
|
1177
|
112
|
100
|
66
|
|
|
344
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1178
|
2
|
|
|
|
|
5
|
$self->fetch_inline_properties($stack, $info); |
|
1179
|
|
|
|
|
|
|
} |
|
1180
|
112
|
|
|
|
|
172
|
push @{ $stack }, [ scalar => $info ]; |
|
|
112
|
|
|
|
|
247
|
|
|
1181
|
112
|
|
|
|
|
261
|
$self->cb_send_scalar; |
|
1182
|
|
|
|
|
|
|
} |
|
1183
|
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
sub cb_take_quoted_key { |
|
1185
|
302
|
|
|
302
|
0
|
581
|
my ($self, $token) = @_; |
|
1186
|
302
|
|
|
|
|
721
|
$self->cb_take_quoted($token); |
|
1187
|
302
|
|
|
|
|
691
|
$self->cb_send_mapkey; |
|
1188
|
|
|
|
|
|
|
} |
|
1189
|
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
sub cb_send_plain_multi { |
|
1191
|
0
|
|
|
0
|
0
|
0
|
my ($self, $token) = @_; |
|
1192
|
0
|
|
|
|
|
0
|
my $stack = $self->event_stack; |
|
1193
|
|
|
|
|
|
|
my $info = { |
|
1194
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1195
|
|
|
|
|
|
|
value => $token->{value}, |
|
1196
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1197
|
0
|
|
|
|
|
0
|
}; |
|
1198
|
0
|
0
|
0
|
|
|
0
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1199
|
0
|
|
|
|
|
0
|
$self->fetch_inline_properties($stack, $info); |
|
1200
|
|
|
|
|
|
|
} |
|
1201
|
0
|
|
|
|
|
0
|
push @{ $stack }, [ scalar => $info ]; |
|
|
0
|
|
|
|
|
0
|
|
|
1202
|
0
|
|
|
|
|
0
|
$self->cb_send_scalar; |
|
1203
|
|
|
|
|
|
|
} |
|
1204
|
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
sub cb_start_plain { |
|
1206
|
2558
|
|
|
2558
|
0
|
4478
|
my ($self, $token) = @_; |
|
1207
|
2558
|
|
|
|
|
4860
|
my $stack = $self->event_stack; |
|
1208
|
|
|
|
|
|
|
my $info = { |
|
1209
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1210
|
|
|
|
|
|
|
value => $token->{value}, |
|
1211
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1212
|
2558
|
|
|
|
|
9130
|
}; |
|
1213
|
2558
|
100
|
66
|
|
|
7499
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1214
|
601
|
|
|
|
|
1424
|
$self->fetch_inline_properties($stack, $info); |
|
1215
|
|
|
|
|
|
|
} |
|
1216
|
2558
|
|
|
|
|
3996
|
push @{ $stack }, [ scalar => $info ]; |
|
|
2558
|
|
|
|
|
6220
|
|
|
1217
|
|
|
|
|
|
|
} |
|
1218
|
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
sub cb_start_flowseq { |
|
1220
|
809
|
|
|
809
|
0
|
1563
|
my ($self, $token) = @_; |
|
1221
|
809
|
|
|
|
|
1786
|
$self->start_flow_sequence($token->{column}); |
|
1222
|
|
|
|
|
|
|
} |
|
1223
|
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
sub cb_start_flowmap { |
|
1225
|
349
|
|
|
349
|
0
|
636
|
my ($self, $token) = @_; |
|
1226
|
349
|
|
|
|
|
831
|
$self->start_flow_mapping($token->{column}); |
|
1227
|
|
|
|
|
|
|
} |
|
1228
|
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
sub cb_end_flowseq { |
|
1230
|
809
|
|
|
809
|
0
|
1477
|
my ($self, $res) = @_; |
|
1231
|
809
|
|
|
|
|
1956
|
$self->cb_send_scalar; |
|
1232
|
809
|
|
|
|
|
2130
|
$self->end_flow_sequence; |
|
1233
|
809
|
|
|
|
|
1570
|
$self->set_new_node(0); |
|
1234
|
|
|
|
|
|
|
} |
|
1235
|
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
sub cb_flow_comma { |
|
1237
|
1381
|
|
|
1381
|
0
|
2455
|
my ($self) = @_; |
|
1238
|
1381
|
|
|
|
|
2504
|
my $event_types = $self->events; |
|
1239
|
1381
|
|
|
|
|
3091
|
$self->set_new_node(0); |
|
1240
|
1381
|
100
|
|
|
|
5225
|
if ($event_types->[-1] =~ m/^FLOWSEQ/) { |
|
1241
|
1113
|
|
|
|
|
2860
|
$self->cb_send_scalar; |
|
1242
|
1113
|
|
|
|
|
2354
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
1243
|
|
|
|
|
|
|
} |
|
1244
|
|
|
|
|
|
|
} |
|
1245
|
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
sub cb_flow_colon { |
|
1247
|
78
|
|
|
78
|
0
|
170
|
my ($self) = @_; |
|
1248
|
78
|
|
|
|
|
154
|
$self->set_new_node(1); |
|
1249
|
|
|
|
|
|
|
} |
|
1250
|
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
sub cb_empty_flow_mapkey { |
|
1252
|
314
|
|
|
314
|
0
|
498
|
my ($self, $token) = @_; |
|
1253
|
314
|
|
|
|
|
549
|
my $stack = $self->event_stack; |
|
1254
|
|
|
|
|
|
|
my $info = { |
|
1255
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1256
|
|
|
|
|
|
|
value => '', |
|
1257
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1258
|
314
|
|
|
|
|
1032
|
}; |
|
1259
|
314
|
100
|
66
|
|
|
1124
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1260
|
216
|
|
|
|
|
478
|
$self->fetch_inline_properties($stack, $info); |
|
1261
|
|
|
|
|
|
|
} |
|
1262
|
314
|
|
|
|
|
800
|
$self->scalar_event($info); |
|
1263
|
|
|
|
|
|
|
} |
|
1264
|
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
sub cb_end_flowmap { |
|
1266
|
279
|
|
|
279
|
0
|
515
|
my ($self, $res) = @_; |
|
1267
|
279
|
|
|
|
|
674
|
$self->end_flow_mapping; |
|
1268
|
271
|
|
|
|
|
530
|
$self->set_new_node(0); |
|
1269
|
|
|
|
|
|
|
} |
|
1270
|
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
sub cb_end_flowmap_empty { |
|
1272
|
69
|
|
|
69
|
0
|
154
|
my ($self, $res) = @_; |
|
1273
|
69
|
|
|
|
|
176
|
$self->cb_empty_flowmap_value; |
|
1274
|
69
|
|
|
|
|
229
|
$self->end_flow_mapping; |
|
1275
|
69
|
|
|
|
|
1042
|
$self->set_new_node(0); |
|
1276
|
|
|
|
|
|
|
} |
|
1277
|
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
sub cb_flowkey_plain { |
|
1279
|
94
|
|
|
94
|
0
|
226
|
my ($self, $token) = @_; |
|
1280
|
94
|
|
|
|
|
199
|
my $stack = $self->event_stack; |
|
1281
|
|
|
|
|
|
|
my $info = { |
|
1282
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1283
|
|
|
|
|
|
|
value => $token->{value}, |
|
1284
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1285
|
94
|
|
|
|
|
348
|
}; |
|
1286
|
94
|
50
|
33
|
|
|
277
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1287
|
0
|
|
|
|
|
0
|
$self->fetch_inline_properties($stack, $info); |
|
1288
|
|
|
|
|
|
|
} |
|
1289
|
94
|
|
|
|
|
240
|
$self->scalar_event($info); |
|
1290
|
|
|
|
|
|
|
} |
|
1291
|
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
sub cb_flowkey_quoted { |
|
1293
|
1
|
|
|
1
|
0
|
16
|
my ($self, $token) = @_; |
|
1294
|
1
|
|
|
|
|
6
|
my $stack = $self->event_stack; |
|
1295
|
1
|
|
|
|
|
3
|
my $subtokens = $token->{subtokens}; |
|
1296
|
|
|
|
|
|
|
my $info = { |
|
1297
|
|
|
|
|
|
|
style => $subtokens->[0]->{value} eq '"' |
|
1298
|
|
|
|
|
|
|
? YAML_DOUBLE_QUOTED_SCALAR_STYLE |
|
1299
|
|
|
|
|
|
|
: YAML_SINGLE_QUOTED_SCALAR_STYLE, |
|
1300
|
|
|
|
|
|
|
value => $token->{value}, |
|
1301
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1302
|
1
|
50
|
|
|
|
10
|
}; |
|
1303
|
1
|
50
|
33
|
|
|
5
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1304
|
0
|
|
|
|
|
0
|
$self->fetch_inline_properties($stack, $info); |
|
1305
|
|
|
|
|
|
|
} |
|
1306
|
1
|
|
|
|
|
4
|
$self->scalar_event($info); |
|
1307
|
|
|
|
|
|
|
} |
|
1308
|
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
sub cb_empty_flowmap_key_value { |
|
1310
|
136
|
|
|
136
|
0
|
271
|
my ($self, $token) = @_; |
|
1311
|
136
|
|
|
|
|
362
|
$self->cb_empty_flow_mapkey($token); |
|
1312
|
136
|
|
|
|
|
396
|
$self->cb_empty_flowmap_value; |
|
1313
|
136
|
|
|
|
|
1201
|
$self->cb_flow_comma; |
|
1314
|
|
|
|
|
|
|
} |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
sub cb_end_empty_flowmap_key_value { |
|
1317
|
116
|
|
|
116
|
0
|
234
|
my ($self, $token) = @_; |
|
1318
|
116
|
|
|
|
|
311
|
$self->cb_empty_flow_mapkey($token); |
|
1319
|
116
|
|
|
|
|
340
|
$self->cb_empty_flowmap_value; |
|
1320
|
116
|
|
|
|
|
304
|
$self->cb_flow_comma; |
|
1321
|
116
|
|
|
|
|
241
|
$self->cb_end_flowmap; |
|
1322
|
|
|
|
|
|
|
} |
|
1323
|
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
sub cb_empty_flowmap_value { |
|
1325
|
483
|
|
|
483
|
0
|
810
|
my ($self, $token) = @_; |
|
1326
|
483
|
|
|
|
|
830
|
my $stack = $self->event_stack; |
|
1327
|
|
|
|
|
|
|
my $info = { |
|
1328
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1329
|
|
|
|
|
|
|
value => '', |
|
1330
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1331
|
483
|
|
|
|
|
1548
|
}; |
|
1332
|
483
|
100
|
66
|
|
|
1457
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1333
|
162
|
|
|
|
|
371
|
$self->fetch_inline_properties($stack, $info); |
|
1334
|
|
|
|
|
|
|
} |
|
1335
|
483
|
|
|
|
|
998
|
$self->scalar_event($info); |
|
1336
|
|
|
|
|
|
|
} |
|
1337
|
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
sub cb_empty_flowseq_comma { |
|
1339
|
90
|
|
|
90
|
0
|
187
|
my ($self, $token) = @_; |
|
1340
|
90
|
|
|
|
|
252
|
$self->cb_empty_flowmap_value($token); |
|
1341
|
90
|
|
|
|
|
252
|
$self->cb_flow_comma; |
|
1342
|
|
|
|
|
|
|
} |
|
1343
|
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
sub cb_empty_flowseq_end { |
|
1345
|
72
|
|
|
72
|
0
|
156
|
my ($self, $token) = @_; |
|
1346
|
72
|
|
|
|
|
171
|
$self->cb_empty_flowmap_value($token); |
|
1347
|
72
|
|
|
|
|
168
|
$self->cb_end_flowseq; |
|
1348
|
|
|
|
|
|
|
} |
|
1349
|
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
sub cb_insert_map_alias { |
|
1351
|
1
|
|
|
1
|
0
|
4
|
my ($self, $res) = @_; |
|
1352
|
1
|
|
|
|
|
2
|
my $stack = $self->event_stack; |
|
1353
|
1
|
|
|
|
|
2
|
my $scalar = pop @$stack; |
|
1354
|
1
|
|
|
|
|
3
|
my $info = $scalar->[1]; |
|
1355
|
1
|
|
|
|
|
7
|
$self->start_mapping($info->{offset}); |
|
1356
|
1
|
|
|
|
|
7
|
$self->alias_event($info); |
|
1357
|
1
|
|
|
|
|
2
|
$self->set_new_node(1); |
|
1358
|
|
|
|
|
|
|
} |
|
1359
|
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
sub cb_insert_map { |
|
1361
|
714
|
|
|
714
|
0
|
1397
|
my ($self, $res) = @_; |
|
1362
|
714
|
|
|
|
|
1277
|
my $stack = $self->event_stack; |
|
1363
|
714
|
|
|
|
|
1167
|
my $scalar = pop @$stack; |
|
1364
|
714
|
|
|
|
|
1119
|
my $info = $scalar->[1]; |
|
1365
|
714
|
|
|
|
|
1998
|
$self->start_mapping($info->{offset}); |
|
1366
|
714
|
|
|
|
|
2293
|
$self->scalar_event($info); |
|
1367
|
714
|
|
|
|
|
1338
|
$self->set_new_node(1); |
|
1368
|
|
|
|
|
|
|
} |
|
1369
|
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
sub cb_insert_implicit_flowseq_map { |
|
1371
|
0
|
|
|
0
|
0
|
0
|
my ($self, $res) = @_; |
|
1372
|
0
|
|
|
|
|
0
|
my $stack = $self->event_stack; |
|
1373
|
0
|
|
|
|
|
0
|
my $scalar = pop @$stack; |
|
1374
|
0
|
|
|
|
|
0
|
my $info = $scalar->[1]; |
|
1375
|
0
|
|
|
|
|
0
|
$self->start_flow_mapping($info->{offset}, 1); |
|
1376
|
0
|
|
|
|
|
0
|
$self->scalar_event($info); |
|
1377
|
0
|
|
|
|
|
0
|
$self->set_new_node(1); |
|
1378
|
|
|
|
|
|
|
} |
|
1379
|
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
sub cb_insert_empty_implicit_flowseq_map { |
|
1381
|
0
|
|
|
0
|
0
|
0
|
my ($self, $res) = @_; |
|
1382
|
0
|
|
|
|
|
0
|
my $stack = $self->event_stack; |
|
1383
|
0
|
|
|
|
|
0
|
my $scalar = pop @$stack; |
|
1384
|
0
|
|
|
|
|
0
|
my $info = $scalar->[1]; |
|
1385
|
0
|
|
|
|
|
0
|
$self->start_flow_mapping($info->{offset}, 1); |
|
1386
|
0
|
|
|
|
|
0
|
$self->cb_empty_flowmap_value; |
|
1387
|
0
|
|
|
|
|
0
|
$self->set_new_node(2); |
|
1388
|
|
|
|
|
|
|
} |
|
1389
|
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
sub cb_insert_empty_map { |
|
1391
|
234
|
|
|
234
|
0
|
388
|
my ($self, $token) = @_; |
|
1392
|
234
|
|
|
|
|
430
|
my $stack = $self->event_stack; |
|
1393
|
|
|
|
|
|
|
my $info = { |
|
1394
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1395
|
|
|
|
|
|
|
value => '', |
|
1396
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1397
|
234
|
|
|
|
|
731
|
}; |
|
1398
|
234
|
100
|
66
|
|
|
798
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1399
|
162
|
|
|
|
|
344
|
$self->fetch_inline_properties($stack, $info); |
|
1400
|
|
|
|
|
|
|
} |
|
1401
|
234
|
|
|
|
|
760
|
$self->start_mapping($info->{offset}); |
|
1402
|
234
|
|
|
|
|
718
|
$self->scalar_event($info); |
|
1403
|
234
|
|
|
|
|
485
|
$self->set_new_node(1); |
|
1404
|
|
|
|
|
|
|
} |
|
1405
|
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
sub cb_send_block_scalar { |
|
1407
|
192
|
|
|
192
|
0
|
397
|
my ($self, $token) = @_; |
|
1408
|
192
|
|
|
|
|
382
|
my $type = $token->{subtokens}->[0]->{value}; |
|
1409
|
192
|
|
|
|
|
384
|
my $stack = $self->event_stack; |
|
1410
|
|
|
|
|
|
|
my $info = { |
|
1411
|
|
|
|
|
|
|
style => $type eq '|' |
|
1412
|
|
|
|
|
|
|
? YAML_LITERAL_SCALAR_STYLE |
|
1413
|
|
|
|
|
|
|
: YAML_FOLDED_SCALAR_STYLE, |
|
1414
|
|
|
|
|
|
|
value => $token->{value}, |
|
1415
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1416
|
192
|
100
|
|
|
|
830
|
}; |
|
1417
|
192
|
100
|
66
|
|
|
558
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1418
|
28
|
|
|
|
|
67
|
$self->fetch_inline_properties($stack, $info); |
|
1419
|
|
|
|
|
|
|
} |
|
1420
|
192
|
|
|
|
|
298
|
push @{ $self->event_stack }, [ scalar => $info ]; |
|
|
192
|
|
|
|
|
328
|
|
|
1421
|
192
|
|
|
|
|
437
|
$self->cb_send_scalar; |
|
1422
|
|
|
|
|
|
|
} |
|
1423
|
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
sub cb_end_document { |
|
1425
|
167
|
|
|
167
|
0
|
340
|
my ($self, $token) = @_; |
|
1426
|
167
|
|
|
|
|
374
|
$self->end_document(0); |
|
1427
|
|
|
|
|
|
|
} |
|
1428
|
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
sub cb_end_document_empty { |
|
1430
|
2
|
|
|
2
|
0
|
4
|
my ($self, $token) = @_; |
|
1431
|
2
|
|
|
|
|
6
|
$self->end_document(0); |
|
1432
|
|
|
|
|
|
|
} |
|
1433
|
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
sub cb_doc_start_implicit { |
|
1435
|
367
|
|
|
367
|
0
|
780
|
my ($self, $token) = @_; |
|
1436
|
367
|
|
|
|
|
851
|
$self->start_document(1); |
|
1437
|
|
|
|
|
|
|
} |
|
1438
|
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
sub cb_doc_start_explicit { |
|
1440
|
1381
|
|
|
1381
|
0
|
2563
|
my ($self, $token) = @_; |
|
1441
|
1381
|
|
|
|
|
2833
|
$self->start_document(0); |
|
1442
|
|
|
|
|
|
|
} |
|
1443
|
|
|
|
|
|
|
|
|
1444
|
|
|
|
|
|
|
sub cb_end_doc_start_document { |
|
1445
|
79
|
|
|
79
|
0
|
176
|
my ($self, $token) = @_; |
|
1446
|
79
|
|
|
|
|
237
|
$self->end_document(1); |
|
1447
|
79
|
|
|
|
|
195
|
$self->start_document(0); |
|
1448
|
|
|
|
|
|
|
} |
|
1449
|
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
sub cb_tag_directive { |
|
1451
|
11
|
|
|
11
|
0
|
31
|
my ($self, $token) = @_; |
|
1452
|
11
|
|
|
|
|
51
|
my ($name, $tag_alias, $tag_url) = split ' ', $token->{value}; |
|
1453
|
11
|
|
|
|
|
31
|
$self->tagmap->{ $tag_alias } = $tag_url; |
|
1454
|
|
|
|
|
|
|
} |
|
1455
|
|
|
|
|
|
|
|
|
1456
|
|
|
|
9
|
0
|
|
sub cb_reserved_directive { |
|
1457
|
|
|
|
|
|
|
} |
|
1458
|
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
sub cb_set_yaml_version_directive { |
|
1460
|
47
|
|
|
47
|
0
|
117
|
my ($self, $token) = @_; |
|
1461
|
47
|
50
|
|
|
|
102
|
if ($self->yaml_version_directive) { |
|
1462
|
0
|
|
|
|
|
0
|
croak "Found duplicate YAML directive"; |
|
1463
|
|
|
|
|
|
|
} |
|
1464
|
47
|
|
|
|
|
290
|
my ($version) = $token->{value} =~ m/^%YAML[ \t]+(1\.[12])/; |
|
1465
|
47
|
|
50
|
|
|
179
|
$self->set_yaml_version($version || '1.2'); |
|
1466
|
47
|
|
|
|
|
110
|
$self->set_yaml_version_directive(1); |
|
1467
|
|
|
|
|
|
|
} |
|
1468
|
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
1; |