| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: YAML Parser |
|
2
|
51
|
|
|
51
|
|
525153
|
use strict; |
|
|
51
|
|
|
|
|
66
|
|
|
|
51
|
|
|
|
|
1440
|
|
|
3
|
51
|
|
|
51
|
|
176
|
use warnings; |
|
|
51
|
|
|
|
|
84
|
|
|
|
51
|
|
|
|
|
4007
|
|
|
4
|
|
|
|
|
|
|
package YAML::PP::Parser; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v0.40.1'; # TRIAL VERSION |
|
7
|
|
|
|
|
|
|
|
|
8
|
51
|
50
|
|
51
|
|
281
|
use constant TRACE => $ENV{YAML_PP_TRACE} ? 1 : 0; |
|
|
51
|
|
|
|
|
88
|
|
|
|
51
|
|
|
|
|
4290
|
|
|
9
|
51
|
100
|
66
|
51
|
|
242
|
use constant DEBUG => ($ENV{YAML_PP_DEBUG} || $ENV{YAML_PP_TRACE}) ? 1 : 0; |
|
|
51
|
|
|
|
|
80
|
|
|
|
51
|
|
|
|
|
3091
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
51
|
|
|
|
|
5991
|
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
|
51
|
|
|
51
|
|
2996
|
/; |
|
|
51
|
|
|
|
|
1642
|
|
|
17
|
51
|
|
|
51
|
|
19455
|
use YAML::PP::Render; |
|
|
51
|
|
|
|
|
149
|
|
|
|
51
|
|
|
|
|
1442
|
|
|
18
|
51
|
|
|
51
|
|
22072
|
use YAML::PP::Lexer; |
|
|
51
|
|
|
|
|
118
|
|
|
|
51
|
|
|
|
|
2361
|
|
|
19
|
51
|
|
|
51
|
|
292
|
use YAML::PP::Grammar qw/ $GRAMMAR /; |
|
|
51
|
|
|
|
|
53
|
|
|
|
51
|
|
|
|
|
4630
|
|
|
20
|
51
|
|
|
51
|
|
18763
|
use YAML::PP::Exception; |
|
|
51
|
|
|
|
|
107
|
|
|
|
51
|
|
|
|
|
1508
|
|
|
21
|
51
|
|
|
51
|
|
18640
|
use YAML::PP::Reader; |
|
|
51
|
|
|
|
|
118
|
|
|
|
51
|
|
|
|
|
1341
|
|
|
22
|
51
|
|
|
51
|
|
227
|
use Carp qw/ croak /; |
|
|
51
|
|
|
|
|
67
|
|
|
|
51
|
|
|
|
|
32908
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
|
26
|
4767
|
|
|
4767
|
0
|
3703353
|
my ($class, %args) = @_; |
|
27
|
4767
|
|
33
|
|
|
20499
|
my $reader = delete $args{reader} || YAML::PP::Reader->new; |
|
28
|
4767
|
|
|
|
|
7198
|
my $default_yaml_version = delete $args{default_yaml_version}; |
|
29
|
4767
|
|
100
|
|
|
23553
|
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
|
4767
|
|
|
|
|
7319
|
my $receiver = delete $args{receiver}; |
|
36
|
4767
|
100
|
|
|
|
8636
|
if ($receiver) { |
|
37
|
4002
|
|
|
|
|
8194
|
$self->set_receiver($receiver); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
4767
|
|
|
|
|
37648
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub clone { |
|
43
|
9
|
|
|
9
|
0
|
14
|
my ($self) = @_; |
|
44
|
9
|
|
|
|
|
17
|
my $clone = { |
|
45
|
|
|
|
|
|
|
default_yaml_version => $self->default_yaml_version, |
|
46
|
|
|
|
|
|
|
lexer => YAML::PP::Lexer->new(), |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
9
|
|
|
|
|
31
|
return bless $clone, ref $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
765
|
|
|
765
|
0
|
1582
|
sub receiver { return $_[0]->{receiver} } |
|
52
|
|
|
|
|
|
|
sub set_receiver { |
|
53
|
4776
|
|
|
4776
|
0
|
6621
|
my ($self, $receiver) = @_; |
|
54
|
4776
|
|
|
|
|
5120
|
my $callback; |
|
55
|
4776
|
100
|
|
|
|
10044
|
if (ref $receiver eq 'CODE') { |
|
56
|
4002
|
|
|
|
|
5043
|
$callback = $receiver; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
else { |
|
59
|
|
|
|
|
|
|
$callback = sub { |
|
60
|
41424
|
|
|
41424
|
|
54607
|
my ($self, $event, $info) = @_; |
|
61
|
41424
|
|
|
|
|
102126
|
return $receiver->$event($info); |
|
62
|
774
|
|
|
|
|
2530
|
}; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
4776
|
|
|
|
|
7311
|
$self->{callback} = $callback; |
|
65
|
4776
|
|
|
|
|
7543
|
$self->{receiver} = $receiver; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
4
|
|
|
4
|
0
|
6
|
sub reader { return $_[0]->lexer->{reader} } |
|
68
|
|
|
|
|
|
|
sub set_reader { |
|
69
|
7690
|
|
|
7690
|
0
|
10854
|
my ($self, $reader) = @_; |
|
70
|
7690
|
|
|
|
|
12831
|
$self->lexer->set_reader($reader); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
165874
|
|
|
165874
|
0
|
349501
|
sub lexer { return $_[0]->{lexer} } |
|
73
|
104519
|
|
|
104519
|
0
|
212721
|
sub callback { return $_[0]->{callback} } |
|
74
|
0
|
|
|
0
|
0
|
0
|
sub set_callback { $_[0]->{callback} = $_[1] } |
|
75
|
28894
|
|
|
28894
|
0
|
28164
|
sub level { return $#{ $_[0]->{offset} } } |
|
|
28894
|
|
|
|
|
69875
|
|
|
76
|
126335
|
|
|
126335
|
0
|
167432
|
sub offset { return $_[0]->{offset} } |
|
77
|
7690
|
|
|
7690
|
0
|
12035
|
sub set_offset { $_[0]->{offset} = $_[1] } |
|
78
|
211451
|
|
|
211451
|
0
|
271377
|
sub events { return $_[0]->{events} } |
|
79
|
7690
|
|
|
7690
|
0
|
12210
|
sub set_events { $_[0]->{events} = $_[1] } |
|
80
|
66424
|
|
|
66424
|
0
|
106155
|
sub new_node { return $_[0]->{new_node} } |
|
81
|
99279
|
|
|
99279
|
0
|
152328
|
sub set_new_node { $_[0]->{new_node} = $_[1] } |
|
82
|
2856
|
|
|
2856
|
0
|
6216
|
sub tagmap { return $_[0]->{tagmap} } |
|
83
|
15810
|
|
|
15810
|
0
|
26848
|
sub set_tagmap { $_[0]->{tagmap} = $_[1] } |
|
84
|
36201
|
|
|
36201
|
0
|
45296
|
sub tokens { return $_[0]->{tokens} } |
|
85
|
7690
|
|
|
7690
|
0
|
35457
|
sub set_tokens { $_[0]->{tokens} = $_[1] } |
|
86
|
163004
|
|
|
163004
|
0
|
197526
|
sub event_stack { return $_[0]->{event_stack} } |
|
87
|
7690
|
|
|
7690
|
0
|
14798
|
sub set_event_stack { $_[0]->{event_stack} = $_[1] } |
|
88
|
7699
|
|
|
7699
|
0
|
16734
|
sub default_yaml_version { return $_[0]->{default_yaml_version} } |
|
89
|
8347
|
|
|
8347
|
0
|
17111
|
sub yaml_version { return $_[0]->{yaml_version} } |
|
90
|
7848
|
|
|
7848
|
0
|
11547
|
sub set_yaml_version { $_[0]->{yaml_version} = $_[1] } |
|
91
|
8475
|
|
|
8475
|
0
|
11177
|
sub yaml_version_directive { return $_[0]->{yaml_version_directive} } |
|
92
|
16164
|
|
|
16164
|
0
|
20939
|
sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] } |
|
93
|
|
|
|
|
|
|
|
|
94
|
34331
|
|
|
34331
|
0
|
55335
|
sub rule { return $_[0]->{rule} } |
|
95
|
|
|
|
|
|
|
sub set_rule { |
|
96
|
183177
|
|
|
183177
|
0
|
232965
|
my ($self, $name) = @_; |
|
97
|
51
|
|
|
51
|
|
314
|
no warnings 'uninitialized'; |
|
|
51
|
|
|
|
|
108
|
|
|
|
51
|
|
|
|
|
367829
|
|
|
98
|
183177
|
|
|
|
|
163314
|
DEBUG and $self->info("set_rule($name)"); |
|
99
|
183177
|
|
|
|
|
241189
|
$self->{rule} = $name; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub init { |
|
103
|
7690
|
|
|
7690
|
0
|
10823
|
my ($self) = @_; |
|
104
|
7690
|
|
|
|
|
15505
|
$self->set_offset([]); |
|
105
|
7690
|
|
|
|
|
15225
|
$self->set_events([]); |
|
106
|
7690
|
|
|
|
|
15188
|
$self->set_new_node(0); |
|
107
|
7690
|
|
|
|
|
22491
|
$self->set_tagmap({ |
|
108
|
|
|
|
|
|
|
'!!' => "tag:yaml.org,2002:", |
|
109
|
|
|
|
|
|
|
}); |
|
110
|
7690
|
|
|
|
|
15269
|
$self->set_tokens([]); |
|
111
|
7690
|
|
|
|
|
14348
|
$self->set_rule(undef); |
|
112
|
7690
|
|
|
|
|
14817
|
$self->set_event_stack([]); |
|
113
|
7690
|
|
|
|
|
12316
|
$self->set_yaml_version($self->default_yaml_version); |
|
114
|
7690
|
|
|
|
|
14978
|
$self->set_yaml_version_directive(undef); |
|
115
|
7690
|
|
|
|
|
11188
|
$self->lexer->init; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub parse_string { |
|
119
|
5479
|
|
|
5479
|
0
|
67212
|
my ($self, $yaml) = @_; |
|
120
|
5479
|
|
|
|
|
11741
|
$self->set_reader(YAML::PP::Reader->new( input => $yaml )); |
|
121
|
5479
|
|
|
|
|
10068
|
$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
|
7690
|
|
|
7690
|
0
|
10927
|
my ($self) = @_; |
|
148
|
7690
|
|
|
|
|
8494
|
TRACE and warn "=== parse()\n"; |
|
149
|
7690
|
|
|
|
|
8158
|
TRACE and $self->debug_yaml; |
|
150
|
7690
|
|
|
|
|
15676
|
$self->init; |
|
151
|
7690
|
|
|
|
|
11006
|
$self->lexer->init; |
|
152
|
7690
|
|
|
|
|
9594
|
eval { |
|
153
|
7690
|
|
|
|
|
17602
|
$self->start_stream; |
|
154
|
7690
|
|
|
|
|
24437
|
$self->set_rule( 'STREAM' ); |
|
155
|
|
|
|
|
|
|
|
|
156
|
7690
|
|
|
|
|
15991
|
$self->parse_tokens(); |
|
157
|
|
|
|
|
|
|
|
|
158
|
7528
|
|
|
|
|
12564
|
$self->end_stream; |
|
159
|
|
|
|
|
|
|
}; |
|
160
|
7690
|
100
|
|
|
|
21268
|
if (my $error = $@) { |
|
161
|
162
|
100
|
|
|
|
314
|
if (ref $error) { |
|
162
|
124
|
|
|
|
|
334
|
croak "$error\n "; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
38
|
|
|
|
|
3567
|
croak $error; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
7528
|
|
|
|
|
7406
|
DEBUG and $self->highlight_yaml; |
|
168
|
7528
|
|
|
|
|
13325
|
TRACE and $self->debug_tokens; |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub lex_next_tokens { |
|
172
|
41914
|
|
|
41914
|
0
|
53069
|
my ($self) = @_; |
|
173
|
|
|
|
|
|
|
|
|
174
|
41914
|
|
|
|
|
38201
|
DEBUG and $self->info("----------------> lex_next_tokens"); |
|
175
|
41914
|
|
|
|
|
37166
|
TRACE and $self->debug_events; |
|
176
|
|
|
|
|
|
|
|
|
177
|
41914
|
|
|
|
|
54789
|
my $indent = $self->offset->[-1]; |
|
178
|
41914
|
|
|
|
|
53189
|
my $event_types = $self->events; |
|
179
|
41914
|
|
|
|
|
61723
|
my $next_tokens = $self->lexer->fetch_next_tokens($indent); |
|
180
|
41879
|
100
|
|
|
|
73918
|
return unless @$next_tokens; |
|
181
|
|
|
|
|
|
|
|
|
182
|
34342
|
|
|
|
|
39388
|
my $next = $next_tokens->[0]; |
|
183
|
|
|
|
|
|
|
|
|
184
|
34342
|
100
|
|
|
|
63741
|
return 1 if ($next->{name} ne 'SPACE'); |
|
185
|
28195
|
|
|
|
|
44083
|
my $flow = $event_types->[-1] =~ m/^FLOW/; |
|
186
|
28195
|
|
|
|
|
40593
|
my $space = length $next->{value}; |
|
187
|
28195
|
|
|
|
|
43544
|
my $tokens = $self->tokens; |
|
188
|
|
|
|
|
|
|
|
|
189
|
28195
|
100
|
|
|
|
41286
|
if (not $space) { |
|
190
|
14465
|
|
|
|
|
16910
|
shift @$next_tokens; |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
else { |
|
193
|
13730
|
|
|
|
|
20887
|
push @$tokens, shift @$next_tokens; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
28195
|
100
|
|
|
|
41083
|
if ($flow) { |
|
196
|
720
|
100
|
|
|
|
1320
|
if ($space >= $indent) { |
|
197
|
717
|
|
|
|
|
1780
|
return 1; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
3
|
|
|
|
|
7
|
$self->exception("Bad indendation in " . $self->events->[-1]); |
|
200
|
|
|
|
|
|
|
} |
|
201
|
27475
|
|
|
|
|
44125
|
$next = $next_tokens->[0]; |
|
202
|
27475
|
100
|
|
|
|
40160
|
if ($space > $indent ) { |
|
203
|
8267
|
100
|
|
|
|
19754
|
return 1 if $indent < 0; |
|
204
|
2122
|
100
|
|
|
|
3359
|
unless ($self->new_node) { |
|
205
|
4
|
|
|
|
|
7
|
$self->exception("Bad indendation in " . $self->events->[-1]); |
|
206
|
|
|
|
|
|
|
} |
|
207
|
2118
|
|
|
|
|
4531
|
return 1; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
19208
|
100
|
|
|
|
29307
|
if ($self->new_node) { |
|
210
|
1289
|
100
|
|
|
|
2324
|
if ($space < $indent) { |
|
211
|
437
|
|
|
|
|
1825
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
212
|
437
|
|
|
|
|
970
|
$self->remove_nodes($space); |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
else { |
|
215
|
|
|
|
|
|
|
# unindented sequence starts |
|
216
|
852
|
|
|
|
|
1458
|
my $exp = $self->events->[-1]; |
|
217
|
852
|
|
|
|
|
1360
|
my $seq_start = $next->{name} eq 'DASH'; |
|
218
|
852
|
100
|
100
|
|
|
3292
|
if ( $seq_start and ($exp eq 'MAPVALUE' or $exp eq 'MAP')) { |
|
|
|
|
100
|
|
|
|
|
|
219
|
|
|
|
|
|
|
} |
|
220
|
|
|
|
|
|
|
else { |
|
221
|
289
|
|
|
|
|
981
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
} |
|
225
|
|
|
|
|
|
|
else { |
|
226
|
17919
|
100
|
|
|
|
25964
|
if ($space < $indent) { |
|
227
|
2199
|
|
|
|
|
4471
|
$self->remove_nodes($space); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
} |
|
230
|
|
|
|
|
|
|
|
|
231
|
19208
|
|
|
|
|
26606
|
my $exp = $self->events->[-1]; |
|
232
|
|
|
|
|
|
|
|
|
233
|
19208
|
100
|
100
|
|
|
33920
|
if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') { |
|
234
|
242
|
|
|
|
|
286
|
TRACE and $self->info("In unindented sequence"); |
|
235
|
242
|
|
|
|
|
649
|
$self->end_sequence; |
|
236
|
242
|
|
|
|
|
373
|
$exp = $self->events->[-1]; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
19208
|
100
|
|
|
|
24049
|
if ($self->offset->[-1] != $space) { |
|
240
|
4
|
|
|
|
|
11
|
$self->exception("Expected " . $self->events->[-1]); |
|
241
|
|
|
|
|
|
|
} |
|
242
|
19204
|
|
|
|
|
39569
|
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
|
7690
|
|
|
7690
|
0
|
9926
|
my ($self) = @_; |
|
341
|
7690
|
|
|
|
|
10726
|
my $event_types = $self->events; |
|
342
|
7690
|
|
|
|
|
10319
|
my $offsets = $self->offset; |
|
343
|
7690
|
|
|
|
|
10501
|
my $tokens = $self->tokens; |
|
344
|
7690
|
|
|
|
|
10457
|
my $next_tokens = $self->lexer->next_tokens; |
|
345
|
|
|
|
|
|
|
|
|
346
|
7690
|
100
|
|
|
|
13481
|
unless ($self->lex_next_tokens) { |
|
347
|
69
|
|
|
|
|
151
|
$self->end_document(1); |
|
348
|
69
|
|
|
|
|
96
|
return 0; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
7587
|
50
|
|
|
|
12993
|
unless ($self->new_node) { |
|
351
|
7587
|
50
|
|
|
|
11687
|
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
|
7587
|
|
|
|
|
11841
|
my $rule_name = $self->rule; |
|
359
|
7587
|
|
|
|
|
7955
|
DEBUG and $self->info("----------------> parse_tokens($rule_name)"); |
|
360
|
7587
|
50
|
|
|
|
16459
|
my $rule = $GRAMMAR->{ $rule_name } |
|
361
|
|
|
|
|
|
|
or die "Could not find rule $rule_name"; |
|
362
|
|
|
|
|
|
|
|
|
363
|
7587
|
|
|
|
|
7181
|
TRACE and $self->debug_rules($rule); |
|
364
|
7587
|
|
|
|
|
6873
|
TRACE and $self->debug_yaml; |
|
365
|
7587
|
|
|
|
|
7484
|
DEBUG and $self->debug_next_line; |
|
366
|
|
|
|
|
|
|
|
|
367
|
7587
|
|
|
|
|
11787
|
RULE: while ($rule_name) { |
|
368
|
291090
|
|
|
|
|
258523
|
DEBUG and $self->info("RULE: $rule_name"); |
|
369
|
291090
|
|
|
|
|
247133
|
TRACE and $self->debug_tokens($next_tokens); |
|
370
|
|
|
|
|
|
|
|
|
371
|
291090
|
50
|
|
|
|
357785
|
unless (@$next_tokens) { |
|
372
|
0
|
|
|
|
|
0
|
$self->exception("No more tokens"); |
|
373
|
|
|
|
|
|
|
} |
|
374
|
291090
|
|
|
|
|
246984
|
TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']); |
|
375
|
291090
|
|
|
|
|
327656
|
my $got = $next_tokens->[0]->{name}; |
|
376
|
291090
|
100
|
|
|
|
366902
|
if ($got eq 'CONTEXT') { |
|
377
|
46305
|
|
|
|
|
53627
|
my $context = shift @$next_tokens; |
|
378
|
46305
|
|
|
|
|
54090
|
my $indent = $offsets->[-1]; |
|
379
|
46305
|
100
|
|
|
|
66344
|
$indent++ unless $self->lexer->flowcontext; |
|
380
|
46305
|
|
|
|
|
73740
|
my $method = $fetch_method{ $context->{value} }; |
|
381
|
46305
|
|
|
|
|
58632
|
my $partial = $self->lexer->$method($indent, $context->{value}); |
|
382
|
46279
|
|
|
|
|
132791
|
next RULE; |
|
383
|
|
|
|
|
|
|
} |
|
384
|
244785
|
|
|
|
|
291690
|
my $def = $rule->{ $got }; |
|
385
|
244785
|
100
|
|
|
|
319341
|
if ($def) { |
|
|
|
100
|
|
|
|
|
|
|
386
|
163029
|
|
|
|
|
214882
|
push @$tokens, shift @$next_tokens; |
|
387
|
|
|
|
|
|
|
} |
|
388
|
|
|
|
|
|
|
elsif ($def = $rule->{DEFAULT}) { |
|
389
|
81708
|
|
|
|
|
86009
|
$got = 'DEFAULT'; |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
else { |
|
392
|
48
|
|
|
|
|
213
|
$self->expected( |
|
393
|
|
|
|
|
|
|
expected => [keys %$rule], |
|
394
|
|
|
|
|
|
|
got => $next_tokens->[0], |
|
395
|
|
|
|
|
|
|
); |
|
396
|
|
|
|
|
|
|
} |
|
397
|
|
|
|
|
|
|
|
|
398
|
244737
|
|
|
|
|
223296
|
DEBUG and $self->got("---got $got"); |
|
399
|
244737
|
100
|
|
|
|
362889
|
if (my $sub = $def->{match}) { |
|
400
|
122388
|
|
|
|
|
110450
|
DEBUG and $self->info("CALLBACK $sub"); |
|
401
|
122388
|
100
|
|
|
|
307606
|
$self->$sub(@$tokens ? $tokens->[-1] : ()); |
|
402
|
|
|
|
|
|
|
} |
|
403
|
244704
|
|
|
|
|
280933
|
my $eol = $got eq 'EOL'; |
|
404
|
244704
|
|
|
|
|
275638
|
my $new = $def->{new}; |
|
405
|
244704
|
100
|
|
|
|
355622
|
if ($new) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
406
|
124079
|
|
|
|
|
109305
|
DEBUG and $self->got("NEW: $new"); |
|
407
|
124079
|
|
|
|
|
122300
|
$rule_name = $new; |
|
408
|
124079
|
|
|
|
|
178605
|
$self->set_rule($rule_name); |
|
409
|
|
|
|
|
|
|
} |
|
410
|
|
|
|
|
|
|
elsif ($eol) { |
|
411
|
|
|
|
|
|
|
} |
|
412
|
|
|
|
|
|
|
elsif ($def->{return}) { |
|
413
|
6786
|
50
|
|
|
|
14108
|
$rule_name = $nodetypes{ $event_types->[-1] } |
|
414
|
|
|
|
|
|
|
or die "Unexpected event type $event_types->[-1]"; |
|
415
|
6786
|
|
|
|
|
9651
|
$self->set_rule($rule_name); |
|
416
|
|
|
|
|
|
|
} |
|
417
|
|
|
|
|
|
|
else { |
|
418
|
87542
|
|
|
|
|
115935
|
$rule_name .= " - $got"; # for debugging |
|
419
|
87542
|
|
|
|
|
86804
|
$rule = $def; |
|
420
|
87542
|
|
|
|
|
147930
|
next RULE; |
|
421
|
|
|
|
|
|
|
} |
|
422
|
157162
|
100
|
|
|
|
205128
|
if ($eol) { |
|
423
|
34224
|
100
|
|
|
|
50613
|
unless ($self->lex_next_tokens) { |
|
424
|
7468
|
100
|
|
|
|
12505
|
if ($rule_name eq 'DIRECTIVE') { |
|
425
|
1
|
|
|
|
|
3
|
$self->exception("Directive needs document start"); |
|
426
|
|
|
|
|
|
|
} |
|
427
|
7467
|
|
|
|
|
15999
|
$self->end_document(1); |
|
428
|
7459
|
|
|
|
|
16533
|
return 0; |
|
429
|
|
|
|
|
|
|
} |
|
430
|
26744
|
100
|
|
|
|
37744
|
unless ($self->new_node) { |
|
431
|
21307
|
100
|
|
|
|
30951
|
if ($self->level > 0) { |
|
432
|
20423
|
50
|
|
|
|
41671
|
$rule_name = $nodetypes{ $event_types->[-1] } |
|
433
|
|
|
|
|
|
|
or die "Did not find '$event_types->[-1]'"; |
|
434
|
20423
|
|
|
|
|
30337
|
$self->set_rule( $rule_name ); |
|
435
|
|
|
|
|
|
|
} |
|
436
|
|
|
|
|
|
|
} |
|
437
|
26744
|
|
|
|
|
38658
|
$rule_name = $self->rule; |
|
438
|
|
|
|
|
|
|
} |
|
439
|
149682
|
50
|
|
|
|
337899
|
$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
|
242
|
|
|
242
|
0
|
393
|
my ($self) = @_; |
|
449
|
242
|
|
|
|
|
360
|
my $event_types = $self->events; |
|
450
|
242
|
|
|
|
|
297
|
pop @{ $event_types }; |
|
|
242
|
|
|
|
|
335
|
|
|
451
|
242
|
|
|
|
|
288
|
pop @{ $self->offset }; |
|
|
242
|
|
|
|
|
342
|
|
|
452
|
242
|
|
|
|
|
447
|
my $info = { name => 'sequence_end_event' }; |
|
453
|
242
|
|
|
|
|
458
|
$self->callback->($self, $info->{name} => $info ); |
|
454
|
242
|
|
|
|
|
669
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
455
|
|
|
|
|
|
|
} |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
sub remove_nodes { |
|
458
|
11313
|
|
|
11313
|
0
|
14880
|
my ($self, $space) = @_; |
|
459
|
11313
|
|
|
|
|
14584
|
my $offset = $self->offset; |
|
460
|
11313
|
|
|
|
|
14614
|
my $event_types = $self->events; |
|
461
|
|
|
|
|
|
|
|
|
462
|
11313
|
|
|
|
|
14243
|
my $exp = $event_types->[-1]; |
|
463
|
11313
|
|
|
|
|
17962
|
while (@$offset) { |
|
464
|
19939
|
100
|
|
|
|
29901
|
if ($offset->[ -1 ] <= $space) { |
|
465
|
11306
|
|
|
|
|
15295
|
last; |
|
466
|
|
|
|
|
|
|
} |
|
467
|
8633
|
100
|
|
|
|
13130
|
if ($exp eq 'MAPVALUE') { |
|
468
|
51
|
|
|
|
|
187
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
469
|
51
|
|
|
|
|
87
|
$exp = 'MAP'; |
|
470
|
|
|
|
|
|
|
} |
|
471
|
8633
|
|
|
|
|
13507
|
my $info = { name => $exp }; |
|
472
|
8633
|
|
|
|
|
16456
|
$info->{name} = $event_to_method{ $exp } . '_end_event'; |
|
473
|
8633
|
|
|
|
|
8648
|
pop @{ $event_types }; |
|
|
8633
|
|
|
|
|
10474
|
|
|
474
|
8633
|
|
|
|
|
9657
|
pop @{ $offset }; |
|
|
8633
|
|
|
|
|
8805
|
|
|
475
|
8633
|
|
|
|
|
14125
|
$self->callback->($self, $info->{name} => $info ); |
|
476
|
8626
|
|
|
|
|
30228
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
477
|
8626
|
|
|
|
|
16169
|
$exp = $event_types->[-1]; |
|
478
|
|
|
|
|
|
|
} |
|
479
|
11306
|
|
|
|
|
15266
|
return $exp; |
|
480
|
|
|
|
|
|
|
} |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub start_stream { |
|
483
|
7690
|
|
|
7690
|
0
|
18877
|
my ($self) = @_; |
|
484
|
7690
|
|
|
|
|
8854
|
push @{ $self->events }, 'STR'; |
|
|
7690
|
|
|
|
|
10789
|
|
|
485
|
7690
|
|
|
|
|
8643
|
push @{ $self->offset }, -1; |
|
|
7690
|
|
|
|
|
10450
|
|
|
486
|
7690
|
|
|
|
|
16878
|
$self->callback->($self, 'stream_start_event', { |
|
487
|
|
|
|
|
|
|
name => 'stream_start_event', |
|
488
|
|
|
|
|
|
|
}); |
|
489
|
|
|
|
|
|
|
} |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub start_document { |
|
492
|
8316
|
|
|
8316
|
0
|
10453
|
my ($self, $implicit) = @_; |
|
493
|
8316
|
|
|
|
|
8298
|
push @{ $self->events }, 'DOC'; |
|
|
8316
|
|
|
|
|
11403
|
|
|
494
|
8316
|
|
|
|
|
8787
|
push @{ $self->offset }, -1; |
|
|
8316
|
|
|
|
|
11578
|
|
|
495
|
8316
|
|
|
|
|
12430
|
my $directive = $self->yaml_version_directive; |
|
496
|
8316
|
|
|
|
|
9749
|
my %directive; |
|
497
|
8316
|
100
|
|
|
|
11915
|
if ($directive) { |
|
498
|
154
|
|
|
|
|
272
|
my ($major, $minor) = split m/\./, $self->yaml_version; |
|
499
|
154
|
|
|
|
|
665
|
%directive = ( version_directive => { major => $major, minor => $minor } ); |
|
500
|
|
|
|
|
|
|
} |
|
501
|
8316
|
|
|
|
|
23440
|
$self->callback->($self, 'document_start_event', { |
|
502
|
|
|
|
|
|
|
name => 'document_start_event', |
|
503
|
|
|
|
|
|
|
implicit => $implicit, |
|
504
|
|
|
|
|
|
|
%directive, |
|
505
|
|
|
|
|
|
|
}); |
|
506
|
8316
|
|
|
|
|
25953
|
$self->set_yaml_version_directive(undef); |
|
507
|
8316
|
|
|
|
|
14726
|
$self->set_rule( 'FULLNODE' ); |
|
508
|
8316
|
|
|
|
|
11977
|
$self->set_new_node(1); |
|
509
|
|
|
|
|
|
|
} |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
sub start_sequence { |
|
512
|
3258
|
|
|
3258
|
0
|
4251
|
my ($self, $offset) = @_; |
|
513
|
3258
|
|
|
|
|
4705
|
my $offsets = $self->offset; |
|
514
|
3258
|
100
|
|
|
|
6117
|
if ($offsets->[-1] == $offset) { |
|
515
|
563
|
|
|
|
|
853
|
push @{ $self->events }, 'SEQ0'; |
|
|
563
|
|
|
|
|
777
|
|
|
516
|
|
|
|
|
|
|
} |
|
517
|
|
|
|
|
|
|
else { |
|
518
|
2695
|
|
|
|
|
3021
|
push @{ $self->events }, 'SEQ'; |
|
|
2695
|
|
|
|
|
3853
|
|
|
519
|
|
|
|
|
|
|
} |
|
520
|
3258
|
|
|
|
|
3873
|
push @{ $offsets }, $offset; |
|
|
3258
|
|
|
|
|
4014
|
|
|
521
|
3258
|
|
|
|
|
5724
|
my $event_stack = $self->event_stack; |
|
522
|
3258
|
|
|
|
|
5663
|
my $info = { name => 'sequence_start_event' }; |
|
523
|
3258
|
100
|
66
|
|
|
6742
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
524
|
227
|
|
|
|
|
343
|
my $properties = pop @$event_stack; |
|
525
|
227
|
|
|
|
|
621
|
$self->node_properties($properties->[1], $info); |
|
526
|
|
|
|
|
|
|
} |
|
527
|
3258
|
|
|
|
|
5678
|
$self->callback->($self, 'sequence_start_event', $info); |
|
528
|
|
|
|
|
|
|
} |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
sub start_flow_sequence { |
|
531
|
1440
|
|
|
1440
|
0
|
2029
|
my ($self, $offset) = @_; |
|
532
|
1440
|
|
|
|
|
2129
|
my $offsets = $self->offset; |
|
533
|
1440
|
|
|
|
|
1951
|
my $new_offset = $offsets->[-1]; |
|
534
|
1440
|
|
|
|
|
2102
|
my $event_types = $self->events; |
|
535
|
1440
|
100
|
|
|
|
3137
|
if ($new_offset < 0) { |
|
|
|
100
|
|
|
|
|
|
|
536
|
164
|
|
|
|
|
267
|
$new_offset = 0; |
|
537
|
|
|
|
|
|
|
} |
|
538
|
|
|
|
|
|
|
elsif ($self->new_node) { |
|
539
|
1213
|
100
|
|
|
|
2816
|
if ($event_types->[-1] !~ m/^FLOW/) { |
|
540
|
1008
|
|
|
|
|
1178
|
$new_offset++; |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
} |
|
543
|
1440
|
|
|
|
|
1794
|
push @{ $self->events }, 'FLOWSEQ'; |
|
|
1440
|
|
|
|
|
1823
|
|
|
544
|
1440
|
|
|
|
|
1599
|
push @{ $offsets }, $new_offset; |
|
|
1440
|
|
|
|
|
1688
|
|
|
545
|
|
|
|
|
|
|
|
|
546
|
1440
|
|
|
|
|
2200
|
my $event_stack = $self->event_stack; |
|
547
|
1440
|
|
|
|
|
3449
|
my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' }; |
|
548
|
1440
|
100
|
66
|
|
|
3067
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
549
|
42
|
|
|
|
|
110
|
$self->fetch_inline_properties($event_stack, $info); |
|
550
|
|
|
|
|
|
|
} |
|
551
|
1440
|
|
|
|
|
2388
|
$self->callback->($self, 'sequence_start_event', $info); |
|
552
|
|
|
|
|
|
|
} |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub start_flow_mapping { |
|
555
|
1219
|
|
|
1219
|
0
|
2052
|
my ($self, $offset, $implicit_flowseq_map) = @_; |
|
556
|
1219
|
|
|
|
|
2051
|
my $offsets = $self->offset; |
|
557
|
1219
|
|
|
|
|
1617
|
my $new_offset = $offsets->[-1]; |
|
558
|
1219
|
|
|
|
|
1810
|
my $event_types = $self->events; |
|
559
|
1219
|
100
|
|
|
|
2654
|
if ($new_offset < 0) { |
|
|
|
100
|
|
|
|
|
|
|
560
|
409
|
|
|
|
|
537
|
$new_offset = 0; |
|
561
|
|
|
|
|
|
|
} |
|
562
|
|
|
|
|
|
|
elsif ($self->new_node) { |
|
563
|
706
|
100
|
|
|
|
1657
|
if ($event_types->[-1] !~ m/^FLOW/) { |
|
564
|
618
|
|
|
|
|
787
|
$new_offset++; |
|
565
|
|
|
|
|
|
|
} |
|
566
|
|
|
|
|
|
|
} |
|
567
|
1219
|
100
|
|
|
|
1404
|
push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP'; |
|
|
1219
|
|
|
|
|
1836
|
|
|
568
|
1219
|
|
|
|
|
1387
|
push @{ $offsets }, $new_offset; |
|
|
1219
|
|
|
|
|
1525
|
|
|
569
|
|
|
|
|
|
|
|
|
570
|
1219
|
|
|
|
|
1825
|
my $event_stack = $self->event_stack; |
|
571
|
1219
|
|
|
|
|
2886
|
my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE }; |
|
572
|
1219
|
100
|
66
|
|
|
2765
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
573
|
71
|
|
|
|
|
161
|
$self->fetch_inline_properties($event_stack, $info); |
|
574
|
|
|
|
|
|
|
} |
|
575
|
1219
|
|
|
|
|
2125
|
$self->callback->($self, 'mapping_start_event', $info); |
|
576
|
|
|
|
|
|
|
} |
|
577
|
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub end_flow_sequence { |
|
579
|
1416
|
|
|
1416
|
0
|
2166
|
my ($self) = @_; |
|
580
|
1416
|
|
|
|
|
1897
|
my $event_types = $self->events; |
|
581
|
1416
|
|
|
|
|
1566
|
pop @{ $event_types }; |
|
|
1416
|
|
|
|
|
1716
|
|
|
582
|
1416
|
|
|
|
|
1663
|
pop @{ $self->offset }; |
|
|
1416
|
|
|
|
|
1926
|
|
|
583
|
1416
|
|
|
|
|
2564
|
my $info = { name => 'sequence_end_event' }; |
|
584
|
1416
|
|
|
|
|
2578
|
$self->callback->($self, $info->{name}, $info); |
|
585
|
1416
|
100
|
|
|
|
5554
|
if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { |
|
586
|
258
|
|
|
|
|
553
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
587
|
|
|
|
|
|
|
} |
|
588
|
|
|
|
|
|
|
else { |
|
589
|
1158
|
|
|
|
|
2074
|
push @$event_types, 'END_FLOW'; |
|
590
|
|
|
|
|
|
|
} |
|
591
|
|
|
|
|
|
|
} |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
sub end_flow_mapping { |
|
594
|
1205
|
|
|
1205
|
0
|
1725
|
my ($self) = @_; |
|
595
|
1205
|
|
|
|
|
1765
|
my $event_types = $self->events; |
|
596
|
1205
|
|
|
|
|
1371
|
pop @{ $event_types }; |
|
|
1205
|
|
|
|
|
1514
|
|
|
597
|
1205
|
|
|
|
|
1379
|
pop @{ $self->offset }; |
|
|
1205
|
|
|
|
|
1696
|
|
|
598
|
1205
|
|
|
|
|
2261
|
my $info = { name => 'mapping_end_event' }; |
|
599
|
1205
|
|
|
|
|
2154
|
$self->callback->($self, $info->{name}, $info); |
|
600
|
1197
|
100
|
|
|
|
4315
|
if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { |
|
601
|
182
|
|
|
|
|
383
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
602
|
|
|
|
|
|
|
} |
|
603
|
|
|
|
|
|
|
else { |
|
604
|
1015
|
|
|
|
|
1855
|
push @$event_types, 'END_FLOW'; |
|
605
|
|
|
|
|
|
|
} |
|
606
|
|
|
|
|
|
|
} |
|
607
|
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub cb_end_outer_flow { |
|
609
|
2167
|
|
|
2167
|
0
|
3149
|
my ($self) = @_; |
|
610
|
2167
|
|
|
|
|
2841
|
my $event_types = $self->events; |
|
611
|
2167
|
|
|
|
|
2547
|
pop @$event_types; |
|
612
|
2167
|
|
|
|
|
4016
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
613
|
|
|
|
|
|
|
} |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
sub start_mapping { |
|
616
|
5700
|
|
|
5700
|
0
|
7726
|
my ($self, $offset) = @_; |
|
617
|
5700
|
|
|
|
|
7981
|
my $offsets = $self->offset; |
|
618
|
5700
|
|
|
|
|
6207
|
push @{ $self->events }, 'MAP'; |
|
|
5700
|
|
|
|
|
7778
|
|
|
619
|
5700
|
|
|
|
|
5942
|
push @{ $offsets }, $offset; |
|
|
5700
|
|
|
|
|
6729
|
|
|
620
|
5700
|
|
|
|
|
7746
|
my $event_stack = $self->event_stack; |
|
621
|
5700
|
|
|
|
|
9200
|
my $info = { name => 'mapping_start_event' }; |
|
622
|
5700
|
100
|
66
|
|
|
10651
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
623
|
492
|
|
|
|
|
683
|
my $properties = pop @$event_stack; |
|
624
|
492
|
|
|
|
|
982
|
$self->node_properties($properties->[1], $info); |
|
625
|
|
|
|
|
|
|
} |
|
626
|
5700
|
|
|
|
|
8989
|
$self->callback->($self, 'mapping_start_event', $info); |
|
627
|
|
|
|
|
|
|
} |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
sub end_document { |
|
630
|
8678
|
|
|
8678
|
0
|
11237
|
my ($self, $implicit) = @_; |
|
631
|
|
|
|
|
|
|
|
|
632
|
8678
|
|
|
|
|
11136
|
my $event_types = $self->events; |
|
633
|
8678
|
100
|
|
|
|
18176
|
if ($event_types->[-1] =~ m/FLOW/) { |
|
634
|
1
|
|
|
|
|
9
|
die "Unexpected end of flow context"; |
|
635
|
|
|
|
|
|
|
} |
|
636
|
8677
|
100
|
|
|
|
11781
|
if ($self->new_node) { |
|
637
|
501
|
|
|
|
|
1707
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
638
|
|
|
|
|
|
|
} |
|
639
|
8677
|
|
|
|
|
20537
|
$self->remove_nodes(-1); |
|
640
|
|
|
|
|
|
|
|
|
641
|
8670
|
100
|
|
|
|
15095
|
if ($event_types->[-1] eq 'STR') { |
|
642
|
474
|
|
|
|
|
698
|
return; |
|
643
|
|
|
|
|
|
|
} |
|
644
|
8196
|
|
|
|
|
8660
|
my $last = pop @{ $event_types }; |
|
|
8196
|
|
|
|
|
10714
|
|
|
645
|
8196
|
50
|
33
|
|
|
26771
|
if ($last ne 'DOC' and $last ne 'DOC_END') { |
|
646
|
0
|
|
|
|
|
0
|
$self->exception("Unexpected event type $last"); |
|
647
|
|
|
|
|
|
|
} |
|
648
|
8196
|
|
|
|
|
8640
|
pop @{ $self->offset }; |
|
|
8196
|
|
|
|
|
11643
|
|
|
649
|
8196
|
|
|
|
|
21304
|
$self->callback->($self, 'document_end_event', { |
|
650
|
|
|
|
|
|
|
name => 'document_end_event', |
|
651
|
|
|
|
|
|
|
implicit => $implicit, |
|
652
|
|
|
|
|
|
|
}); |
|
653
|
8193
|
100
|
|
|
|
21692
|
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
|
8120
|
|
|
|
|
27767
|
$self->set_tagmap({ '!!' => "tag:yaml.org,2002:" }); |
|
657
|
|
|
|
|
|
|
} |
|
658
|
8193
|
|
|
|
|
14911
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
659
|
8193
|
|
|
|
|
13243
|
$self->set_rule('STREAM'); |
|
660
|
|
|
|
|
|
|
} |
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
sub end_stream { |
|
663
|
7528
|
|
|
7528
|
0
|
9338
|
my ($self) = @_; |
|
664
|
7528
|
|
|
|
|
7165
|
my $last = pop @{ $self->events }; |
|
|
7528
|
|
|
|
|
9496
|
|
|
665
|
7528
|
50
|
|
|
|
12681
|
$self->exception("Unexpected event type $last") unless $last eq 'STR'; |
|
666
|
7528
|
|
|
|
|
7939
|
pop @{ $self->offset }; |
|
|
7528
|
|
|
|
|
10281
|
|
|
667
|
7528
|
|
|
|
|
14249
|
$self->callback->($self, 'stream_end_event', { |
|
668
|
|
|
|
|
|
|
name => 'stream_end_event', |
|
669
|
|
|
|
|
|
|
}); |
|
670
|
|
|
|
|
|
|
} |
|
671
|
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
sub fetch_inline_properties { |
|
673
|
3438
|
|
|
3438
|
0
|
5315
|
my ($self, $stack, $info) = @_; |
|
674
|
3438
|
|
|
|
|
4385
|
my $properties = $stack->[-1]; |
|
675
|
|
|
|
|
|
|
|
|
676
|
3438
|
|
|
|
|
4296
|
$properties = $properties->[1]; |
|
677
|
3438
|
|
|
|
|
3688
|
my $property_offset; |
|
678
|
3438
|
50
|
|
|
|
6611
|
if ($properties) { |
|
679
|
3438
|
|
|
|
|
3475
|
for my $p (@{ $properties->{inline} }) { |
|
|
3438
|
|
|
|
|
7066
|
|
|
680
|
3486
|
|
|
|
|
4848
|
my $type = $p->{type}; |
|
681
|
3486
|
50
|
|
|
|
6289
|
if (exists $info->{ $type }) { |
|
682
|
0
|
|
|
|
|
0
|
$self->exception("A node can only have one $type"); |
|
683
|
|
|
|
|
|
|
} |
|
684
|
3486
|
|
|
|
|
6014
|
$info->{ $type } = $p->{value}; |
|
685
|
3486
|
100
|
|
|
|
6558
|
unless (defined $property_offset) { |
|
686
|
3046
|
|
|
|
|
3699
|
$property_offset = $p->{offset}; |
|
687
|
3046
|
|
|
|
|
5278
|
$info->{offset} = $p->{offset}; |
|
688
|
|
|
|
|
|
|
} |
|
689
|
|
|
|
|
|
|
} |
|
690
|
3438
|
|
|
|
|
7700
|
delete $properties->{inline}; |
|
691
|
3438
|
100
|
|
|
|
6801
|
undef $properties unless $properties->{newline}; |
|
692
|
|
|
|
|
|
|
} |
|
693
|
|
|
|
|
|
|
|
|
694
|
3438
|
100
|
|
|
|
5465
|
unless ($properties) { |
|
695
|
2909
|
|
|
|
|
4449
|
pop @$stack; |
|
696
|
|
|
|
|
|
|
} |
|
697
|
|
|
|
|
|
|
} |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
sub node_properties { |
|
700
|
1164
|
|
|
1164
|
0
|
1876
|
my ($self, $properties, $info) = @_; |
|
701
|
1164
|
50
|
|
|
|
2152
|
if ($properties) { |
|
702
|
1164
|
|
|
|
|
1267
|
for my $p (@{ $properties->{newline} }) { |
|
|
1164
|
|
|
|
|
2275
|
|
|
703
|
1336
|
|
|
|
|
1846
|
my $type = $p->{type}; |
|
704
|
1336
|
100
|
|
|
|
2509
|
if (exists $info->{ $type }) { |
|
705
|
1
|
|
|
|
|
3
|
$self->exception("A node can only have one $type"); |
|
706
|
|
|
|
|
|
|
} |
|
707
|
1335
|
|
|
|
|
2883
|
$info->{ $type } = $p->{value}; |
|
708
|
|
|
|
|
|
|
} |
|
709
|
1163
|
|
|
|
|
3782
|
undef $properties; |
|
710
|
|
|
|
|
|
|
} |
|
711
|
|
|
|
|
|
|
} |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
sub scalar_event { |
|
714
|
49123
|
|
|
49123
|
0
|
60055
|
my ($self, $info) = @_; |
|
715
|
49123
|
|
|
|
|
65166
|
my $event_types = $self->events; |
|
716
|
49123
|
|
|
|
|
62947
|
my $event_stack = $self->event_stack; |
|
717
|
49123
|
100
|
66
|
|
|
80655
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
718
|
445
|
|
|
|
|
628
|
my $properties = pop @$event_stack; |
|
719
|
445
|
|
|
|
|
828
|
$properties = $self->node_properties($properties->[1], $info); |
|
720
|
|
|
|
|
|
|
} |
|
721
|
|
|
|
|
|
|
|
|
722
|
49122
|
|
|
|
|
68420
|
$info->{name} = 'scalar_event'; |
|
723
|
49122
|
|
|
|
|
73698
|
$self->callback->($self, 'scalar_event', $info); |
|
724
|
49113
|
|
|
|
|
121245
|
$self->set_new_node(0); |
|
725
|
49113
|
|
|
|
|
96439
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
726
|
|
|
|
|
|
|
} |
|
727
|
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
sub alias_event { |
|
729
|
556
|
|
|
556
|
0
|
852
|
my ($self, $info) = @_; |
|
730
|
556
|
|
|
|
|
842
|
my $event_stack = $self->event_stack; |
|
731
|
556
|
100
|
66
|
|
|
1253
|
if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { |
|
732
|
2
|
|
|
|
|
5
|
$self->exception("Parse error: Alias not allowed in this context"); |
|
733
|
|
|
|
|
|
|
} |
|
734
|
554
|
|
|
|
|
901
|
my $event_types = $self->events; |
|
735
|
554
|
|
|
|
|
945
|
$info->{name} = 'alias_event'; |
|
736
|
554
|
|
|
|
|
902
|
$self->callback->($self, 'alias_event', $info); |
|
737
|
551
|
|
|
|
|
1589
|
$self->set_new_node(0); |
|
738
|
551
|
|
|
|
|
1292
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
739
|
|
|
|
|
|
|
} |
|
740
|
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
sub yaml_to_tokens { |
|
742
|
5
|
|
|
5
|
0
|
227461
|
my ($class, $type, $input) = @_; |
|
743
|
5
|
|
|
38
|
|
26
|
my $yp = YAML::PP::Parser->new( receiver => sub {} ); |
|
744
|
5
|
|
|
|
|
24
|
my @docs = eval { |
|
745
|
5
|
50
|
|
|
|
17
|
$type eq 'string' ? $yp->parse_string($input) : $yp->parse_file($input); |
|
746
|
|
|
|
|
|
|
}; |
|
747
|
5
|
|
|
|
|
8
|
my $error = $@; |
|
748
|
|
|
|
|
|
|
|
|
749
|
5
|
|
|
|
|
6
|
my $tokens = $yp->tokens; |
|
750
|
5
|
100
|
|
|
|
14
|
if ($error) { |
|
751
|
1
|
|
|
|
|
4
|
my $remaining_tokens = $yp->_remaining_tokens; |
|
752
|
1
|
|
|
|
|
2
|
push @$tokens, map { +{ %$_, name => 'ERROR' } } @$remaining_tokens; |
|
|
1
|
|
|
|
|
5
|
|
|
753
|
|
|
|
|
|
|
} |
|
754
|
5
|
|
|
|
|
57
|
return $error, $tokens; |
|
755
|
|
|
|
|
|
|
} |
|
756
|
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
sub _remaining_tokens { |
|
758
|
1
|
|
|
1
|
|
2
|
my ($self) = @_; |
|
759
|
1
|
|
|
|
|
1
|
my @tokens; |
|
760
|
1
|
|
|
|
|
3
|
my $next = $self->lexer->next_tokens; |
|
761
|
1
|
|
|
|
|
3
|
push @tokens, @$next; |
|
762
|
1
|
|
|
|
|
1
|
my $next_line = $self->lexer->next_line; |
|
763
|
1
|
|
|
|
|
2
|
my $remaining = ''; |
|
764
|
1
|
50
|
|
|
|
7
|
if ($next_line) { |
|
765
|
1
|
50
|
|
|
|
2
|
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
|
|
|
|
|
3
|
$remaining .= $self->reader->read; |
|
773
|
1
|
50
|
|
|
|
3
|
$remaining = '' unless defined $remaining; |
|
774
|
1
|
|
|
|
|
3
|
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
|
1
|
my ($self) = @_; |
|
824
|
1
|
|
50
|
|
|
2
|
my $next_line = $self->lexer->next_line || []; |
|
825
|
1
|
|
|
|
|
2
|
my $line = $next_line->[0]; |
|
826
|
1
|
50
|
|
|
|
2
|
$line = '' unless defined $line; |
|
827
|
1
|
|
|
|
|
2
|
$line =~ s/( +)$/'·' x length $1/e; |
|
|
0
|
|
|
|
|
0
|
|
|
828
|
1
|
|
|
|
|
1
|
$line =~ s/\t/â–¸/g; |
|
829
|
1
|
|
|
|
|
4
|
$self->note("NEXT LINE: >>$line<<"); |
|
830
|
|
|
|
|
|
|
} |
|
831
|
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
sub note { |
|
833
|
1
|
|
|
1
|
0
|
2
|
my ($self, $msg) = @_; |
|
834
|
1
|
|
|
|
|
3
|
$self->_colorize_warn(["yellow"], "============ $msg"); |
|
835
|
|
|
|
|
|
|
} |
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
sub info { |
|
838
|
28
|
|
|
28
|
0
|
30
|
my ($self, $msg) = @_; |
|
839
|
28
|
|
|
|
|
51
|
$self->_colorize_warn(["cyan"], "============ $msg"); |
|
840
|
|
|
|
|
|
|
} |
|
841
|
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
sub got { |
|
843
|
14
|
|
|
14
|
0
|
17
|
my ($self, $msg) = @_; |
|
844
|
14
|
|
|
|
|
21
|
$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
|
63
|
|
|
63
|
0
|
167
|
my ($self, $msg, %args) = @_; |
|
920
|
63
|
|
|
|
|
138
|
my $next = $self->lexer->next_tokens; |
|
921
|
63
|
100
|
|
|
|
135
|
my $line = @$next ? $next->[0]->{line} : $self->lexer->line; |
|
922
|
63
|
100
|
|
|
|
120
|
my $offset = @$next ? $next->[0]->{column} : $self->lexer->offset; |
|
923
|
63
|
|
|
|
|
71
|
$offset++; |
|
924
|
63
|
|
|
|
|
91
|
my $next_line = $self->lexer->next_line; |
|
925
|
63
|
|
|
|
|
94
|
my $remaining = ''; |
|
926
|
63
|
100
|
|
|
|
117
|
if ($next_line) { |
|
927
|
38
|
100
|
|
|
|
56
|
if ($self->lexer->offset > 0) { |
|
928
|
36
|
|
|
|
|
72
|
$remaining = $next_line->[1] . $next_line->[2]; |
|
929
|
|
|
|
|
|
|
} |
|
930
|
|
|
|
|
|
|
else { |
|
931
|
2
|
|
|
|
|
6
|
$remaining = join '', @$next_line; |
|
932
|
|
|
|
|
|
|
} |
|
933
|
|
|
|
|
|
|
} |
|
934
|
63
|
|
100
|
|
|
246
|
my $caller = $args{caller} || [ caller(0) ]; |
|
935
|
|
|
|
|
|
|
my $e = YAML::PP::Exception->new( |
|
936
|
|
|
|
|
|
|
got => $args{got}, |
|
937
|
|
|
|
|
|
|
expected => $args{expected}, |
|
938
|
63
|
|
|
|
|
369
|
line => $line, |
|
939
|
|
|
|
|
|
|
column => $offset, |
|
940
|
|
|
|
|
|
|
msg => $msg, |
|
941
|
|
|
|
|
|
|
next => $next, |
|
942
|
|
|
|
|
|
|
where => $caller->[1] . ' line ' . $caller->[2], |
|
943
|
|
|
|
|
|
|
yaml => $remaining, |
|
944
|
|
|
|
|
|
|
); |
|
945
|
63
|
|
|
|
|
1525
|
croak $e; |
|
946
|
|
|
|
|
|
|
} |
|
947
|
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
sub expected { |
|
949
|
48
|
|
|
48
|
0
|
139
|
my ($self, %args) = @_; |
|
950
|
48
|
|
|
|
|
84
|
my $expected = $args{expected}; |
|
951
|
48
|
|
|
|
|
104
|
@$expected = sort grep { m/^[A-Z_]+$/ } @$expected; |
|
|
222
|
|
|
|
|
642
|
|
|
952
|
48
|
|
|
|
|
76
|
my $got = $args{got}->{name}; |
|
953
|
48
|
|
|
|
|
273
|
my @caller = caller(0); |
|
954
|
|
|
|
|
|
|
$self->exception("Expected (@$expected), but got $got", |
|
955
|
|
|
|
|
|
|
caller => \@caller, |
|
956
|
|
|
|
|
|
|
expected => $expected, |
|
957
|
|
|
|
|
|
|
got => $args{got}, |
|
958
|
48
|
|
|
|
|
231
|
); |
|
959
|
|
|
|
|
|
|
} |
|
960
|
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
sub cb_tag { |
|
962
|
2739
|
|
|
2739
|
0
|
4052
|
my ($self, $token) = @_; |
|
963
|
2739
|
|
|
|
|
4333
|
my $stack = $self->event_stack; |
|
964
|
2739
|
100
|
66
|
|
|
7392
|
if (! @$stack or $stack->[-1]->[0] ne 'properties') { |
|
965
|
2239
|
|
|
|
|
4574
|
push @$stack, [ properties => {} ]; |
|
966
|
|
|
|
|
|
|
} |
|
967
|
2739
|
|
|
|
|
3715
|
my $last = $stack->[-1]->[1]; |
|
968
|
2739
|
|
|
|
|
5376
|
my $tag = $self->_read_tag($token->{value}, $self->tagmap); |
|
969
|
2737
|
|
100
|
|
|
10748
|
$last->{inline} ||= []; |
|
970
|
2737
|
|
|
|
|
9710
|
push @{ $last->{inline} }, { |
|
971
|
|
|
|
|
|
|
type => 'tag', |
|
972
|
|
|
|
|
|
|
value => $tag, |
|
973
|
|
|
|
|
|
|
offset => $token->{column}, |
|
974
|
2737
|
|
|
|
|
3088
|
}; |
|
975
|
|
|
|
|
|
|
} |
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
sub _read_tag { |
|
978
|
2739
|
|
|
2739
|
|
4670
|
my ($self, $tag, $map) = @_; |
|
979
|
2739
|
100
|
|
|
|
15781
|
if ($tag eq '!') { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
980
|
75
|
|
|
|
|
152
|
return "!"; |
|
981
|
|
|
|
|
|
|
} |
|
982
|
|
|
|
|
|
|
elsif ($tag =~ m/^!<(.*)>/) { |
|
983
|
133
|
|
|
|
|
407
|
return $1; |
|
984
|
|
|
|
|
|
|
} |
|
985
|
|
|
|
|
|
|
elsif ($tag =~ m/^(![^!]*!|!)(.+)/) { |
|
986
|
2531
|
|
|
|
|
4581
|
my $alias = $1; |
|
987
|
2531
|
|
|
|
|
3515
|
my $name = $2; |
|
988
|
2531
|
|
|
|
|
4702
|
$name =~ s/%([0-9a-fA-F]{2})/chr hex $1/eg; |
|
|
18
|
|
|
|
|
100
|
|
|
989
|
2531
|
100
|
|
|
|
5147
|
if (exists $map->{ $alias }) { |
|
990
|
2299
|
|
|
|
|
6002
|
$tag = $map->{ $alias }. $name; |
|
991
|
|
|
|
|
|
|
} |
|
992
|
|
|
|
|
|
|
else { |
|
993
|
232
|
100
|
66
|
|
|
705
|
if ($alias ne '!' and $alias ne '!!') { |
|
994
|
2
|
|
|
|
|
30
|
die "Found undefined tag handle '$alias'"; |
|
995
|
|
|
|
|
|
|
} |
|
996
|
230
|
|
|
|
|
428
|
$tag = "!$name"; |
|
997
|
|
|
|
|
|
|
} |
|
998
|
|
|
|
|
|
|
} |
|
999
|
|
|
|
|
|
|
else { |
|
1000
|
0
|
|
|
|
|
0
|
die "Invalid tag"; |
|
1001
|
|
|
|
|
|
|
} |
|
1002
|
2529
|
|
|
|
|
4378
|
return $tag; |
|
1003
|
|
|
|
|
|
|
} |
|
1004
|
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
sub cb_anchor { |
|
1006
|
2093
|
|
|
2093
|
0
|
3183
|
my ($self, $token) = @_; |
|
1007
|
2093
|
|
|
|
|
3048
|
my $anchor = $token->{value}; |
|
1008
|
2093
|
|
|
|
|
4600
|
$anchor = substr($anchor, 1); |
|
1009
|
2093
|
|
|
|
|
3880
|
my $stack = $self->event_stack; |
|
1010
|
2093
|
100
|
66
|
|
|
5463
|
if (! @$stack or $stack->[-1]->[0] ne 'properties') { |
|
1011
|
1844
|
|
|
|
|
3759
|
push @$stack, [ properties => {} ]; |
|
1012
|
|
|
|
|
|
|
} |
|
1013
|
2093
|
|
|
|
|
2843
|
my $last = $stack->[-1]->[1]; |
|
1014
|
2093
|
|
100
|
|
|
7768
|
$last->{inline} ||= []; |
|
1015
|
2093
|
|
|
|
|
8201
|
push @{ $last->{inline} }, { |
|
1016
|
|
|
|
|
|
|
type => 'anchor', |
|
1017
|
|
|
|
|
|
|
value => $anchor, |
|
1018
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1019
|
2093
|
|
|
|
|
2398
|
}; |
|
1020
|
|
|
|
|
|
|
} |
|
1021
|
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
sub cb_property_eol { |
|
1023
|
1191
|
|
|
1191
|
0
|
1704
|
my ($self, $res) = @_; |
|
1024
|
1191
|
|
|
|
|
1711
|
my $stack = $self->event_stack; |
|
1025
|
1191
|
|
|
|
|
1567
|
my $last = $stack->[-1]->[1]; |
|
1026
|
1191
|
50
|
|
|
|
2628
|
my $inline = delete $last->{inline} or return; |
|
1027
|
1191
|
|
100
|
|
|
3508
|
my $newline = $last->{newline} ||= []; |
|
1028
|
1191
|
|
|
|
|
2429
|
push @$newline, @$inline; |
|
1029
|
|
|
|
|
|
|
} |
|
1030
|
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
sub cb_mapkey { |
|
1032
|
13172
|
|
|
13172
|
0
|
18135
|
my ($self, $token) = @_; |
|
1033
|
13172
|
|
|
|
|
19533
|
my $stack = $self->event_stack; |
|
1034
|
|
|
|
|
|
|
my $info = { |
|
1035
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1036
|
|
|
|
|
|
|
value => $token->{value}, |
|
1037
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1038
|
13172
|
|
|
|
|
37051
|
}; |
|
1039
|
13172
|
100
|
66
|
|
|
23696
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1040
|
72
|
|
|
|
|
163
|
$self->fetch_inline_properties($stack, $info); |
|
1041
|
|
|
|
|
|
|
} |
|
1042
|
13172
|
|
|
|
|
14050
|
push @{ $stack }, [ scalar => $info ]; |
|
|
13172
|
|
|
|
|
23830
|
|
|
1043
|
|
|
|
|
|
|
} |
|
1044
|
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
sub cb_send_mapkey { |
|
1046
|
13580
|
|
|
13580
|
0
|
17579
|
my ($self, $res) = @_; |
|
1047
|
13580
|
|
|
|
|
13185
|
my $last = pop @{ $self->event_stack }; |
|
|
13580
|
|
|
|
|
18169
|
|
|
1048
|
13580
|
|
|
|
|
29647
|
$self->scalar_event($last->[1]); |
|
1049
|
13580
|
|
|
|
|
19152
|
$self->set_new_node(1); |
|
1050
|
|
|
|
|
|
|
} |
|
1051
|
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
sub cb_send_scalar { |
|
1053
|
27330
|
|
|
27330
|
0
|
36078
|
my ($self, $res) = @_; |
|
1054
|
27330
|
|
|
|
|
28316
|
my $last = pop @{ $self->event_stack }; |
|
|
27330
|
|
|
|
|
35473
|
|
|
1055
|
27330
|
100
|
|
|
|
40703
|
return unless $last; |
|
1056
|
26591
|
|
|
|
|
54197
|
$self->scalar_event($last->[1]); |
|
1057
|
26581
|
|
|
|
|
35750
|
my $e = $self->events; |
|
1058
|
26581
|
100
|
|
|
|
70415
|
if ($e->[-1] eq 'IMAP') { |
|
1059
|
9
|
|
|
|
|
24
|
$self->end_flow_mapping; |
|
1060
|
|
|
|
|
|
|
} |
|
1061
|
|
|
|
|
|
|
} |
|
1062
|
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
sub cb_empty_mapkey { |
|
1064
|
113
|
|
|
113
|
0
|
198
|
my ($self, $token) = @_; |
|
1065
|
113
|
|
|
|
|
206
|
my $stack = $self->event_stack; |
|
1066
|
|
|
|
|
|
|
my $info = { |
|
1067
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1068
|
|
|
|
|
|
|
value => '', |
|
1069
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1070
|
113
|
|
|
|
|
443
|
}; |
|
1071
|
113
|
100
|
66
|
|
|
333
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1072
|
9
|
|
|
|
|
24
|
$self->fetch_inline_properties($stack, $info); |
|
1073
|
|
|
|
|
|
|
} |
|
1074
|
113
|
|
|
|
|
284
|
$self->scalar_event($info); |
|
1075
|
113
|
|
|
|
|
188
|
$self->set_new_node(1); |
|
1076
|
|
|
|
|
|
|
} |
|
1077
|
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
sub cb_send_flow_alias { |
|
1079
|
19
|
|
|
19
|
0
|
37
|
my ($self, $token) = @_; |
|
1080
|
19
|
|
|
|
|
43
|
my $alias = substr($token->{value}, 1); |
|
1081
|
19
|
|
|
|
|
57
|
$self->alias_event({ value => $alias }); |
|
1082
|
|
|
|
|
|
|
} |
|
1083
|
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
sub cb_send_alias { |
|
1085
|
295
|
|
|
295
|
0
|
492
|
my ($self, $token) = @_; |
|
1086
|
295
|
|
|
|
|
722
|
my $alias = substr($token->{value}, 1); |
|
1087
|
295
|
|
|
|
|
913
|
$self->alias_event({ value => $alias }); |
|
1088
|
|
|
|
|
|
|
} |
|
1089
|
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
sub cb_send_alias_key { |
|
1091
|
62
|
|
|
62
|
0
|
108
|
my ($self, $token) = @_; |
|
1092
|
62
|
|
|
|
|
133
|
my $alias = substr($token->{value}, 1); |
|
1093
|
62
|
|
|
|
|
213
|
$self->alias_event({ value => $alias }); |
|
1094
|
61
|
|
|
|
|
114
|
$self->set_new_node(1); |
|
1095
|
|
|
|
|
|
|
} |
|
1096
|
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
sub cb_send_alias_from_stack { |
|
1098
|
143
|
|
|
143
|
0
|
287
|
my ($self, $token) = @_; |
|
1099
|
143
|
|
|
|
|
193
|
my $last = pop @{ $self->event_stack }; |
|
|
143
|
|
|
|
|
235
|
|
|
1100
|
143
|
|
|
|
|
392
|
$self->alias_event($last->[1]); |
|
1101
|
|
|
|
|
|
|
} |
|
1102
|
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
sub cb_alias { |
|
1104
|
180
|
|
|
180
|
0
|
327
|
my ($self, $token) = @_; |
|
1105
|
180
|
|
|
|
|
381
|
my $alias = substr($token->{value}, 1); |
|
1106
|
180
|
|
|
|
|
314
|
push @{ $self->event_stack }, [ alias => { |
|
1107
|
|
|
|
|
|
|
value => $alias, |
|
1108
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1109
|
180
|
|
|
|
|
220
|
}]; |
|
1110
|
|
|
|
|
|
|
} |
|
1111
|
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
sub cb_question { |
|
1113
|
173
|
|
|
173
|
0
|
316
|
my ($self, $res) = @_; |
|
1114
|
173
|
|
|
|
|
375
|
$self->set_new_node(1); |
|
1115
|
|
|
|
|
|
|
} |
|
1116
|
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
sub cb_flow_question { |
|
1118
|
95
|
|
|
95
|
0
|
160
|
my ($self, $res) = @_; |
|
1119
|
95
|
|
|
|
|
211
|
$self->set_new_node(2); |
|
1120
|
|
|
|
|
|
|
} |
|
1121
|
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
sub cb_empty_complexvalue { |
|
1123
|
54
|
|
|
54
|
0
|
100
|
my ($self, $res) = @_; |
|
1124
|
54
|
|
|
|
|
196
|
$self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); |
|
1125
|
|
|
|
|
|
|
} |
|
1126
|
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
sub cb_questionstart { |
|
1128
|
339
|
|
|
339
|
0
|
606
|
my ($self, $token) = @_; |
|
1129
|
339
|
|
|
|
|
803
|
$self->start_mapping($token->{column}); |
|
1130
|
|
|
|
|
|
|
} |
|
1131
|
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
sub cb_complexcolon { |
|
1133
|
405
|
|
|
405
|
0
|
699
|
my ($self, $res) = @_; |
|
1134
|
405
|
|
|
|
|
818
|
$self->set_new_node(1); |
|
1135
|
|
|
|
|
|
|
} |
|
1136
|
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
sub cb_seqstart { |
|
1138
|
3258
|
|
|
3258
|
0
|
4631
|
my ($self, $token) = @_; |
|
1139
|
3258
|
|
|
|
|
4047
|
my $column = $token->{column}; |
|
1140
|
3258
|
|
|
|
|
7332
|
$self->start_sequence($column); |
|
1141
|
3258
|
|
|
|
|
8712
|
$self->set_new_node(1); |
|
1142
|
|
|
|
|
|
|
} |
|
1143
|
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
sub cb_seqitem { |
|
1145
|
4287
|
|
|
4287
|
0
|
5935
|
my ($self, $res) = @_; |
|
1146
|
4287
|
|
|
|
|
7199
|
$self->set_new_node(1); |
|
1147
|
|
|
|
|
|
|
} |
|
1148
|
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
sub cb_take_quoted { |
|
1150
|
4055
|
|
|
4055
|
0
|
5496
|
my ($self, $token) = @_; |
|
1151
|
4055
|
|
|
|
|
4700
|
my $subtokens = $token->{subtokens}; |
|
1152
|
4055
|
|
|
|
|
6292
|
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
|
4055
|
100
|
|
|
|
14602
|
}; |
|
1160
|
4055
|
100
|
66
|
|
|
8026
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1161
|
236
|
|
|
|
|
507
|
$self->fetch_inline_properties($stack, $info); |
|
1162
|
|
|
|
|
|
|
} |
|
1163
|
4055
|
|
|
|
|
4398
|
push @{ $stack }, [ scalar => $info ]; |
|
|
4055
|
|
|
|
|
8440
|
|
|
1164
|
|
|
|
|
|
|
} |
|
1165
|
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
sub cb_quoted_multiline { |
|
1167
|
489
|
|
|
489
|
0
|
832
|
my ($self, $token) = @_; |
|
1168
|
489
|
|
|
|
|
678
|
my $subtokens = $token->{subtokens}; |
|
1169
|
489
|
|
|
|
|
827
|
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
|
489
|
100
|
|
|
|
2197
|
}; |
|
1177
|
489
|
100
|
66
|
|
|
1278
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1178
|
16
|
|
|
|
|
46
|
$self->fetch_inline_properties($stack, $info); |
|
1179
|
|
|
|
|
|
|
} |
|
1180
|
489
|
|
|
|
|
601
|
push @{ $stack }, [ scalar => $info ]; |
|
|
489
|
|
|
|
|
960
|
|
|
1181
|
489
|
|
|
|
|
972
|
$self->cb_send_scalar; |
|
1182
|
|
|
|
|
|
|
} |
|
1183
|
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
sub cb_take_quoted_key { |
|
1185
|
412
|
|
|
412
|
0
|
595
|
my ($self, $token) = @_; |
|
1186
|
412
|
|
|
|
|
926
|
$self->cb_take_quoted($token); |
|
1187
|
412
|
|
|
|
|
797
|
$self->cb_send_mapkey; |
|
1188
|
|
|
|
|
|
|
} |
|
1189
|
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
sub cb_send_plain_multi { |
|
1191
|
241
|
|
|
241
|
0
|
412
|
my ($self, $token) = @_; |
|
1192
|
241
|
|
|
|
|
466
|
my $stack = $self->event_stack; |
|
1193
|
|
|
|
|
|
|
my $info = { |
|
1194
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1195
|
|
|
|
|
|
|
value => $token->{value}, |
|
1196
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1197
|
241
|
|
|
|
|
909
|
}; |
|
1198
|
241
|
100
|
66
|
|
|
658
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1199
|
9
|
|
|
|
|
23
|
$self->fetch_inline_properties($stack, $info); |
|
1200
|
|
|
|
|
|
|
} |
|
1201
|
241
|
|
|
|
|
315
|
push @{ $stack }, [ scalar => $info ]; |
|
|
241
|
|
|
|
|
543
|
|
|
1202
|
241
|
|
|
|
|
1922
|
$self->cb_send_scalar; |
|
1203
|
|
|
|
|
|
|
} |
|
1204
|
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
sub cb_start_plain { |
|
1206
|
25412
|
|
|
25412
|
0
|
32266
|
my ($self, $token) = @_; |
|
1207
|
25412
|
|
|
|
|
39104
|
my $stack = $self->event_stack; |
|
1208
|
|
|
|
|
|
|
my $info = { |
|
1209
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1210
|
|
|
|
|
|
|
value => $token->{value}, |
|
1211
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1212
|
25412
|
|
|
|
|
69240
|
}; |
|
1213
|
25412
|
100
|
66
|
|
|
49790
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1214
|
2216
|
|
|
|
|
4658
|
$self->fetch_inline_properties($stack, $info); |
|
1215
|
|
|
|
|
|
|
} |
|
1216
|
25412
|
|
|
|
|
26562
|
push @{ $stack }, [ scalar => $info ]; |
|
|
25412
|
|
|
|
|
46562
|
|
|
1217
|
|
|
|
|
|
|
} |
|
1218
|
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
sub cb_start_flowseq { |
|
1220
|
1440
|
|
|
1440
|
0
|
2108
|
my ($self, $token) = @_; |
|
1221
|
1440
|
|
|
|
|
3342
|
$self->start_flow_sequence($token->{column}); |
|
1222
|
|
|
|
|
|
|
} |
|
1223
|
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
sub cb_start_flowmap { |
|
1225
|
1210
|
|
|
1210
|
0
|
1866
|
my ($self, $token) = @_; |
|
1226
|
1210
|
|
|
|
|
2973
|
$self->start_flow_mapping($token->{column}); |
|
1227
|
|
|
|
|
|
|
} |
|
1228
|
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
sub cb_end_flowseq { |
|
1230
|
1416
|
|
|
1416
|
0
|
2204
|
my ($self, $res) = @_; |
|
1231
|
1416
|
|
|
|
|
2863
|
$self->cb_send_scalar; |
|
1232
|
1416
|
|
|
|
|
3262
|
$self->end_flow_sequence; |
|
1233
|
1416
|
|
|
|
|
2218
|
$self->set_new_node(0); |
|
1234
|
|
|
|
|
|
|
} |
|
1235
|
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
sub cb_flow_comma { |
|
1237
|
2445
|
|
|
2445
|
0
|
3480
|
my ($self) = @_; |
|
1238
|
2445
|
|
|
|
|
3789
|
my $event_types = $self->events; |
|
1239
|
2445
|
|
|
|
|
5922
|
$self->set_new_node(0); |
|
1240
|
2445
|
100
|
|
|
|
6619
|
if ($event_types->[-1] =~ m/^FLOWSEQ/) { |
|
1241
|
1752
|
|
|
|
|
3704
|
$self->cb_send_scalar; |
|
1242
|
1752
|
|
|
|
|
3027
|
$event_types->[-1] = $next_event{ $event_types->[-1] }; |
|
1243
|
|
|
|
|
|
|
} |
|
1244
|
|
|
|
|
|
|
} |
|
1245
|
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
sub cb_flow_colon { |
|
1247
|
1218
|
|
|
1218
|
0
|
2039
|
my ($self) = @_; |
|
1248
|
1218
|
|
|
|
|
1755
|
$self->set_new_node(1); |
|
1249
|
|
|
|
|
|
|
} |
|
1250
|
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
sub cb_empty_flow_mapkey { |
|
1252
|
412
|
|
|
412
|
0
|
560
|
my ($self, $token) = @_; |
|
1253
|
412
|
|
|
|
|
629
|
my $stack = $self->event_stack; |
|
1254
|
|
|
|
|
|
|
my $info = { |
|
1255
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1256
|
|
|
|
|
|
|
value => '', |
|
1257
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1258
|
412
|
|
|
|
|
1974
|
}; |
|
1259
|
412
|
100
|
66
|
|
|
1309
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1260
|
247
|
|
|
|
|
506
|
$self->fetch_inline_properties($stack, $info); |
|
1261
|
|
|
|
|
|
|
} |
|
1262
|
412
|
|
|
|
|
896
|
$self->scalar_event($info); |
|
1263
|
|
|
|
|
|
|
} |
|
1264
|
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
sub cb_end_flowmap { |
|
1266
|
1087
|
|
|
1087
|
0
|
1785
|
my ($self, $res) = @_; |
|
1267
|
1087
|
|
|
|
|
2588
|
$self->end_flow_mapping; |
|
1268
|
1079
|
|
|
|
|
1577
|
$self->set_new_node(0); |
|
1269
|
|
|
|
|
|
|
} |
|
1270
|
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
sub cb_end_flowmap_empty { |
|
1272
|
109
|
|
|
109
|
0
|
207
|
my ($self, $res) = @_; |
|
1273
|
109
|
|
|
|
|
293
|
$self->cb_empty_flowmap_value; |
|
1274
|
109
|
|
|
|
|
254
|
$self->end_flow_mapping; |
|
1275
|
109
|
|
|
|
|
187
|
$self->set_new_node(0); |
|
1276
|
|
|
|
|
|
|
} |
|
1277
|
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
sub cb_flowkey_plain { |
|
1279
|
1025
|
|
|
1025
|
0
|
1512
|
my ($self, $token) = @_; |
|
1280
|
1025
|
|
|
|
|
1953
|
my $stack = $self->event_stack; |
|
1281
|
|
|
|
|
|
|
my $info = { |
|
1282
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1283
|
|
|
|
|
|
|
value => $token->{value}, |
|
1284
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1285
|
1025
|
|
|
|
|
3431
|
}; |
|
1286
|
1025
|
100
|
66
|
|
|
2415
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1287
|
21
|
|
|
|
|
43
|
$self->fetch_inline_properties($stack, $info); |
|
1288
|
|
|
|
|
|
|
} |
|
1289
|
1025
|
|
|
|
|
2102
|
$self->scalar_event($info); |
|
1290
|
|
|
|
|
|
|
} |
|
1291
|
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
sub cb_flowkey_quoted { |
|
1293
|
162
|
|
|
162
|
0
|
258
|
my ($self, $token) = @_; |
|
1294
|
162
|
|
|
|
|
293
|
my $stack = $self->event_stack; |
|
1295
|
162
|
|
|
|
|
241
|
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
|
162
|
100
|
|
|
|
712
|
}; |
|
1303
|
162
|
100
|
66
|
|
|
420
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1304
|
2
|
|
|
|
|
6
|
$self->fetch_inline_properties($stack, $info); |
|
1305
|
|
|
|
|
|
|
} |
|
1306
|
162
|
|
|
|
|
335
|
$self->scalar_event($info); |
|
1307
|
|
|
|
|
|
|
} |
|
1308
|
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
sub cb_empty_flowmap_key_value { |
|
1310
|
136
|
|
|
136
|
0
|
211
|
my ($self, $token) = @_; |
|
1311
|
136
|
|
|
|
|
338
|
$self->cb_empty_flow_mapkey($token); |
|
1312
|
136
|
|
|
|
|
303
|
$self->cb_empty_flowmap_value; |
|
1313
|
136
|
|
|
|
|
238
|
$self->cb_flow_comma; |
|
1314
|
|
|
|
|
|
|
} |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
sub cb_end_empty_flowmap_key_value { |
|
1317
|
125
|
|
|
125
|
0
|
205
|
my ($self, $token) = @_; |
|
1318
|
125
|
|
|
|
|
336
|
$self->cb_empty_flow_mapkey($token); |
|
1319
|
125
|
|
|
|
|
284
|
$self->cb_empty_flowmap_value; |
|
1320
|
125
|
|
|
|
|
243
|
$self->cb_flow_comma; |
|
1321
|
125
|
|
|
|
|
207
|
$self->cb_end_flowmap; |
|
1322
|
|
|
|
|
|
|
} |
|
1323
|
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
sub cb_empty_flowmap_value { |
|
1325
|
577
|
|
|
577
|
0
|
855
|
my ($self, $token) = @_; |
|
1326
|
577
|
|
|
|
|
924
|
my $stack = $self->event_stack; |
|
1327
|
|
|
|
|
|
|
my $info = { |
|
1328
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1329
|
|
|
|
|
|
|
value => '', |
|
1330
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1331
|
577
|
|
|
|
|
1572
|
}; |
|
1332
|
577
|
100
|
66
|
|
|
1563
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1333
|
167
|
|
|
|
|
649
|
$self->fetch_inline_properties($stack, $info); |
|
1334
|
|
|
|
|
|
|
} |
|
1335
|
577
|
|
|
|
|
987
|
$self->scalar_event($info); |
|
1336
|
|
|
|
|
|
|
} |
|
1337
|
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
sub cb_empty_flowseq_comma { |
|
1339
|
90
|
|
|
90
|
0
|
128
|
my ($self, $token) = @_; |
|
1340
|
90
|
|
|
|
|
195
|
$self->cb_empty_flowmap_value($token); |
|
1341
|
90
|
|
|
|
|
165
|
$self->cb_flow_comma; |
|
1342
|
|
|
|
|
|
|
} |
|
1343
|
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
sub cb_empty_flowseq_end { |
|
1345
|
72
|
|
|
72
|
0
|
97
|
my ($self, $token) = @_; |
|
1346
|
72
|
|
|
|
|
167
|
$self->cb_empty_flowmap_value($token); |
|
1347
|
72
|
|
|
|
|
166
|
$self->cb_end_flowseq; |
|
1348
|
|
|
|
|
|
|
} |
|
1349
|
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
sub cb_insert_map_alias { |
|
1351
|
37
|
|
|
37
|
0
|
55
|
my ($self, $res) = @_; |
|
1352
|
37
|
|
|
|
|
58
|
my $stack = $self->event_stack; |
|
1353
|
37
|
|
|
|
|
52
|
my $scalar = pop @$stack; |
|
1354
|
37
|
|
|
|
|
43
|
my $info = $scalar->[1]; |
|
1355
|
37
|
|
|
|
|
88
|
$self->start_mapping($info->{offset}); |
|
1356
|
37
|
|
|
|
|
142
|
$self->alias_event($info); |
|
1357
|
37
|
|
|
|
|
57
|
$self->set_new_node(1); |
|
1358
|
|
|
|
|
|
|
} |
|
1359
|
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
sub cb_insert_map { |
|
1361
|
4894
|
|
|
4894
|
0
|
6475
|
my ($self, $res) = @_; |
|
1362
|
4894
|
|
|
|
|
7032
|
my $stack = $self->event_stack; |
|
1363
|
4894
|
|
|
|
|
6174
|
my $scalar = pop @$stack; |
|
1364
|
4894
|
|
|
|
|
5937
|
my $info = $scalar->[1]; |
|
1365
|
4894
|
|
|
|
|
11751
|
$self->start_mapping($info->{offset}); |
|
1366
|
4894
|
|
|
|
|
15439
|
$self->scalar_event($info); |
|
1367
|
4894
|
|
|
|
|
7040
|
$self->set_new_node(1); |
|
1368
|
|
|
|
|
|
|
} |
|
1369
|
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
sub cb_insert_implicit_flowseq_map { |
|
1371
|
7
|
|
|
7
|
0
|
18
|
my ($self, $res) = @_; |
|
1372
|
7
|
|
|
|
|
15
|
my $stack = $self->event_stack; |
|
1373
|
7
|
|
|
|
|
16
|
my $scalar = pop @$stack; |
|
1374
|
7
|
|
|
|
|
13
|
my $info = $scalar->[1]; |
|
1375
|
7
|
|
|
|
|
24
|
$self->start_flow_mapping($info->{offset}, 1); |
|
1376
|
7
|
|
|
|
|
22
|
$self->scalar_event($info); |
|
1377
|
7
|
|
|
|
|
16
|
$self->set_new_node(1); |
|
1378
|
|
|
|
|
|
|
} |
|
1379
|
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
sub cb_insert_empty_implicit_flowseq_map { |
|
1381
|
2
|
|
|
2
|
0
|
4
|
my ($self, $res) = @_; |
|
1382
|
2
|
|
|
|
|
4
|
my $stack = $self->event_stack; |
|
1383
|
2
|
|
|
|
|
4
|
my $scalar = pop @$stack; |
|
1384
|
2
|
|
|
|
|
4
|
my $info = $scalar->[1]; |
|
1385
|
2
|
|
|
|
|
6
|
$self->start_flow_mapping($info->{offset}, 1); |
|
1386
|
2
|
|
|
|
|
8
|
$self->cb_empty_flowmap_value; |
|
1387
|
2
|
|
|
|
|
4
|
$self->set_new_node(2); |
|
1388
|
|
|
|
|
|
|
} |
|
1389
|
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
sub cb_insert_empty_map { |
|
1391
|
430
|
|
|
430
|
0
|
815
|
my ($self, $token) = @_; |
|
1392
|
430
|
|
|
|
|
814
|
my $stack = $self->event_stack; |
|
1393
|
|
|
|
|
|
|
my $info = { |
|
1394
|
|
|
|
|
|
|
style => YAML_PLAIN_SCALAR_STYLE, |
|
1395
|
|
|
|
|
|
|
value => '', |
|
1396
|
|
|
|
|
|
|
offset => $token->{column}, |
|
1397
|
430
|
|
|
|
|
1359
|
}; |
|
1398
|
430
|
100
|
66
|
|
|
1615
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1399
|
248
|
|
|
|
|
573
|
$self->fetch_inline_properties($stack, $info); |
|
1400
|
|
|
|
|
|
|
} |
|
1401
|
430
|
|
|
|
|
1142
|
$self->start_mapping($info->{offset}); |
|
1402
|
430
|
|
|
|
|
1482
|
$self->scalar_event($info); |
|
1403
|
430
|
|
|
|
|
811
|
$self->set_new_node(1); |
|
1404
|
|
|
|
|
|
|
} |
|
1405
|
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
sub cb_send_block_scalar { |
|
1407
|
1712
|
|
|
1712
|
0
|
2630
|
my ($self, $token) = @_; |
|
1408
|
1712
|
|
|
|
|
2819
|
my $type = $token->{subtokens}->[0]->{value}; |
|
1409
|
1712
|
|
|
|
|
3011
|
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
|
1712
|
100
|
|
|
|
6485
|
}; |
|
1417
|
1712
|
100
|
66
|
|
|
4091
|
if (@$stack and $stack->[-1]->[0] eq 'properties') { |
|
1418
|
82
|
|
|
|
|
233
|
$self->fetch_inline_properties($stack, $info); |
|
1419
|
|
|
|
|
|
|
} |
|
1420
|
1712
|
|
|
|
|
1994
|
push @{ $self->event_stack }, [ scalar => $info ]; |
|
|
1712
|
|
|
|
|
2421
|
|
|
1421
|
1712
|
|
|
|
|
3565
|
$self->cb_send_scalar; |
|
1422
|
|
|
|
|
|
|
} |
|
1423
|
|
|
|
|
|
|
|
|
1424
|
|
|
|
|
|
|
sub cb_end_document { |
|
1425
|
585
|
|
|
585
|
0
|
931
|
my ($self, $token) = @_; |
|
1426
|
585
|
|
|
|
|
1243
|
$self->end_document(0); |
|
1427
|
|
|
|
|
|
|
} |
|
1428
|
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
sub cb_end_document_empty { |
|
1430
|
30
|
|
|
30
|
0
|
65
|
my ($self, $token) = @_; |
|
1431
|
30
|
|
|
|
|
81
|
$self->end_document(0); |
|
1432
|
|
|
|
|
|
|
} |
|
1433
|
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
sub cb_doc_start_implicit { |
|
1435
|
3975
|
|
|
3975
|
0
|
6722
|
my ($self, $token) = @_; |
|
1436
|
3975
|
|
|
|
|
7498
|
$self->start_document(1); |
|
1437
|
|
|
|
|
|
|
} |
|
1438
|
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
sub cb_doc_start_explicit { |
|
1440
|
3817
|
|
|
3817
|
0
|
5446
|
my ($self, $token) = @_; |
|
1441
|
3817
|
|
|
|
|
7149
|
$self->start_document(0); |
|
1442
|
|
|
|
|
|
|
} |
|
1443
|
|
|
|
|
|
|
|
|
1444
|
|
|
|
|
|
|
sub cb_end_doc_start_document { |
|
1445
|
527
|
|
|
527
|
0
|
756
|
my ($self, $token) = @_; |
|
1446
|
527
|
|
|
|
|
1240
|
$self->end_document(1); |
|
1447
|
524
|
|
|
|
|
935
|
$self->start_document(0); |
|
1448
|
|
|
|
|
|
|
} |
|
1449
|
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
sub cb_tag_directive { |
|
1451
|
117
|
|
|
117
|
0
|
238
|
my ($self, $token) = @_; |
|
1452
|
117
|
|
|
|
|
501
|
my ($name, $tag_alias, $tag_url) = split ' ', $token->{value}; |
|
1453
|
117
|
|
|
|
|
279
|
$self->tagmap->{ $tag_alias } = $tag_url; |
|
1454
|
|
|
|
|
|
|
} |
|
1455
|
|
|
|
|
|
|
|
|
1456
|
|
|
|
45
|
0
|
|
sub cb_reserved_directive { |
|
1457
|
|
|
|
|
|
|
} |
|
1458
|
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
sub cb_set_yaml_version_directive { |
|
1460
|
159
|
|
|
159
|
0
|
286
|
my ($self, $token) = @_; |
|
1461
|
159
|
100
|
|
|
|
292
|
if ($self->yaml_version_directive) { |
|
1462
|
1
|
|
|
|
|
110
|
croak "Found duplicate YAML directive"; |
|
1463
|
|
|
|
|
|
|
} |
|
1464
|
158
|
|
|
|
|
713
|
my ($version) = $token->{value} =~ m/^%YAML[ \t]+(1\.[12])/; |
|
1465
|
158
|
|
100
|
|
|
519
|
$self->set_yaml_version($version || '1.2'); |
|
1466
|
158
|
|
|
|
|
286
|
$self->set_yaml_version_directive(1); |
|
1467
|
|
|
|
|
|
|
} |
|
1468
|
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
1; |