blib/lib/YAML/Parser.pm

filter: Statementstmt 70.9% 1171 / 1650 Branchbran 55.3% 166 / 300 Conditioncond 56.9% 82 / 144 MC/DCmcdc 29.4% 25 / 85 Subroutinesub 66.4% 277 / 417 Podpod 0.0% 0 / 70 totaltotal 64.5% 1721 / 2666 CC 205 SCAR 28.8
CC
205
Cov
68%
trace
420.0
got__c_ns_tag_property
56.0
cache_get
20.0
CRAP 17.7
↑ Summary
1 # This module was GENERATED!
2 #
3 # By https://github.com/ingydotnet/yaml-parser-pm
4  
5 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 package YAML::Parser;
7  
8 2 our $VERSION = '0.0.4';
9  
10 2 ▶use XXX;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub new {
13 2 ▶ my ($class, %self) = @_;
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
14  
15 2 my $self = bless {
16 %self,
17 }, $class;
18  
19 2 ▶ if (not defined $self->{receiver}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"receiver"}) 1 1 2
20 1 $self->{events} = [];
21 $self->{receiver} = PerlYamlReferenceParserReceiver->new(
22 callback => sub {
23 13 ▶ my ($event) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
24 13 push @{$self->{events}}, $event;
25 },
26 1 );
27 }
28  
29 2 return $self;
30 }
31  
32 sub parse {
33 2 ▶ my ($self, $yaml_string) = @_;
Subroutine parse: called CC=1 SCAR=0.0
Pod undocumented
34 $self->{parser} = PerlYamlReferenceParserParser->new(
35 $self->{receiver},
36 2 );
37 2 $self->{parser}->parse($yaml_string);
38 2 return $self;
39 }
40  
41 sub receiver {
42 1 ▶ my ($self) = @_;
Subroutine receiver: called CC=1 SCAR=0.0
Pod undocumented
43 1 return $self->{parser}{receiver};
44 }
45  
46 sub events {
47 1 ▶ my ($self) = @_;
Subroutine events: called CC=1 SCAR=0.0
Pod undocumented
48 1 return @{$self->{events}};
49 }
50  
51 BEGIN {
52 2 ▶ $INC{'PerlYamlReferenceParserParser.pm'} = __FILE__;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 2 $INC{'PerlYamlReferenceParserGrammar.pm'} = __FILE__;
54 2 $INC{'PerlYamlReferenceParserPrelude.pm'} = __FILE__;
55 };
56  
57 2 1;
58  
59 ### INCLUDE code from yaml-reference-parser/perl/lib/
60  
61 BEGIN {
62  
63 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
64  
65 package PerlYamlReferenceParserFunc;
66 use overload
67 104 ▶ eq => sub { 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
68 2 ▶ bool => sub { 1 };
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: not called CC=1 SCAR=0.2
69 sub new {
70 9184 ▶ my ($class, $func, $name, $trace, $num) = @_;
Subroutine new: called CC=2 SCAR=7.1
71 9184 ▶ bless {
Condition66%2/3
$trace || $name
l!l&&r!l&&!r
309660880
MC/DC0%0/2
$trace || $name
$trace $name
Truth table66%2/3
A || B
A= $traceB= $name
ABresult
1X1
011
000
72 func => $func,
73 name => $name,
74 trace => $trace || $name,
75 num => $num,
76 receivers => undef,
77 }, $class;
78 }
79 0 ▶sub TO_JSON { $_[0]->{func} }
Subroutine TO_JSON: not called CC=1 SCAR=6.9
80  
81 package PerlYamlReferenceParserPrelude;
82  
83 2 ▶use boolean;
Subroutine BEGIN: called CC=1 SCAR=0.0
84 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
85 2 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
86 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
87 2 ▶use JSON::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
88 2 ▶use Time::HiRes qw< gettimeofday tv_interval >;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 2 ▶use YAML::PP::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 2 ▶use XXX;
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 2 ▶use constant DEBUG => $ENV{DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 2 ▶our @EXPORT;
Subroutine BEGIN: called CC=1 SCAR=0.2
95 30 ▶sub export { push @EXPORT, @_ }
Subroutine export: called CC=1 SCAR=0.0
Pod undocumented
96  
97 2 export qw< true false >;
98  
99 2 export 'rule';
100 sub rule {
101 424 ▶ my ($num, $name, $func) = @_;
Subroutine rule: called CC=1 SCAR=0.0
Pod undocumented
102 424 my ($pkg) = caller;
103 {
104 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
105 424 *{"${pkg}::$name"} = $func;
106 }
107 424 $func = name($name, $func);
108 424 $func->{num} = $num;
109 424 return $func;
110 }
111  
112 2 export 'name';
113 sub name {
114 5526 ▶ my ($name, $func, $trace) = (@_, '');
Subroutine name: called CC=1 SCAR=1.2
Pod undocumented
115 5526 my $f = $func;
116 5526 if (DEBUG) {
117 $f = sub {
118 0 ▶ my ($n, @args) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
119 0 my $args = join ',', map stringify($_), @args;
120 0 debug("$name($args)");
121 0 goto $func;
122 }
123 }
124 5526 return PerlYamlReferenceParserFunc->new($f, $name, $trace);
125 }
126  
127 2 export qw<isNull isBoolean isNumber isString isFunction isArray isObject>;
128 6478 ▶sub isNull { not defined $_[0] }
Subroutine isNull: called CC=1 SCAR=0.0
Pod undocumented
129 6488 ▶sub isBoolean { ref($_[0]) eq 'boolean' }
Subroutine isBoolean: called CC=1 SCAR=0.0
Pod undocumented
130 6558 ▶sub isNumber { not(ref $_[0]) and $_[0] =~ /^-?\d+$/ }
Subroutine isNumber: called CC=2 SCAR=6.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
not ref $_[0] and $_[0] =~ /^-?\d+$/u 68 6490 6558
131 9178 ▶sub isString { not(ref $_[0]) and $_[0] !~ /^-?\d+$/ }
Subroutine isString: called CC=2 SCAR=6.9
Pod undocumented
Condition100%3/3
ref $_[0] || $_[0] =~ /^-?\d+$/u
l!l&&r!l&&!r
6490502638
MC/DC100%2/2
ref $_[0] || $_[0] =~ /^-?\d+$/u
ref $_[0] $_[0] =~ /^-?\d+$/u
Truth table100%3/3
A || B
A= ref $_[0]B= $_[0] =~ /^-?\d+$/u
ABresult
1X1
011
000
132 19128 ▶sub isFunction { ref($_[0]) eq 'PerlYamlReferenceParserFunc' }
Subroutine isFunction: called CC=1 SCAR=0.0
Pod undocumented
133 16494 ▶sub isArray { ref($_[0]) eq 'ARRAY' }
Subroutine isArray: called CC=1 SCAR=0.0
Pod undocumented
134 2798 ▶sub isObject { ref($_[0]) eq 'HASH' }
Subroutine isObject: called CC=1 SCAR=0.0
Pod undocumented
135  
136 2 export 'typeof';
137 sub typeof {
138 6478 ▶ my ($value) = @_;
Subroutine typeof: called CC=8 SCAR=28.4
Pod undocumented
139 6478 ▶ return 'null' if isNull $value;
Branch: 1 branch
BranchTrueFalseTotal
if isNull($value) 0 6478 6478
140 6478 ▶ return 'boolean' if isBoolean $value;
Branch: 1 branch
BranchTrueFalseTotal
if isBoolean($value) 6460 18 6478
141 18 ▶ return 'number' if isNumber $value;
Branch: 1 branch
BranchTrueFalseTotal
if isNumber($value) 12 6 18
142 6 ▶ return 'string' if isString $value;
Branch: 1 branch
BranchTrueFalseTotal
if isString($value) 6 0 6
143 0 ▶ return 'function' if isFunction $value;
Branch: 1 branch
BranchTrueFalseTotal
if isFunction($value) 0 0 0
144 0 ▶ return 'array' if isArray $value;
Branch: 1 branch
BranchTrueFalseTotal
if isArray($value) 0 0 0
145 0 ▶ return 'object' if isObject $value;
Branch: 1 branch
BranchTrueFalseTotal
if isObject($value) 0 0 0
146 0 XXX [$value, ref($value)];
147 }
148  
149 2 my $json = JSON::PP->new->canonical->allow_unknown->allow_nonref->convert_blessed;
150 sub json_stringify {
151 2752 ▶ my $string;
Subroutine json_stringify: called CC=2 SCAR=7.0
Pod undocumented
152 2752 eval {
153 2752 $string = $json->encode($_[0]);
154 };
155 2752 ▶ confess $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2752 2752
156 2752 return $string;
157 }
158  
159 2 export 'stringify';
160 sub stringify;
161 sub stringify {
162 2982 ▶ my ($o) = @_;
Subroutine stringify: called CC=6 SCAR=17.9
Pod undocumented
163 2982 ▶ if ($o eq "\x{feff}") {
Branch: 1 branch
BranchTrueFalseTotal
if ($o eq "\x{feff}") 80 2902 2982
164 80 return "\\uFEFF";
165 }
166 2902 ▶ if (isFunction $o) {
Branch: 1 branch
BranchTrueFalseTotal
if (isFunction($o)) 104 2798 2902
167 104 return "\@$o->{trace}";
168 }
169 2798 ▶ if (isObject $o) {
Branch: 1 branch
BranchTrueFalseTotal
if (isObject($o)) 72 2726 2798
170 72 return json_stringify [ sort keys %$o ];
171 }
172 2726 ▶ if (isArray $o) {
Branch: 1 branch
BranchTrueFalseTotal
if (isArray($o)) 46 2680 2726
173 46 return "[${\ join ',', map stringify($_), @$o}]";
174 }
175 2680 ▶ if (isString $o) {
Branch: 1 branch
BranchTrueFalseTotal
if (isString($o)) 2630 50 2680
176 2630 $_ = json_stringify $o;
177 2630 s/^"(.*)"$/$1/;
178 2630 return $_;
179 }
180 50 return json_stringify $o;
181 }
182  
183 2 export 'hex_char';
184 sub hex_char {
185 788 ▶ my ($chr) = @_;
Subroutine hex_char: called CC=1 SCAR=0.0
Pod undocumented
186 788 return sprintf "x%x", ord $chr;
187 }
188  
189 2 export 'func';
190 sub func {
191 3658 ▶ my ($self, $name) = @_;
Subroutine func: called CC=2 SCAR=7.1
Pod undocumented
192 3658 ▶ my $func = $self->can($name) or
Branch: 1 branch
BranchTrueFalseTotal
my $func = $self->can($name) or die "Can't find parser function '${name}'" 0 3658 3658
193 die "Can't find parser function '$name'";
194 3658 PerlYamlReferenceParserFunc->new($func, $name);
195 }
196  
197 2 export 'file_read';
198 sub file_read {
199 0 ▶ decode_utf8(do { local $/; <> });
Subroutine file_read: not called CC=1 SCAR=6.9
Pod undocumented
200 }
201  
202 2 export 'debug';
203 sub debug {
204 0 ▶ my ($msg) = @_;
Subroutine debug: not called CC=1 SCAR=6.9
Pod undocumented
205 0 warn ">>> $msg\n";
206 }
207  
208 2 export 'debug_rule';
209 sub debug_rule {
210 0 ▶ my ($name, @args) = @_;
Subroutine debug_rule: not called CC=1 SCAR=6.9
Pod undocumented
211 0 my $args = join ',', map stringify($_), @args;
212 0 debug "$name($args)";
213 }
214  
215 2 export qw< WWW XXX YYY ZZZ www xxx yyy zzz >;
216 2 *www = \&www;
217 2 *xxx = \&xxx;
218 2 *yyy = \&yyy;
219 2 *zzz = \&zzz;
220  
221 2 export 'dump';
222 sub dump {
223 0 ▶ YAML::PP::Perl->new->dump(@_);
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
224 }
225  
226 2 export 'FAIL';
227 sub FAIL {
228 0 ▶ WWW [@_];
Subroutine FAIL: not called CC=2 SCAR=17.9
Pod undocumented
229 0 ▶ confess "FAIL '${\ $_[0] // '???'}'";
Condition0%0/2
\$_[0] // "???"
l!l
00
MC/DC0%0/1
\$_[0] // "???"
\$_[0]
Truth table0%0/2
A
A= \$_[0]
Aresult
11
00
230 }
231  
232 2 export 'timer';
233 sub timer {
234 0 ▶ if (@_) {
Subroutine timer: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
235 0 tv_interval(shift);
236 }
237 else {
238 0 [gettimeofday];
239 }
240 }
241  
242 2 1;
243  
244 # vim: sw=2:
245 }
246  
247  
248 ###
249 # This grammar class was generated from https://yaml.org/spec/1.2/spec.html
250 ###
251  
252 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
253 package PerlYamlReferenceParserGrammar;
254 2 ▶use PerlYamlReferenceParserPrelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
255  
256 2 ▶use constant DEBUG => $ENV{DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
257  
258 rule '000', TOP => sub {
259 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
260 2 $self->func('l_yaml_stream');
261 2 };
262  
263  
264 # [001]
265 # c-printable ::=
266 # x:9 | x:A | x:D | [x:20-x:7E]
267 # | x:85 | [x:A0-x:D7FF] | [x:E000-x:FFFD]
268 # | [x:10000-x:10FFFF]
269  
270 rule '001', c_printable => sub {
271 82 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
272 82 debug_rule("c_printable") if DEBUG;
273 82 $self->any(
274 $self->chr("\x{09}"),
275 $self->chr("\x{0A}"),
276 $self->chr("\x{0D}"),
277 $self->rng("\x{20}", "\x{7E}"),
278 $self->chr("\x{85}"),
279 $self->rng("\x{A0}", "\x{D7FF}"),
280 $self->rng("\x{E000}", "\x{FFFD}"),
281 $self->rng("\x{010000}", "\x{10FFFF}")
282 );
283 2 };
284  
285  
286  
287 # [002]
288 # nb-json ::=
289 # x:9 | [x:20-x:10FFFF]
290  
291 rule '002', nb_json => sub {
292 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
293 0 debug_rule("nb_json") if DEBUG;
294 0 $self->any(
295 $self->chr("\x{09}"),
296 $self->rng("\x{20}", "\x{10FFFF}")
297 );
298 2 };
299  
300  
301  
302 # [003]
303 # c-byte-order-mark ::=
304 # x:FEFF
305  
306 rule '003', c_byte_order_mark => sub {
307 80 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
308 80 debug_rule("c_byte_order_mark") if DEBUG;
309 80 $self->chr("\x{FEFF}");
310 2 };
311  
312  
313  
314 # [004]
315 # c-sequence-entry ::=
316 # '-'
317  
318 rule '004', c_sequence_entry => sub {
319 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
320 0 debug_rule("c_sequence_entry") if DEBUG;
321 0 $self->chr('-');
322 2 };
323  
324  
325  
326 # [005]
327 # c-mapping-key ::=
328 # '?'
329  
330 rule '005', c_mapping_key => sub {
331 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
332 0 debug_rule("c_mapping_key") if DEBUG;
333 0 $self->chr('?');
334 2 };
335  
336  
337  
338 # [006]
339 # c-mapping-value ::=
340 # ':'
341  
342 rule '006', c_mapping_value => sub {
343 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
344 0 debug_rule("c_mapping_value") if DEBUG;
345 0 $self->chr(':');
346 2 };
347  
348  
349  
350 # [007]
351 # c-collect-entry ::=
352 # ','
353  
354 rule '007', c_collect_entry => sub {
355 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
356 0 debug_rule("c_collect_entry") if DEBUG;
357 0 $self->chr(',');
358 2 };
359  
360  
361  
362 # [008]
363 # c-sequence-start ::=
364 # '['
365  
366 rule '008', c_sequence_start => sub {
367 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
368 0 debug_rule("c_sequence_start") if DEBUG;
369 0 $self->chr('[');
370 2 };
371  
372  
373  
374 # [009]
375 # c-sequence-end ::=
376 # ']'
377  
378 rule '009', c_sequence_end => sub {
379 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
380 0 debug_rule("c_sequence_end") if DEBUG;
381 0 $self->chr(']');
382 2 };
383  
384  
385  
386 # [010]
387 # c-mapping-start ::=
388 # '{'
389  
390 rule '010', c_mapping_start => sub {
391 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
392 0 debug_rule("c_mapping_start") if DEBUG;
393 0 $self->chr('{');
394 2 };
395  
396  
397  
398 # [011]
399 # c-mapping-end ::=
400 # '}'
401  
402 rule '011', c_mapping_end => sub {
403 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
404 0 debug_rule("c_mapping_end") if DEBUG;
405 0 $self->chr('}');
406 2 };
407  
408  
409  
410 # [012]
411 # c-comment ::=
412 # '#'
413  
414 rule '012', c_comment => sub {
415 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
416 0 debug_rule("c_comment") if DEBUG;
417 0 $self->chr('#');
418 2 };
419  
420  
421  
422 # [013]
423 # c-anchor ::=
424 # '&'
425  
426 rule '013', c_anchor => sub {
427 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
428 0 debug_rule("c_anchor") if DEBUG;
429 0 $self->chr('&');
430 2 };
431  
432  
433  
434 # [014]
435 # c-alias ::=
436 # '*'
437  
438 rule '014', c_alias => sub {
439 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
440 0 debug_rule("c_alias") if DEBUG;
441 0 $self->chr('*');
442 2 };
443  
444  
445  
446 # [015]
447 # c-tag ::=
448 # '!'
449  
450 rule '015', c_tag => sub {
451 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
452 0 debug_rule("c_tag") if DEBUG;
453 0 $self->chr('!');
454 2 };
455  
456  
457  
458 # [016]
459 # c-literal ::=
460 # '|'
461  
462 rule '016', c_literal => sub {
463 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
464 0 debug_rule("c_literal") if DEBUG;
465 0 $self->chr('|');
466 2 };
467  
468  
469  
470 # [017]
471 # c-folded ::=
472 # '>'
473  
474 rule '017', c_folded => sub {
475 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
476 0 debug_rule("c_folded") if DEBUG;
477 0 $self->chr('>');
478 2 };
479  
480  
481  
482 # [018]
483 # c-single-quote ::=
484 # '''
485  
486 rule '018', c_single_quote => sub {
487 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
488 0 debug_rule("c_single_quote") if DEBUG;
489 0 $self->chr("'");
490 2 };
491  
492  
493  
494 # [019]
495 # c-double-quote ::=
496 # '"'
497  
498 rule '019', c_double_quote => sub {
499 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
500 0 debug_rule("c_double_quote") if DEBUG;
501 0 $self->chr('"');
502 2 };
503  
504  
505  
506 # [020]
507 # c-directive ::=
508 # '%'
509  
510 rule '020', c_directive => sub {
511 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
512 0 debug_rule("c_directive") if DEBUG;
513 0 $self->chr('%');
514 2 };
515  
516  
517  
518 # [021]
519 # c-reserved ::=
520 # '@' | '`'
521  
522 rule '021', c_reserved => sub {
523 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
524 0 debug_rule("c_reserved") if DEBUG;
525 0 $self->any(
526 $self->chr('@'),
527 $self->chr('`')
528 );
529 2 };
530  
531  
532  
533 # [022]
534 # c-indicator ::=
535 # '-' | '?' | ':' | ',' | '[' | ']' | '{' | '}'
536 # | '#' | '&' | '*' | '!' | '|' | '>' | ''' | '"'
537 # | '%' | '@' | '`'
538  
539 rule '022', c_indicator => sub {
540 14 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
541 14 debug_rule("c_indicator") if DEBUG;
542 14 $self->any(
543 $self->chr('-'),
544 $self->chr('?'),
545 $self->chr(':'),
546 $self->chr(','),
547 $self->chr('['),
548 $self->chr(']'),
549 $self->chr('{'),
550 $self->chr('}'),
551 $self->chr('#'),
552 $self->chr('&'),
553 $self->chr('*'),
554 $self->chr('!'),
555 $self->chr('|'),
556 $self->chr('>'),
557 $self->chr("'"),
558 $self->chr('"'),
559 $self->chr('%'),
560 $self->chr('@'),
561 $self->chr('`')
562 );
563 2 };
564  
565  
566  
567 # [023]
568 # c-flow-indicator ::=
569 # ',' | '[' | ']' | '{' | '}'
570  
571 rule '023', c_flow_indicator => sub {
572 8 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
573 8 debug_rule("c_flow_indicator") if DEBUG;
574 8 $self->any(
575 $self->chr(','),
576 $self->chr('['),
577 $self->chr(']'),
578 $self->chr('{'),
579 $self->chr('}')
580 );
581 2 };
582  
583  
584  
585 # [024]
586 # b-line-feed ::=
587 # x:A
588  
589 rule '024', b_line_feed => sub {
590 152 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
591 152 debug_rule("b_line_feed") if DEBUG;
592 152 $self->chr("\x{0A}");
593 2 };
594  
595  
596  
597 # [025]
598 # b-carriage-return ::=
599 # x:D
600  
601 rule '025', b_carriage_return => sub {
602 216 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
603 216 debug_rule("b_carriage_return") if DEBUG;
604 216 $self->chr("\x{0D}");
605 2 };
606  
607  
608  
609 # [026]
610 # b-char ::=
611 # b-line-feed | b-carriage-return
612  
613 rule '026', b_char => sub {
614 82 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
615 82 debug_rule("b_char") if DEBUG;
616 82 $self->any(
617 $self->func('b_line_feed'),
618 $self->func('b_carriage_return')
619 );
620 2 };
621  
622  
623  
624 # [027]
625 # nb-char ::=
626 # c-printable - b-char - c-byte-order-mark
627  
628 rule '027', nb_char => sub {
629 82 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
630 82 debug_rule("nb_char") if DEBUG;
631 82 $self->but(
632 $self->func('c_printable'),
633 $self->func('b_char'),
634 $self->func('c_byte_order_mark')
635 );
636 2 };
637  
638  
639  
640 # [028]
641 # b-break ::=
642 # ( b-carriage-return b-line-feed )
643 # | b-carriage-return
644 # | b-line-feed
645  
646 rule '028', b_break => sub {
647 70 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
648 70 debug_rule("b_break") if DEBUG;
649 70 $self->any(
650 $self->all(
651 $self->func('b_carriage_return'),
652 $self->func('b_line_feed')
653 ),
654 $self->func('b_carriage_return'),
655 $self->func('b_line_feed')
656 );
657 2 };
658  
659  
660  
661 # [029]
662 # b-as-line-feed ::=
663 # b-break
664  
665 rule '029', b_as_line_feed => sub {
666 16 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
667 16 debug_rule("b_as_line_feed") if DEBUG;
668 16 $self->func('b_break');
669 2 };
670  
671  
672  
673 # [030]
674 # b-non-content ::=
675 # b-break
676  
677 rule '030', b_non_content => sub {
678 46 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
679 46 debug_rule("b_non_content") if DEBUG;
680 46 $self->func('b_break');
681 2 };
682  
683  
684  
685 # [031]
686 # s-space ::=
687 # x:20
688  
689 rule '031', s_space => sub {
690 202 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
691 202 debug_rule("s_space") if DEBUG;
692 202 $self->chr("\x{20}");
693 2 };
694  
695  
696  
697 # [032]
698 # s-tab ::=
699 # x:9
700  
701 rule '032', s_tab => sub {
702 142 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
703 142 debug_rule("s_tab") if DEBUG;
704 142 $self->chr("\x{09}");
705 2 };
706  
707  
708  
709 # [033]
710 # s-white ::=
711 # s-space | s-tab
712  
713 rule '033', s_white => sub {
714 168 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
715 168 debug_rule("s_white") if DEBUG;
716 168 $self->any(
717 $self->func('s_space'),
718 $self->func('s_tab')
719 );
720 2 };
721  
722  
723  
724 # [034]
725 # ns-char ::=
726 # nb-char - s-white
727  
728 rule '034', ns_char => sub {
729 50 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
730 50 debug_rule("ns_char") if DEBUG;
731 50 $self->but(
732 $self->func('nb_char'),
733 $self->func('s_white')
734 );
735 2 };
736  
737  
738  
739 # [035]
740 # ns-dec-digit ::=
741 # [x:30-x:39]
742  
743 rule '035', ns_dec_digit => sub {
744 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
745 0 debug_rule("ns_dec_digit") if DEBUG;
746 0 $self->rng("\x{30}", "\x{39}");
747 2 };
748  
749  
750  
751 # [036]
752 # ns-hex-digit ::=
753 # ns-dec-digit
754 # | [x:41-x:46] | [x:61-x:66]
755  
756 rule '036', ns_hex_digit => sub {
757 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
758 0 debug_rule("ns_hex_digit") if DEBUG;
759 0 $self->any(
760 $self->func('ns_dec_digit'),
761 $self->rng("\x{41}", "\x{46}"),
762 $self->rng("\x{61}", "\x{66}")
763 );
764 2 };
765  
766  
767  
768 # [037]
769 # ns-ascii-letter ::=
770 # [x:41-x:5A] | [x:61-x:7A]
771  
772 rule '037', ns_ascii_letter => sub {
773 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
774 0 debug_rule("ns_ascii_letter") if DEBUG;
775 0 $self->any(
776 $self->rng("\x{41}", "\x{5A}"),
777 $self->rng("\x{61}", "\x{7A}")
778 );
779 2 };
780  
781  
782  
783 # [038]
784 # ns-word-char ::=
785 # ns-dec-digit | ns-ascii-letter | '-'
786  
787 rule '038', ns_word_char => sub {
788 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
789 0 debug_rule("ns_word_char") if DEBUG;
790 0 $self->any(
791 $self->func('ns_dec_digit'),
792 $self->func('ns_ascii_letter'),
793 $self->chr('-')
794 );
795 2 };
796  
797  
798  
799 # [039]
800 # ns-uri-char ::=
801 # '%' ns-hex-digit ns-hex-digit | ns-word-char | '#'
802 # | ';' | '/' | '?' | ':' | '@' | '&' | '=' | '+' | '$' | ','
803 # | '_' | '.' | '!' | '~' | '*' | ''' | '(' | ')' | '[' | ']'
804  
805 rule '039', ns_uri_char => sub {
806 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
807 0 debug_rule("ns_uri_char") if DEBUG;
808 0 $self->any(
809 $self->all(
810 $self->chr('%'),
811 $self->func('ns_hex_digit'),
812 $self->func('ns_hex_digit')
813 ),
814 $self->func('ns_word_char'),
815 $self->chr('#'),
816 $self->chr(';'),
817 $self->chr('/'),
818 $self->chr('?'),
819 $self->chr(':'),
820 $self->chr('@'),
821 $self->chr('&'),
822 $self->chr('='),
823 $self->chr('+'),
824 $self->chr('$'),
825 $self->chr(','),
826 $self->chr('_'),
827 $self->chr('.'),
828 $self->chr('!'),
829 $self->chr('~'),
830 $self->chr('*'),
831 $self->chr("'"),
832 $self->chr('('),
833 $self->chr(')'),
834 $self->chr('['),
835 $self->chr(']')
836 );
837 2 };
838  
839  
840  
841 # [040]
842 # ns-tag-char ::=
843 # ns-uri-char - '!' - c-flow-indicator
844  
845 rule '040', ns_tag_char => sub {
846 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
847 0 debug_rule("ns_tag_char") if DEBUG;
848 0 $self->but(
849 $self->func('ns_uri_char'),
850 $self->chr('!'),
851 $self->func('c_flow_indicator')
852 );
853 2 };
854  
855  
856  
857 # [041]
858 # c-escape ::=
859 # '\'
860  
861 rule '041', c_escape => sub {
862 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
863 0 debug_rule("c_escape") if DEBUG;
864 0 $self->chr("\\");
865 2 };
866  
867  
868  
869 # [042]
870 # ns-esc-null ::=
871 # '0'
872  
873 rule '042', ns_esc_null => sub {
874 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
875 0 debug_rule("ns_esc_null") if DEBUG;
876 0 $self->chr('0');
877 2 };
878  
879  
880  
881 # [043]
882 # ns-esc-bell ::=
883 # 'a'
884  
885 rule '043', ns_esc_bell => sub {
886 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
887 0 debug_rule("ns_esc_bell") if DEBUG;
888 0 $self->chr('a');
889 2 };
890  
891  
892  
893 # [044]
894 # ns-esc-backspace ::=
895 # 'b'
896  
897 rule '044', ns_esc_backspace => sub {
898 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
899 0 debug_rule("ns_esc_backspace") if DEBUG;
900 0 $self->chr('b');
901 2 };
902  
903  
904  
905 # [045]
906 # ns-esc-horizontal-tab ::=
907 # 't' | x:9
908  
909 rule '045', ns_esc_horizontal_tab => sub {
910 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
911 0 debug_rule("ns_esc_horizontal_tab") if DEBUG;
912 0 $self->any(
913 $self->chr('t'),
914 $self->chr("\x{09}")
915 );
916 2 };
917  
918  
919  
920 # [046]
921 # ns-esc-line-feed ::=
922 # 'n'
923  
924 rule '046', ns_esc_line_feed => sub {
925 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
926 0 debug_rule("ns_esc_line_feed") if DEBUG;
927 0 $self->chr('n');
928 2 };
929  
930  
931  
932 # [047]
933 # ns-esc-vertical-tab ::=
934 # 'v'
935  
936 rule '047', ns_esc_vertical_tab => sub {
937 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
938 0 debug_rule("ns_esc_vertical_tab") if DEBUG;
939 0 $self->chr('v');
940 2 };
941  
942  
943  
944 # [048]
945 # ns-esc-form-feed ::=
946 # 'f'
947  
948 rule '048', ns_esc_form_feed => sub {
949 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
950 0 debug_rule("ns_esc_form_feed") if DEBUG;
951 0 $self->chr('f');
952 2 };
953  
954  
955  
956 # [049]
957 # ns-esc-carriage-return ::=
958 # 'r'
959  
960 rule '049', ns_esc_carriage_return => sub {
961 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
962 0 debug_rule("ns_esc_carriage_return") if DEBUG;
963 0 $self->chr('r');
964 2 };
965  
966  
967  
968 # [050]
969 # ns-esc-escape ::=
970 # 'e'
971  
972 rule '050', ns_esc_escape => sub {
973 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
974 0 debug_rule("ns_esc_escape") if DEBUG;
975 0 $self->chr('e');
976 2 };
977  
978  
979  
980 # [051]
981 # ns-esc-space ::=
982 # x:20
983  
984 rule '051', ns_esc_space => sub {
985 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
986 0 debug_rule("ns_esc_space") if DEBUG;
987 0 $self->chr("\x{20}");
988 2 };
989  
990  
991  
992 # [052]
993 # ns-esc-double-quote ::=
994 # '"'
995  
996 rule '052', ns_esc_double_quote => sub {
997 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
998 0 debug_rule("ns_esc_double_quote") if DEBUG;
999 0 $self->chr('"');
1000 2 };
1001  
1002  
1003  
1004 # [053]
1005 # ns-esc-slash ::=
1006 # '/'
1007  
1008 rule '053', ns_esc_slash => sub {
1009 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1010 0 debug_rule("ns_esc_slash") if DEBUG;
1011 0 $self->chr('/');
1012 2 };
1013  
1014  
1015  
1016 # [054]
1017 # ns-esc-backslash ::=
1018 # '\'
1019  
1020 rule '054', ns_esc_backslash => sub {
1021 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1022 0 debug_rule("ns_esc_backslash") if DEBUG;
1023 0 $self->chr("\\");
1024 2 };
1025  
1026  
1027  
1028 # [055]
1029 # ns-esc-next-line ::=
1030 # 'N'
1031  
1032 rule '055', ns_esc_next_line => sub {
1033 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1034 0 debug_rule("ns_esc_next_line") if DEBUG;
1035 0 $self->chr('N');
1036 2 };
1037  
1038  
1039  
1040 # [056]
1041 # ns-esc-non-breaking-space ::=
1042 # '_'
1043  
1044 rule '056', ns_esc_non_breaking_space => sub {
1045 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1046 0 debug_rule("ns_esc_non_breaking_space") if DEBUG;
1047 0 $self->chr('_');
1048 2 };
1049  
1050  
1051  
1052 # [057]
1053 # ns-esc-line-separator ::=
1054 # 'L'
1055  
1056 rule '057', ns_esc_line_separator => sub {
1057 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1058 0 debug_rule("ns_esc_line_separator") if DEBUG;
1059 0 $self->chr('L');
1060 2 };
1061  
1062  
1063  
1064 # [058]
1065 # ns-esc-paragraph-separator ::=
1066 # 'P'
1067  
1068 rule '058', ns_esc_paragraph_separator => sub {
1069 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1070 0 debug_rule("ns_esc_paragraph_separator") if DEBUG;
1071 0 $self->chr('P');
1072 2 };
1073  
1074  
1075  
1076 # [059]
1077 # ns-esc-8-bit ::=
1078 # 'x'
1079 # ( ns-hex-digit{2} )
1080  
1081 rule '059', ns_esc_8_bit => sub {
1082 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1083 0 debug_rule("ns_esc_8_bit") if DEBUG;
1084 0 $self->all(
1085 $self->chr('x'),
1086 $self->rep($2, $2, $self->func('ns_hex_digit'))
1087 );
1088 2 };
1089  
1090  
1091  
1092 # [060]
1093 # ns-esc-16-bit ::=
1094 # 'u'
1095 # ( ns-hex-digit{4} )
1096  
1097 rule '060', ns_esc_16_bit => sub {
1098 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1099 0 debug_rule("ns_esc_16_bit") if DEBUG;
1100 0 $self->all(
1101 $self->chr('u'),
1102 $self->rep($4, $4, $self->func('ns_hex_digit'))
1103 );
1104 2 };
1105  
1106  
1107  
1108 # [061]
1109 # ns-esc-32-bit ::=
1110 # 'U'
1111 # ( ns-hex-digit{8} )
1112  
1113 rule '061', ns_esc_32_bit => sub {
1114 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1115 0 debug_rule("ns_esc_32_bit") if DEBUG;
1116 0 $self->all(
1117 $self->chr('U'),
1118 $self->rep($8, $8, $self->func('ns_hex_digit'))
1119 );
1120 2 };
1121  
1122  
1123  
1124 # [062]
1125 # c-ns-esc-char ::=
1126 # '\'
1127 # ( ns-esc-null | ns-esc-bell | ns-esc-backspace
1128 # | ns-esc-horizontal-tab | ns-esc-line-feed
1129 # | ns-esc-vertical-tab | ns-esc-form-feed
1130 # | ns-esc-carriage-return | ns-esc-escape | ns-esc-space
1131 # | ns-esc-double-quote | ns-esc-slash | ns-esc-backslash
1132 # | ns-esc-next-line | ns-esc-non-breaking-space
1133 # | ns-esc-line-separator | ns-esc-paragraph-separator
1134 # | ns-esc-8-bit | ns-esc-16-bit | ns-esc-32-bit )
1135  
1136 rule '062', c_ns_esc_char => sub {
1137 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1138 0 debug_rule("c_ns_esc_char") if DEBUG;
1139 0 $self->all(
1140 $self->chr("\\"),
1141 $self->any(
1142 $self->func('ns_esc_null'),
1143 $self->func('ns_esc_bell'),
1144 $self->func('ns_esc_backspace'),
1145 $self->func('ns_esc_horizontal_tab'),
1146 $self->func('ns_esc_line_feed'),
1147 $self->func('ns_esc_vertical_tab'),
1148 $self->func('ns_esc_form_feed'),
1149 $self->func('ns_esc_carriage_return'),
1150 $self->func('ns_esc_escape'),
1151 $self->func('ns_esc_space'),
1152 $self->func('ns_esc_double_quote'),
1153 $self->func('ns_esc_slash'),
1154 $self->func('ns_esc_backslash'),
1155 $self->func('ns_esc_next_line'),
1156 $self->func('ns_esc_non_breaking_space'),
1157 $self->func('ns_esc_line_separator'),
1158 $self->func('ns_esc_paragraph_separator'),
1159 $self->func('ns_esc_8_bit'),
1160 $self->func('ns_esc_16_bit'),
1161 $self->func('ns_esc_32_bit')
1162 )
1163 );
1164 2 };
1165  
1166  
1167  
1168 # [063]
1169 # s-indent(n) ::=
1170 # s-space{n}
1171  
1172 rule '063', s_indent => sub {
1173 28 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1174 28 debug_rule("s_indent",$n) if DEBUG;
1175 28 $self->rep($n, $n, $self->func('s_space'));
1176 2 };
1177  
1178  
1179  
1180 # [064]
1181 # s-indent(<n) ::=
1182 # s-space{m} <where_m_<_n>
1183  
1184 rule '064', s_indent_lt => sub {
1185 4 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1186 4 debug_rule("s_indent_lt",$n) if DEBUG;
1187 4 $self->may(
1188 $self->all(
1189 $self->rep(0, undef, $self->func('s_space')),
1190 $self->lt($self->len($self->func('match')), $n)
1191 )
1192 );
1193 2 };
1194  
1195  
1196  
1197 # [065]
1198 # s-indent(<=n) ::=
1199 # s-space{m} <where_m_<=_n>
1200  
1201 rule '065', s_indent_le => sub {
1202 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1203 2 debug_rule("s_indent_le",$n) if DEBUG;
1204 2 $self->may(
1205 $self->all(
1206 $self->rep(0, undef, $self->func('s_space')),
1207 $self->le($self->len($self->func('match')), $n)
1208 )
1209 );
1210 2 };
1211  
1212  
1213  
1214 # [066]
1215 # s-separate-in-line ::=
1216 # s-white+ | <start_of_line>
1217  
1218 rule '066', s_separate_in_line => sub {
1219 72 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1220 72 debug_rule("s_separate_in_line") if DEBUG;
1221 72 $self->any(
1222 $self->rep(1, undef, $self->func('s_white')),
1223 $self->func('start_of_line')
1224 );
1225 2 };
1226  
1227  
1228  
1229 # [067]
1230 # s-line-prefix(n,c) ::=
1231 # ( c = block-out => s-block-line-prefix(n) )
1232 # ( c = block-in => s-block-line-prefix(n) )
1233 # ( c = flow-out => s-flow-line-prefix(n) )
1234 # ( c = flow-in => s-flow-line-prefix(n) )
1235  
1236 rule '067', s_line_prefix => sub {
1237 8 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1238 8 debug_rule("s_line_prefix",$n,$c) if DEBUG;
1239 8 $self->case(
1240 $c,
1241 {
1242 'block-in' => [ $self->func('s_block_line_prefix'), $n ],
1243 'block-out' => [ $self->func('s_block_line_prefix'), $n ],
1244 'flow-in' => [ $self->func('s_flow_line_prefix'), $n ],
1245 'flow-out' => [ $self->func('s_flow_line_prefix'), $n ],
1246 }
1247 );
1248 2 };
1249  
1250  
1251  
1252 # [068]
1253 # s-block-line-prefix(n) ::=
1254 # s-indent(n)
1255  
1256 rule '068', s_block_line_prefix => sub {
1257 8 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1258 8 debug_rule("s_block_line_prefix",$n) if DEBUG;
1259 8 [ $self->func('s_indent'), $n ];
1260 2 };
1261  
1262  
1263  
1264 # [069]
1265 # s-flow-line-prefix(n) ::=
1266 # s-indent(n)
1267 # s-separate-in-line?
1268  
1269 rule '069', s_flow_line_prefix => sub {
1270 4 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1271 4 debug_rule("s_flow_line_prefix",$n) if DEBUG;
1272 4 $self->all(
1273 [ $self->func('s_indent'), $n ],
1274 $self->rep(0, 1, $self->func('s_separate_in_line'))
1275 );
1276 2 };
1277  
1278  
1279  
1280 # [070]
1281 # l-empty(n,c) ::=
1282 # ( s-line-prefix(n,c) | s-indent(<n) )
1283 # b-as-line-feed
1284  
1285 rule '070', l_empty => sub {
1286 8 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1287 8 debug_rule("l_empty",$n,$c) if DEBUG;
1288 8 $self->all(
1289 $self->any(
1290 [ $self->func('s_line_prefix'), $n, $c ],
1291 [ $self->func('s_indent_lt'), $n ]
1292 ),
1293 $self->func('b_as_line_feed')
1294 );
1295 2 };
1296  
1297  
1298  
1299 # [071]
1300 # b-l-trimmed(n,c) ::=
1301 # b-non-content l-empty(n,c)+
1302  
1303 rule '071', b_l_trimmed => sub {
1304 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1305 4 debug_rule("b_l_trimmed",$n,$c) if DEBUG;
1306 4 $self->all(
1307 $self->func('b_non_content'),
1308 $self->rep(1, undef, [ $self->func('l_empty'), $n, $c ])
1309 );
1310 2 };
1311  
1312  
1313  
1314 # [072]
1315 # b-as-space ::=
1316 # b-break
1317  
1318 rule '072', b_as_space => sub {
1319 4 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1320 4 debug_rule("b_as_space") if DEBUG;
1321 4 $self->func('b_break');
1322 2 };
1323  
1324  
1325  
1326 # [073]
1327 # b-l-folded(n,c) ::=
1328 # b-l-trimmed(n,c) | b-as-space
1329  
1330 rule '073', b_l_folded => sub {
1331 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1332 4 debug_rule("b_l_folded",$n,$c) if DEBUG;
1333 4 $self->any(
1334 [ $self->func('b_l_trimmed'), $n, $c ],
1335 $self->func('b_as_space')
1336 );
1337 2 };
1338  
1339  
1340  
1341 # [074]
1342 # s-flow-folded(n) ::=
1343 # s-separate-in-line?
1344 # b-l-folded(n,flow-in)
1345 # s-flow-line-prefix(n)
1346  
1347 rule '074', s_flow_folded => sub {
1348 4 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1349 4 debug_rule("s_flow_folded",$n) if DEBUG;
1350 4 $self->all(
1351 $self->rep(0, 1, $self->func('s_separate_in_line')),
1352 [ $self->func('b_l_folded'), $n, "flow-in" ],
1353 [ $self->func('s_flow_line_prefix'), $n ]
1354 );
1355 2 };
1356  
1357  
1358  
1359 # [075]
1360 # c-nb-comment-text ::=
1361 # '#' nb-char*
1362  
1363 rule '075', c_nb_comment_text => sub {
1364 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1365 26 debug_rule("c_nb_comment_text") if DEBUG;
1366 26 $self->all(
1367 $self->chr('#'),
1368 $self->rep(0, undef, $self->func('nb_char'))
1369 );
1370 2 };
1371  
1372  
1373  
1374 # [076]
1375 # b-comment ::=
1376 # b-non-content | <end_of_file>
1377  
1378 rule '076', b_comment => sub {
1379 40 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1380 40 debug_rule("b_comment") if DEBUG;
1381 40 $self->any(
1382 $self->func('b_non_content'),
1383 $self->func('end_of_stream')
1384 );
1385 2 };
1386  
1387  
1388  
1389 # [077]
1390 # s-b-comment ::=
1391 # ( s-separate-in-line
1392 # c-nb-comment-text? )?
1393 # b-comment
1394  
1395 rule '077', s_b_comment => sub {
1396 28 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1397 28 debug_rule("s_b_comment") if DEBUG;
1398 28 $self->all(
1399 $self->rep(0, 1,
1400 $self->all(
1401 $self->func('s_separate_in_line'),
1402 $self->rep(0, 1, $self->func('c_nb_comment_text'))
1403 )),
1404 $self->func('b_comment')
1405 );
1406 2 };
1407  
1408  
1409  
1410 # [078]
1411 # l-comment ::=
1412 # s-separate-in-line c-nb-comment-text?
1413 # b-comment
1414  
1415 rule '078', l_comment => sub {
1416 12 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1417 12 debug_rule("l_comment") if DEBUG;
1418 12 $self->all(
1419 $self->func('s_separate_in_line'),
1420 $self->rep(0, 1, $self->func('c_nb_comment_text')),
1421 $self->func('b_comment')
1422 );
1423 2 };
1424  
1425  
1426  
1427 # [079]
1428 # s-l-comments ::=
1429 # ( s-b-comment | <start_of_line> )
1430 # l-comment*
1431  
1432 rule '079', s_l_comments => sub {
1433 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1434 26 debug_rule("s_l_comments") if DEBUG;
1435 26 $self->all(
1436 $self->any(
1437 $self->func('s_b_comment'),
1438 $self->func('start_of_line')
1439 ),
1440 $self->rep(0, undef, $self->func('l_comment'))
1441 );
1442 2 };
1443  
1444  
1445  
1446 # [080]
1447 # s-separate(n,c) ::=
1448 # ( c = block-out => s-separate-lines(n) )
1449 # ( c = block-in => s-separate-lines(n) )
1450 # ( c = flow-out => s-separate-lines(n) )
1451 # ( c = flow-in => s-separate-lines(n) )
1452 # ( c = block-key => s-separate-in-line )
1453 # ( c = flow-key => s-separate-in-line )
1454  
1455 rule '080', s_separate => sub {
1456 20 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1457 20 debug_rule("s_separate",$n,$c) if DEBUG;
1458 20 $self->case(
1459 $c,
1460 {
1461 'block-in' => [ $self->func('s_separate_lines'), $n ],
1462 'block-key' => $self->func('s_separate_in_line'),
1463 'block-out' => [ $self->func('s_separate_lines'), $n ],
1464 'flow-in' => [ $self->func('s_separate_lines'), $n ],
1465 'flow-key' => $self->func('s_separate_in_line'),
1466 'flow-out' => [ $self->func('s_separate_lines'), $n ],
1467 }
1468 );
1469 2 };
1470  
1471  
1472  
1473 # [081]
1474 # s-separate-lines(n) ::=
1475 # ( s-l-comments
1476 # s-flow-line-prefix(n) )
1477 # | s-separate-in-line
1478  
1479 rule '081', s_separate_lines => sub {
1480 20 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1481 20 debug_rule("s_separate_lines",$n) if DEBUG;
1482 20 $self->any(
1483 $self->all(
1484 $self->func('s_l_comments'),
1485 [ $self->func('s_flow_line_prefix'), $n ]
1486 ),
1487 $self->func('s_separate_in_line')
1488 );
1489 2 };
1490  
1491  
1492  
1493 # [082]
1494 # l-directive ::=
1495 # '%'
1496 # ( ns-yaml-directive
1497 # | ns-tag-directive
1498 # | ns-reserved-directive )
1499 # s-l-comments
1500  
1501 rule '082', l_directive => sub {
1502 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1503 2 debug_rule("l_directive") if DEBUG;
1504 2 $self->all(
1505 $self->chr('%'),
1506 $self->any(
1507 $self->func('ns_yaml_directive'),
1508 $self->func('ns_tag_directive'),
1509 $self->func('ns_reserved_directive')
1510 ),
1511 $self->func('s_l_comments')
1512 );
1513 2 };
1514  
1515  
1516  
1517 # [083]
1518 # ns-reserved-directive ::=
1519 # ns-directive-name
1520 # ( s-separate-in-line ns-directive-parameter )*
1521  
1522 rule '083', ns_reserved_directive => sub {
1523 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1524 0 debug_rule("ns_reserved_directive") if DEBUG;
1525 0 $self->all(
1526 $self->func('ns_directive_name'),
1527 $self->rep(0, undef,
1528 $self->all(
1529 $self->func('s_separate_in_line'),
1530 $self->func('ns_directive_parameter')
1531 ))
1532 );
1533 2 };
1534  
1535  
1536  
1537 # [084]
1538 # ns-directive-name ::=
1539 # ns-char+
1540  
1541 rule '084', ns_directive_name => sub {
1542 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1543 0 debug_rule("ns_directive_name") if DEBUG;
1544 0 $self->rep(1, undef, $self->func('ns_char'));
1545 2 };
1546  
1547  
1548  
1549 # [085]
1550 # ns-directive-parameter ::=
1551 # ns-char+
1552  
1553 rule '085', ns_directive_parameter => sub {
1554 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1555 0 debug_rule("ns_directive_parameter") if DEBUG;
1556 0 $self->rep(1, undef, $self->func('ns_char'));
1557 2 };
1558  
1559  
1560  
1561 # [086]
1562 # ns-yaml-directive ::=
1563 # 'Y' 'A' 'M' 'L'
1564 # s-separate-in-line ns-yaml-version
1565  
1566 rule '086', ns_yaml_directive => sub {
1567 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1568 0 debug_rule("ns_yaml_directive") if DEBUG;
1569 0 $self->all(
1570 $self->chr('Y'),
1571 $self->chr('A'),
1572 $self->chr('M'),
1573 $self->chr('L'),
1574 $self->func('s_separate_in_line'),
1575 $self->func('ns_yaml_version')
1576 );
1577 2 };
1578  
1579  
1580  
1581 # [087]
1582 # ns-yaml-version ::=
1583 # ns-dec-digit+ '.' ns-dec-digit+
1584  
1585 rule '087', ns_yaml_version => sub {
1586 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1587 0 debug_rule("ns_yaml_version") if DEBUG;
1588 0 $self->all(
1589 $self->rep(1, undef, $self->func('ns_dec_digit')),
1590 $self->chr('.'),
1591 $self->rep2(1, undef, $self->func('ns_dec_digit'))
1592 );
1593 2 };
1594  
1595  
1596  
1597 # [088]
1598 # ns-tag-directive ::=
1599 # 'T' 'A' 'G'
1600 # s-separate-in-line c-tag-handle
1601 # s-separate-in-line ns-tag-prefix
1602  
1603 rule '088', ns_tag_directive => sub {
1604 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1605 0 debug_rule("ns_tag_directive") if DEBUG;
1606 0 $self->all(
1607 $self->chr('T'),
1608 $self->chr('A'),
1609 $self->chr('G'),
1610 $self->func('s_separate_in_line'),
1611 $self->func('c_tag_handle'),
1612 $self->func('s_separate_in_line'),
1613 $self->func('ns_tag_prefix')
1614 );
1615 2 };
1616  
1617  
1618  
1619 # [089]
1620 # c-tag-handle ::=
1621 # c-named-tag-handle
1622 # | c-secondary-tag-handle
1623 # | c-primary-tag-handle
1624  
1625 rule '089', c_tag_handle => sub {
1626 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1627 26 debug_rule("c_tag_handle") if DEBUG;
1628 26 $self->any(
1629 $self->func('c_named_tag_handle'),
1630 $self->func('c_secondary_tag_handle'),
1631 $self->func('c_primary_tag_handle')
1632 );
1633 2 };
1634  
1635  
1636  
1637 # [090]
1638 # c-primary-tag-handle ::=
1639 # '!'
1640  
1641 rule '090', c_primary_tag_handle => sub {
1642 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1643 26 debug_rule("c_primary_tag_handle") if DEBUG;
1644 26 $self->chr('!');
1645 2 };
1646  
1647  
1648  
1649 # [091]
1650 # c-secondary-tag-handle ::=
1651 # '!' '!'
1652  
1653 rule '091', c_secondary_tag_handle => sub {
1654 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1655 26 debug_rule("c_secondary_tag_handle") if DEBUG;
1656 26 $self->all(
1657 $self->chr('!'),
1658 $self->chr('!')
1659 );
1660 2 };
1661  
1662  
1663  
1664 # [092]
1665 # c-named-tag-handle ::=
1666 # '!' ns-word-char+ '!'
1667  
1668 rule '092', c_named_tag_handle => sub {
1669 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1670 26 debug_rule("c_named_tag_handle") if DEBUG;
1671 26 $self->all(
1672 $self->chr('!'),
1673 $self->rep(1, undef, $self->func('ns_word_char')),
1674 $self->chr('!')
1675 );
1676 2 };
1677  
1678  
1679  
1680 # [093]
1681 # ns-tag-prefix ::=
1682 # c-ns-local-tag-prefix | ns-global-tag-prefix
1683  
1684 rule '093', ns_tag_prefix => sub {
1685 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1686 0 debug_rule("ns_tag_prefix") if DEBUG;
1687 0 $self->any(
1688 $self->func('c_ns_local_tag_prefix'),
1689 $self->func('ns_global_tag_prefix')
1690 );
1691 2 };
1692  
1693  
1694  
1695 # [094]
1696 # c-ns-local-tag-prefix ::=
1697 # '!' ns-uri-char*
1698  
1699 rule '094', c_ns_local_tag_prefix => sub {
1700 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1701 0 debug_rule("c_ns_local_tag_prefix") if DEBUG;
1702 0 $self->all(
1703 $self->chr('!'),
1704 $self->rep(0, undef, $self->func('ns_uri_char'))
1705 );
1706 2 };
1707  
1708  
1709  
1710 # [095]
1711 # ns-global-tag-prefix ::=
1712 # ns-tag-char ns-uri-char*
1713  
1714 rule '095', ns_global_tag_prefix => sub {
1715 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1716 0 debug_rule("ns_global_tag_prefix") if DEBUG;
1717 0 $self->all(
1718 $self->func('ns_tag_char'),
1719 $self->rep(0, undef, $self->func('ns_uri_char'))
1720 );
1721 2 };
1722  
1723  
1724  
1725 # [096]
1726 # c-ns-properties(n,c) ::=
1727 # ( c-ns-tag-property
1728 # ( s-separate(n,c) c-ns-anchor-property )? )
1729 # | ( c-ns-anchor-property
1730 # ( s-separate(n,c) c-ns-tag-property )? )
1731  
1732 rule '096', c_ns_properties => sub {
1733 22 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1734 22 debug_rule("c_ns_properties",$n,$c) if DEBUG;
1735 22 $self->any(
1736 $self->all(
1737 $self->func('c_ns_tag_property'),
1738 $self->rep(0, 1,
1739 $self->all(
1740 [ $self->func('s_separate'), $n, $c ],
1741 $self->func('c_ns_anchor_property')
1742 ))
1743 ),
1744 $self->all(
1745 $self->func('c_ns_anchor_property'),
1746 $self->rep(0, 1,
1747 $self->all(
1748 [ $self->func('s_separate'), $n, $c ],
1749 $self->func('c_ns_tag_property')
1750 ))
1751 )
1752 );
1753 2 };
1754  
1755  
1756  
1757 # [097]
1758 # c-ns-tag-property ::=
1759 # c-verbatim-tag
1760 # | c-ns-shorthand-tag
1761 # | c-non-specific-tag
1762  
1763 rule '097', c_ns_tag_property => sub {
1764 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1765 26 debug_rule("c_ns_tag_property") if DEBUG;
1766 26 $self->any(
1767 $self->func('c_verbatim_tag'),
1768 $self->func('c_ns_shorthand_tag'),
1769 $self->func('c_non_specific_tag')
1770 );
1771 2 };
1772  
1773  
1774  
1775 # [098]
1776 # c-verbatim-tag ::=
1777 # '!' '<' ns-uri-char+ '>'
1778  
1779 rule '098', c_verbatim_tag => sub {
1780 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1781 26 debug_rule("c_verbatim_tag") if DEBUG;
1782 26 $self->all(
1783 $self->chr('!'),
1784 $self->chr('<'),
1785 $self->rep(1, undef, $self->func('ns_uri_char')),
1786 $self->chr('>')
1787 );
1788 2 };
1789  
1790  
1791  
1792 # [099]
1793 # c-ns-shorthand-tag ::=
1794 # c-tag-handle ns-tag-char+
1795  
1796 rule '099', c_ns_shorthand_tag => sub {
1797 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1798 26 debug_rule("c_ns_shorthand_tag") if DEBUG;
1799 26 $self->all(
1800 $self->func('c_tag_handle'),
1801 $self->rep(1, undef, $self->func('ns_tag_char'))
1802 );
1803 2 };
1804  
1805  
1806  
1807 # [100]
1808 # c-non-specific-tag ::=
1809 # '!'
1810  
1811 rule '100', c_non_specific_tag => sub {
1812 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1813 26 debug_rule("c_non_specific_tag") if DEBUG;
1814 26 $self->chr('!');
1815 2 };
1816  
1817  
1818  
1819 # [101]
1820 # c-ns-anchor-property ::=
1821 # '&' ns-anchor-name
1822  
1823 rule '101', c_ns_anchor_property => sub {
1824 26 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1825 26 debug_rule("c_ns_anchor_property") if DEBUG;
1826 26 $self->all(
1827 $self->chr('&'),
1828 $self->func('ns_anchor_name')
1829 );
1830 2 };
1831  
1832  
1833  
1834 # [102]
1835 # ns-anchor-char ::=
1836 # ns-char - c-flow-indicator
1837  
1838 rule '102', ns_anchor_char => sub {
1839 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1840 0 debug_rule("ns_anchor_char") if DEBUG;
1841 0 $self->but(
1842 $self->func('ns_char'),
1843 $self->func('c_flow_indicator')
1844 );
1845 2 };
1846  
1847  
1848  
1849 # [103]
1850 # ns-anchor-name ::=
1851 # ns-anchor-char+
1852  
1853 rule '103', ns_anchor_name => sub {
1854 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1855 0 debug_rule("ns_anchor_name") if DEBUG;
1856 0 $self->rep(1, undef, $self->func('ns_anchor_char'));
1857 2 };
1858  
1859  
1860  
1861 # [104]
1862 # c-ns-alias-node ::=
1863 # '*' ns-anchor-name
1864  
1865 rule '104', c_ns_alias_node => sub {
1866 16 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1867 16 debug_rule("c_ns_alias_node") if DEBUG;
1868 16 $self->all(
1869 $self->chr('*'),
1870 $self->func('ns_anchor_name')
1871 );
1872 2 };
1873  
1874  
1875  
1876 # [105]
1877 # e-scalar ::=
1878 # <empty>
1879  
1880 rule '105', e_scalar => sub {
1881 6 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1882 6 debug_rule("e_scalar") if DEBUG;
1883 6 $self->func('empty');
1884 2 };
1885  
1886  
1887  
1888 # [106]
1889 # e-node ::=
1890 # e-scalar
1891  
1892 rule '106', e_node => sub {
1893 6 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1894 6 debug_rule("e_node") if DEBUG;
1895 6 $self->func('e_scalar');
1896 2 };
1897  
1898  
1899  
1900 # [107]
1901 # nb-double-char ::=
1902 # c-ns-esc-char | ( nb-json - '\' - '"' )
1903  
1904 rule '107', nb_double_char => sub {
1905 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1906 0 debug_rule("nb_double_char") if DEBUG;
1907 0 $self->any(
1908 $self->func('c_ns_esc_char'),
1909 $self->but(
1910 $self->func('nb_json'),
1911 $self->chr("\\"),
1912 $self->chr('"')
1913 )
1914 );
1915 2 };
1916  
1917  
1918  
1919 # [108]
1920 # ns-double-char ::=
1921 # nb-double-char - s-white
1922  
1923 rule '108', ns_double_char => sub {
1924 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1925 0 debug_rule("ns_double_char") if DEBUG;
1926 0 $self->but(
1927 $self->func('nb_double_char'),
1928 $self->func('s_white')
1929 );
1930 2 };
1931  
1932  
1933  
1934 # [109]
1935 # c-double-quoted(n,c) ::=
1936 # '"' nb-double-text(n,c)
1937 # '"'
1938  
1939 rule '109', c_double_quoted => sub {
1940 10 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
1941 10 debug_rule("c_double_quoted",$n,$c) if DEBUG;
1942 10 $self->all(
1943 $self->chr('"'),
1944 [ $self->func('nb_double_text'), $n, $c ],
1945 $self->chr('"')
1946 );
1947 2 };
1948  
1949  
1950  
1951 # [110]
1952 # nb-double-text(n,c) ::=
1953 # ( c = flow-out => nb-double-multi-line(n) )
1954 # ( c = flow-in => nb-double-multi-line(n) )
1955 # ( c = block-key => nb-double-one-line )
1956 # ( c = flow-key => nb-double-one-line )
1957  
1958 rule '110', nb_double_text => sub {
1959 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1960 0 debug_rule("nb_double_text",$n,$c) if DEBUG;
1961 0 $self->case(
1962 $c,
1963 {
1964 'block-key' => $self->func('nb_double_one_line'),
1965 'flow-in' => [ $self->func('nb_double_multi_line'), $n ],
1966 'flow-key' => $self->func('nb_double_one_line'),
1967 'flow-out' => [ $self->func('nb_double_multi_line'), $n ],
1968 }
1969 );
1970 2 };
1971  
1972  
1973  
1974 # [111]
1975 # nb-double-one-line ::=
1976 # nb-double-char*
1977  
1978 rule '111', nb_double_one_line => sub {
1979 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1980 0 debug_rule("nb_double_one_line") if DEBUG;
1981 0 $self->rep(0, undef, $self->func('nb_double_char'));
1982 2 };
1983  
1984  
1985  
1986 # [112]
1987 # s-double-escaped(n) ::=
1988 # s-white* '\'
1989 # b-non-content
1990 # l-empty(n,flow-in)* s-flow-line-prefix(n)
1991  
1992 rule '112', s_double_escaped => sub {
1993 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
1994 0 debug_rule("s_double_escaped",$n) if DEBUG;
1995 0 $self->all(
1996 $self->rep(0, undef, $self->func('s_white')),
1997 $self->chr("\\"),
1998 $self->func('b_non_content'),
1999 $self->rep2(0, undef, [ $self->func('l_empty'), $n, "flow-in" ]),
2000 [ $self->func('s_flow_line_prefix'), $n ]
2001 );
2002 2 };
2003  
2004  
2005  
2006 # [113]
2007 # s-double-break(n) ::=
2008 # s-double-escaped(n) | s-flow-folded(n)
2009  
2010 rule '113', s_double_break => sub {
2011 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2012 0 debug_rule("s_double_break",$n) if DEBUG;
2013 0 $self->any(
2014 [ $self->func('s_double_escaped'), $n ],
2015 [ $self->func('s_flow_folded'), $n ]
2016 );
2017 2 };
2018  
2019  
2020  
2021 # [114]
2022 # nb-ns-double-in-line ::=
2023 # ( s-white* ns-double-char )*
2024  
2025 rule '114', nb_ns_double_in_line => sub {
2026 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2027 0 debug_rule("nb_ns_double_in_line") if DEBUG;
2028 0 $self->rep(0, undef,
2029 $self->all(
2030 $self->rep(0, undef, $self->func('s_white')),
2031 $self->func('ns_double_char')
2032 ));
2033 2 };
2034  
2035  
2036  
2037 # [115]
2038 # s-double-next-line(n) ::=
2039 # s-double-break(n)
2040 # ( ns-double-char nb-ns-double-in-line
2041 # ( s-double-next-line(n) | s-white* ) )?
2042  
2043 rule '115', s_double_next_line => sub {
2044 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2045 0 debug_rule("s_double_next_line",$n) if DEBUG;
2046 0 $self->all(
2047 [ $self->func('s_double_break'), $n ],
2048 $self->rep(0, 1,
2049 $self->all(
2050 $self->func('ns_double_char'),
2051 $self->func('nb_ns_double_in_line'),
2052 $self->any(
2053 [ $self->func('s_double_next_line'), $n ],
2054 $self->rep(0, undef, $self->func('s_white'))
2055 )
2056 ))
2057 );
2058 2 };
2059  
2060  
2061  
2062 # [116]
2063 # nb-double-multi-line(n) ::=
2064 # nb-ns-double-in-line
2065 # ( s-double-next-line(n) | s-white* )
2066  
2067 rule '116', nb_double_multi_line => sub {
2068 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2069 0 debug_rule("nb_double_multi_line",$n) if DEBUG;
2070 0 $self->all(
2071 $self->func('nb_ns_double_in_line'),
2072 $self->any(
2073 [ $self->func('s_double_next_line'), $n ],
2074 $self->rep(0, undef, $self->func('s_white'))
2075 )
2076 );
2077 2 };
2078  
2079  
2080  
2081 # [117]
2082 # c-quoted-quote ::=
2083 # ''' '''
2084  
2085 rule '117', c_quoted_quote => sub {
2086 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2087 0 debug_rule("c_quoted_quote") if DEBUG;
2088 0 $self->all(
2089 $self->chr("'"),
2090 $self->chr("'")
2091 );
2092 2 };
2093  
2094  
2095  
2096 # [118]
2097 # nb-single-char ::=
2098 # c-quoted-quote | ( nb-json - ''' )
2099  
2100 rule '118', nb_single_char => sub {
2101 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2102 0 debug_rule("nb_single_char") if DEBUG;
2103 0 $self->any(
2104 $self->func('c_quoted_quote'),
2105 $self->but(
2106 $self->func('nb_json'),
2107 $self->chr("'")
2108 )
2109 );
2110 2 };
2111  
2112  
2113  
2114 # [119]
2115 # ns-single-char ::=
2116 # nb-single-char - s-white
2117  
2118 rule '119', ns_single_char => sub {
2119 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2120 0 debug_rule("ns_single_char") if DEBUG;
2121 0 $self->but(
2122 $self->func('nb_single_char'),
2123 $self->func('s_white')
2124 );
2125 2 };
2126  
2127  
2128  
2129 # [120]
2130 # c-single-quoted(n,c) ::=
2131 # ''' nb-single-text(n,c)
2132 # '''
2133  
2134 rule '120', c_single_quoted => sub {
2135 10 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2136 10 debug_rule("c_single_quoted",$n,$c) if DEBUG;
2137 10 $self->all(
2138 $self->chr("'"),
2139 [ $self->func('nb_single_text'), $n, $c ],
2140 $self->chr("'")
2141 );
2142 2 };
2143  
2144  
2145  
2146 # [121]
2147 # nb-single-text(n,c) ::=
2148 # ( c = flow-out => nb-single-multi-line(n) )
2149 # ( c = flow-in => nb-single-multi-line(n) )
2150 # ( c = block-key => nb-single-one-line )
2151 # ( c = flow-key => nb-single-one-line )
2152  
2153 rule '121', nb_single_text => sub {
2154 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2155 0 debug_rule("nb_single_text",$n,$c) if DEBUG;
2156 0 $self->case(
2157 $c,
2158 {
2159 'block-key' => $self->func('nb_single_one_line'),
2160 'flow-in' => [ $self->func('nb_single_multi_line'), $n ],
2161 'flow-key' => $self->func('nb_single_one_line'),
2162 'flow-out' => [ $self->func('nb_single_multi_line'), $n ],
2163 }
2164 );
2165 2 };
2166  
2167  
2168  
2169 # [122]
2170 # nb-single-one-line ::=
2171 # nb-single-char*
2172  
2173 rule '122', nb_single_one_line => sub {
2174 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2175 0 debug_rule("nb_single_one_line") if DEBUG;
2176 0 $self->rep(0, undef, $self->func('nb_single_char'));
2177 2 };
2178  
2179  
2180  
2181 # [123]
2182 # nb-ns-single-in-line ::=
2183 # ( s-white* ns-single-char )*
2184  
2185 rule '123', nb_ns_single_in_line => sub {
2186 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2187 0 debug_rule("nb_ns_single_in_line") if DEBUG;
2188 0 $self->rep(0, undef,
2189 $self->all(
2190 $self->rep(0, undef, $self->func('s_white')),
2191 $self->func('ns_single_char')
2192 ));
2193 2 };
2194  
2195  
2196  
2197 # [124]
2198 # s-single-next-line(n) ::=
2199 # s-flow-folded(n)
2200 # ( ns-single-char nb-ns-single-in-line
2201 # ( s-single-next-line(n) | s-white* ) )?
2202  
2203 rule '124', s_single_next_line => sub {
2204 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2205 0 debug_rule("s_single_next_line",$n) if DEBUG;
2206 0 $self->all(
2207 [ $self->func('s_flow_folded'), $n ],
2208 $self->rep(0, 1,
2209 $self->all(
2210 $self->func('ns_single_char'),
2211 $self->func('nb_ns_single_in_line'),
2212 $self->any(
2213 [ $self->func('s_single_next_line'), $n ],
2214 $self->rep(0, undef, $self->func('s_white'))
2215 )
2216 ))
2217 );
2218 2 };
2219  
2220  
2221  
2222 # [125]
2223 # nb-single-multi-line(n) ::=
2224 # nb-ns-single-in-line
2225 # ( s-single-next-line(n) | s-white* )
2226  
2227 rule '125', nb_single_multi_line => sub {
2228 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2229 0 debug_rule("nb_single_multi_line",$n) if DEBUG;
2230 0 $self->all(
2231 $self->func('nb_ns_single_in_line'),
2232 $self->any(
2233 [ $self->func('s_single_next_line'), $n ],
2234 $self->rep(0, undef, $self->func('s_white'))
2235 )
2236 );
2237 2 };
2238  
2239  
2240  
2241 # [126]
2242 # ns-plain-first(c) ::=
2243 # ( ns-char - c-indicator )
2244 # | ( ( '?' | ':' | '-' )
2245 # <followed_by_an_ns-plain-safe(c)> )
2246  
2247 rule '126', ns_plain_first => sub {
2248 16 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2249 16 debug_rule("ns_plain_first",$c) if DEBUG;
2250 16 $self->any(
2251 $self->but(
2252 $self->func('ns_char'),
2253 $self->func('c_indicator')
2254 ),
2255 $self->all(
2256 $self->any(
2257 $self->chr('?'),
2258 $self->chr(':'),
2259 $self->chr('-')
2260 ),
2261 $self->chk('=', [ $self->func('ns_plain_safe'), $c ])
2262 )
2263 );
2264 2 };
2265  
2266  
2267  
2268 # [127]
2269 # ns-plain-safe(c) ::=
2270 # ( c = flow-out => ns-plain-safe-out )
2271 # ( c = flow-in => ns-plain-safe-in )
2272 # ( c = block-key => ns-plain-safe-out )
2273 # ( c = flow-key => ns-plain-safe-in )
2274  
2275 rule '127', ns_plain_safe => sub {
2276 24 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2277 24 debug_rule("ns_plain_safe",$c) if DEBUG;
2278 24 $self->case(
2279 $c,
2280 {
2281 'block-key' => $self->func('ns_plain_safe_out'),
2282 'flow-in' => $self->func('ns_plain_safe_in'),
2283 'flow-key' => $self->func('ns_plain_safe_in'),
2284 'flow-out' => $self->func('ns_plain_safe_out'),
2285 }
2286 );
2287 2 };
2288  
2289  
2290  
2291 # [128]
2292 # ns-plain-safe-out ::=
2293 # ns-char
2294  
2295 rule '128', ns_plain_safe_out => sub {
2296 16 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2297 16 debug_rule("ns_plain_safe_out") if DEBUG;
2298 16 $self->func('ns_char');
2299 2 };
2300  
2301  
2302  
2303 # [129]
2304 # ns-plain-safe-in ::=
2305 # ns-char - c-flow-indicator
2306  
2307 rule '129', ns_plain_safe_in => sub {
2308 8 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2309 8 debug_rule("ns_plain_safe_in") if DEBUG;
2310 8 $self->but(
2311 $self->func('ns_char'),
2312 $self->func('c_flow_indicator')
2313 );
2314 2 };
2315  
2316  
2317  
2318 # [130]
2319 # ns-plain-char(c) ::=
2320 # ( ns-plain-safe(c) - ':' - '#' )
2321 # | ( <an_ns-char_preceding> '#' )
2322 # | ( ':' <followed_by_an_ns-plain-safe(c)> )
2323  
2324 rule '130', ns_plain_char => sub {
2325 20 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2326 20 debug_rule("ns_plain_char",$c) if DEBUG;
2327 20 $self->any(
2328 $self->but(
2329 [ $self->func('ns_plain_safe'), $c ],
2330 $self->chr(':'),
2331 $self->chr('#')
2332 ),
2333 $self->all(
2334 $self->chk('<=', $self->func('ns_char')),
2335 $self->chr('#')
2336 ),
2337 $self->all(
2338 $self->chr(':'),
2339 $self->chk('=', [ $self->func('ns_plain_safe'), $c ])
2340 )
2341 );
2342 2 };
2343  
2344  
2345  
2346 # [131]
2347 # ns-plain(n,c) ::=
2348 # ( c = flow-out => ns-plain-multi-line(n,c) )
2349 # ( c = flow-in => ns-plain-multi-line(n,c) )
2350 # ( c = block-key => ns-plain-one-line(c) )
2351 # ( c = flow-key => ns-plain-one-line(c) )
2352  
2353 rule '131', ns_plain => sub {
2354 16 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2355 16 debug_rule("ns_plain",$n,$c) if DEBUG;
2356 16 $self->case(
2357 $c,
2358 {
2359 'block-key' => [ $self->func('ns_plain_one_line'), $c ],
2360 'flow-in' => [ $self->func('ns_plain_multi_line'), $n, $c ],
2361 'flow-key' => [ $self->func('ns_plain_one_line'), $c ],
2362 'flow-out' => [ $self->func('ns_plain_multi_line'), $n, $c ],
2363 }
2364 );
2365 2 };
2366  
2367  
2368  
2369 # [132]
2370 # nb-ns-plain-in-line(c) ::=
2371 # ( s-white*
2372 # ns-plain-char(c) )*
2373  
2374 rule '132', nb_ns_plain_in_line => sub {
2375 12 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2376 12 debug_rule("nb_ns_plain_in_line",$c) if DEBUG;
2377 12 $self->rep(0, undef,
2378 $self->all(
2379 $self->rep(0, undef, $self->func('s_white')),
2380 [ $self->func('ns_plain_char'), $c ]
2381 ));
2382 2 };
2383  
2384  
2385  
2386 # [133]
2387 # ns-plain-one-line(c) ::=
2388 # ns-plain-first(c)
2389 # nb-ns-plain-in-line(c)
2390  
2391 rule '133', ns_plain_one_line => sub {
2392 16 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2393 16 debug_rule("ns_plain_one_line",$c) if DEBUG;
2394 16 $self->all(
2395 [ $self->func('ns_plain_first'), $c ],
2396 [ $self->func('nb_ns_plain_in_line'), $c ]
2397 );
2398 2 };
2399  
2400  
2401  
2402 # [134]
2403 # s-ns-plain-next-line(n,c) ::=
2404 # s-flow-folded(n)
2405 # ns-plain-char(c) nb-ns-plain-in-line(c)
2406  
2407 rule '134', s_ns_plain_next_line => sub {
2408 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2409 4 debug_rule("s_ns_plain_next_line",$n,$c) if DEBUG;
2410 4 $self->all(
2411 [ $self->func('s_flow_folded'), $n ],
2412 [ $self->func('ns_plain_char'), $c ],
2413 [ $self->func('nb_ns_plain_in_line'), $c ]
2414 );
2415 2 };
2416  
2417  
2418  
2419 # [135]
2420 # ns-plain-multi-line(n,c) ::=
2421 # ns-plain-one-line(c)
2422 # s-ns-plain-next-line(n,c)*
2423  
2424 rule '135', ns_plain_multi_line => sub {
2425 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2426 6 debug_rule("ns_plain_multi_line",$n,$c) if DEBUG;
2427 6 $self->all(
2428 [ $self->func('ns_plain_one_line'), $c ],
2429 $self->rep(0, undef, [ $self->func('s_ns_plain_next_line'), $n, $c ])
2430 );
2431 2 };
2432  
2433  
2434  
2435 # [136]
2436 # in-flow(c) ::=
2437 # ( c = flow-out => flow-in )
2438 # ( c = flow-in => flow-in )
2439 # ( c = block-key => flow-key )
2440 # ( c = flow-key => flow-key )
2441  
2442 rule '136', in_flow => sub {
2443 2 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2444 2 debug_rule("in_flow",$c) if DEBUG;
2445 2 $self->flip(
2446 $c,
2447 {
2448 'block-key' => "flow-key",
2449 'flow-in' => "flow-in",
2450 'flow-key' => "flow-key",
2451 'flow-out' => "flow-in",
2452 }
2453 );
2454 2 };
2455  
2456  
2457  
2458 # [137]
2459 # c-flow-sequence(n,c) ::=
2460 # '[' s-separate(n,c)?
2461 # ns-s-flow-seq-entries(n,in-flow(c))? ']'
2462  
2463 rule '137', c_flow_sequence => sub {
2464 12 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2465 12 debug_rule("c_flow_sequence",$n,$c) if DEBUG;
2466 12 $self->all(
2467 $self->chr('['),
2468 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2469 $self->rep2(0, 1, [ $self->func('ns_s_flow_seq_entries'), $n, [ $self->func('in_flow'), $c ] ]),
2470 $self->chr(']')
2471 );
2472 2 };
2473  
2474  
2475  
2476 # [138]
2477 # ns-s-flow-seq-entries(n,c) ::=
2478 # ns-flow-seq-entry(n,c)
2479 # s-separate(n,c)?
2480 # ( ',' s-separate(n,c)?
2481 # ns-s-flow-seq-entries(n,c)? )?
2482  
2483 rule '138', ns_s_flow_seq_entries => sub {
2484 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2485 4 debug_rule("ns_s_flow_seq_entries",$n,$c) if DEBUG;
2486 4 $self->all(
2487 [ $self->func('ns_flow_seq_entry'), $n, $c ],
2488 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2489 $self->rep2(0, 1,
2490 $self->all(
2491 $self->chr(','),
2492 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2493 $self->rep2(0, 1, [ $self->func('ns_s_flow_seq_entries'), $n, $c ])
2494 ))
2495 );
2496 2 };
2497  
2498  
2499  
2500 # [139]
2501 # ns-flow-seq-entry(n,c) ::=
2502 # ns-flow-pair(n,c) | ns-flow-node(n,c)
2503  
2504 rule '139', ns_flow_seq_entry => sub {
2505 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2506 4 debug_rule("ns_flow_seq_entry",$n,$c) if DEBUG;
2507 4 $self->any(
2508 [ $self->func('ns_flow_pair'), $n, $c ],
2509 [ $self->func('ns_flow_node'), $n, $c ]
2510 );
2511 2 };
2512  
2513  
2514  
2515 # [140]
2516 # c-flow-mapping(n,c) ::=
2517 # '{' s-separate(n,c)?
2518 # ns-s-flow-map-entries(n,in-flow(c))? '}'
2519  
2520 rule '140', c_flow_mapping => sub {
2521 10 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2522 10 debug_rule("c_flow_mapping",$n,$c) if DEBUG;
2523 10 $self->all(
2524 $self->chr('{'),
2525 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2526 $self->rep2(0, 1, [ $self->func('ns_s_flow_map_entries'), $n, [ $self->func('in_flow'), $c ] ]),
2527 $self->chr('}')
2528 );
2529 2 };
2530  
2531  
2532  
2533 # [141]
2534 # ns-s-flow-map-entries(n,c) ::=
2535 # ns-flow-map-entry(n,c)
2536 # s-separate(n,c)?
2537 # ( ',' s-separate(n,c)?
2538 # ns-s-flow-map-entries(n,c)? )?
2539  
2540 rule '141', ns_s_flow_map_entries => sub {
2541 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2542 0 debug_rule("ns_s_flow_map_entries",$n,$c) if DEBUG;
2543 0 $self->all(
2544 [ $self->func('ns_flow_map_entry'), $n, $c ],
2545 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2546 $self->rep2(0, 1,
2547 $self->all(
2548 $self->chr(','),
2549 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2550 $self->rep2(0, 1, [ $self->func('ns_s_flow_map_entries'), $n, $c ])
2551 ))
2552 );
2553 2 };
2554  
2555  
2556  
2557 # [142]
2558 # ns-flow-map-entry(n,c) ::=
2559 # ( '?' s-separate(n,c)
2560 # ns-flow-map-explicit-entry(n,c) )
2561 # | ns-flow-map-implicit-entry(n,c)
2562  
2563 rule '142', ns_flow_map_entry => sub {
2564 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2565 0 debug_rule("ns_flow_map_entry",$n,$c) if DEBUG;
2566 0 $self->any(
2567 $self->all(
2568 $self->chr('?'),
2569 $self->chk(
2570 '=',
2571 $self->any(
2572 $self->func('end_of_stream'),
2573 $self->func('s_white'),
2574 $self->func('b_break')
2575 )
2576 ),
2577 [ $self->func('s_separate'), $n, $c ],
2578 [ $self->func('ns_flow_map_explicit_entry'), $n, $c ]
2579 ),
2580 [ $self->func('ns_flow_map_implicit_entry'), $n, $c ]
2581 );
2582 2 };
2583  
2584  
2585  
2586 # [143]
2587 # ns-flow-map-explicit-entry(n,c) ::=
2588 # ns-flow-map-implicit-entry(n,c)
2589 # | ( e-node
2590 # e-node )
2591  
2592 rule '143', ns_flow_map_explicit_entry => sub {
2593 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2594 0 debug_rule("ns_flow_map_explicit_entry",$n,$c) if DEBUG;
2595 0 $self->any(
2596 [ $self->func('ns_flow_map_implicit_entry'), $n, $c ],
2597 $self->all(
2598 $self->func('e_node'),
2599 $self->func('e_node')
2600 )
2601 );
2602 2 };
2603  
2604  
2605  
2606 # [144]
2607 # ns-flow-map-implicit-entry(n,c) ::=
2608 # ns-flow-map-yaml-key-entry(n,c)
2609 # | c-ns-flow-map-empty-key-entry(n,c)
2610 # | c-ns-flow-map-json-key-entry(n,c)
2611  
2612 rule '144', ns_flow_map_implicit_entry => sub {
2613 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2614 0 debug_rule("ns_flow_map_implicit_entry",$n,$c) if DEBUG;
2615 0 $self->any(
2616 [ $self->func('ns_flow_map_yaml_key_entry'), $n, $c ],
2617 [ $self->func('c_ns_flow_map_empty_key_entry'), $n, $c ],
2618 [ $self->func('c_ns_flow_map_json_key_entry'), $n, $c ]
2619 );
2620 2 };
2621  
2622  
2623  
2624 # [145]
2625 # ns-flow-map-yaml-key-entry(n,c) ::=
2626 # ns-flow-yaml-node(n,c)
2627 # ( ( s-separate(n,c)?
2628 # c-ns-flow-map-separate-value(n,c) )
2629 # | e-node )
2630  
2631 rule '145', ns_flow_map_yaml_key_entry => sub {
2632 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2633 0 debug_rule("ns_flow_map_yaml_key_entry",$n,$c) if DEBUG;
2634 0 $self->all(
2635 [ $self->func('ns_flow_yaml_node'), $n, $c ],
2636 $self->any(
2637 $self->all(
2638 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2639 [ $self->func('c_ns_flow_map_separate_value'), $n, $c ]
2640 ),
2641 $self->func('e_node')
2642 )
2643 );
2644 2 };
2645  
2646  
2647  
2648 # [146]
2649 # c-ns-flow-map-empty-key-entry(n,c) ::=
2650 # e-node
2651 # c-ns-flow-map-separate-value(n,c)
2652  
2653 rule '146', c_ns_flow_map_empty_key_entry => sub {
2654 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2655 4 debug_rule("c_ns_flow_map_empty_key_entry",$n,$c) if DEBUG;
2656 4 $self->all(
2657 $self->func('e_node'),
2658 [ $self->func('c_ns_flow_map_separate_value'), $n, $c ]
2659 );
2660 2 };
2661  
2662  
2663  
2664 # [147]
2665 # c-ns-flow-map-separate-value(n,c) ::=
2666 # ':' <not_followed_by_an_ns-plain-safe(c)>
2667 # ( ( s-separate(n,c) ns-flow-node(n,c) )
2668 # | e-node )
2669  
2670 rule '147', c_ns_flow_map_separate_value => sub {
2671 8 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2672 8 debug_rule("c_ns_flow_map_separate_value",$n,$c) if DEBUG;
2673 8 $self->all(
2674 $self->chr(':'),
2675 $self->chk('!', [ $self->func('ns_plain_safe'), $c ]),
2676 $self->any(
2677 $self->all(
2678 [ $self->func('s_separate'), $n, $c ],
2679 [ $self->func('ns_flow_node'), $n, $c ]
2680 ),
2681 $self->func('e_node')
2682 )
2683 );
2684 2 };
2685  
2686  
2687  
2688 # [148]
2689 # c-ns-flow-map-json-key-entry(n,c) ::=
2690 # c-flow-json-node(n,c)
2691 # ( ( s-separate(n,c)?
2692 # c-ns-flow-map-adjacent-value(n,c) )
2693 # | e-node )
2694  
2695 rule '148', c_ns_flow_map_json_key_entry => sub {
2696 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2697 0 debug_rule("c_ns_flow_map_json_key_entry",$n,$c) if DEBUG;
2698 0 $self->all(
2699 [ $self->func('c_flow_json_node'), $n, $c ],
2700 $self->any(
2701 $self->all(
2702 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2703 [ $self->func('c_ns_flow_map_adjacent_value'), $n, $c ]
2704 ),
2705 $self->func('e_node')
2706 )
2707 );
2708 2 };
2709  
2710  
2711  
2712 # [149]
2713 # c-ns-flow-map-adjacent-value(n,c) ::=
2714 # ':' ( (
2715 # s-separate(n,c)?
2716 # ns-flow-node(n,c) )
2717 # | e-node )
2718  
2719 rule '149', c_ns_flow_map_adjacent_value => sub {
2720 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
2721 0 debug_rule("c_ns_flow_map_adjacent_value",$n,$c) if DEBUG;
2722 0 $self->all(
2723 $self->chr(':'),
2724 $self->any(
2725 $self->all(
2726 $self->rep(0, 1, [ $self->func('s_separate'), $n, $c ]),
2727 [ $self->func('ns_flow_node'), $n, $c ]
2728 ),
2729 $self->func('e_node')
2730 )
2731 );
2732 2 };
2733  
2734  
2735  
2736 # [150]
2737 # ns-flow-pair(n,c) ::=
2738 # ( '?' s-separate(n,c)
2739 # ns-flow-map-explicit-entry(n,c) )
2740 # | ns-flow-pair-entry(n,c)
2741  
2742 rule '150', ns_flow_pair => sub {
2743 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2744 4 debug_rule("ns_flow_pair",$n,$c) if DEBUG;
2745 4 $self->any(
2746 $self->all(
2747 $self->chr('?'),
2748 $self->chk(
2749 '=',
2750 $self->any(
2751 $self->func('end_of_stream'),
2752 $self->func('s_white'),
2753 $self->func('b_break')
2754 )
2755 ),
2756 [ $self->func('s_separate'), $n, $c ],
2757 [ $self->func('ns_flow_map_explicit_entry'), $n, $c ]
2758 ),
2759 [ $self->func('ns_flow_pair_entry'), $n, $c ]
2760 );
2761 2 };
2762  
2763  
2764  
2765 # [151]
2766 # ns-flow-pair-entry(n,c) ::=
2767 # ns-flow-pair-yaml-key-entry(n,c)
2768 # | c-ns-flow-map-empty-key-entry(n,c)
2769 # | c-ns-flow-pair-json-key-entry(n,c)
2770  
2771 rule '151', ns_flow_pair_entry => sub {
2772 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2773 4 debug_rule("ns_flow_pair_entry",$n,$c) if DEBUG;
2774 4 $self->any(
2775 [ $self->func('ns_flow_pair_yaml_key_entry'), $n, $c ],
2776 [ $self->func('c_ns_flow_map_empty_key_entry'), $n, $c ],
2777 [ $self->func('c_ns_flow_pair_json_key_entry'), $n, $c ]
2778 );
2779 2 };
2780  
2781  
2782  
2783 # [152]
2784 # ns-flow-pair-yaml-key-entry(n,c) ::=
2785 # ns-s-implicit-yaml-key(flow-key)
2786 # c-ns-flow-map-separate-value(n,c)
2787  
2788 rule '152', ns_flow_pair_yaml_key_entry => sub {
2789 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2790 4 debug_rule("ns_flow_pair_yaml_key_entry",$n,$c) if DEBUG;
2791 4 $self->all(
2792 [ $self->func('ns_s_implicit_yaml_key'), "flow-key" ],
2793 [ $self->func('c_ns_flow_map_separate_value'), $n, $c ]
2794 );
2795 2 };
2796  
2797  
2798  
2799 # [153]
2800 # c-ns-flow-pair-json-key-entry(n,c) ::=
2801 # c-s-implicit-json-key(flow-key)
2802 # c-ns-flow-map-adjacent-value(n,c)
2803  
2804 rule '153', c_ns_flow_pair_json_key_entry => sub {
2805 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2806 4 debug_rule("c_ns_flow_pair_json_key_entry",$n,$c) if DEBUG;
2807 4 $self->all(
2808 [ $self->func('c_s_implicit_json_key'), "flow-key" ],
2809 [ $self->func('c_ns_flow_map_adjacent_value'), $n, $c ]
2810 );
2811 2 };
2812  
2813  
2814  
2815 # [154]
2816 # ns-s-implicit-yaml-key(c) ::=
2817 # ns-flow-yaml-node(n/a,c)
2818 # s-separate-in-line?
2819 # <at_most_1024_characters_altogether>
2820  
2821 rule '154', ns_s_implicit_yaml_key => sub {
2822 10 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2823 10 debug_rule("ns_s_implicit_yaml_key",$c) if DEBUG;
2824 10 $self->all(
2825 $self->max(1024),
2826 [ $self->func('ns_flow_yaml_node'), undef, $c ],
2827 $self->rep(0, 1, $self->func('s_separate_in_line'))
2828 );
2829 2 };
2830  
2831  
2832  
2833 # [155]
2834 # c-s-implicit-json-key(c) ::=
2835 # c-flow-json-node(n/a,c)
2836 # s-separate-in-line?
2837 # <at_most_1024_characters_altogether>
2838  
2839 rule '155', c_s_implicit_json_key => sub {
2840 10 ▶ my ($self, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2841 10 debug_rule("c_s_implicit_json_key",$c) if DEBUG;
2842 10 $self->all(
2843 $self->max(1024),
2844 [ $self->func('c_flow_json_node'), undef, $c ],
2845 $self->rep(0, 1, $self->func('s_separate_in_line'))
2846 );
2847 2 };
2848  
2849  
2850  
2851 # [156]
2852 # ns-flow-yaml-content(n,c) ::=
2853 # ns-plain(n,c)
2854  
2855 rule '156', ns_flow_yaml_content => sub {
2856 16 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2857 16 debug_rule("ns_flow_yaml_content",$n,$c) if DEBUG;
2858 16 [ $self->func('ns_plain'), $n, $c ];
2859 2 };
2860  
2861  
2862  
2863 # [157]
2864 # c-flow-json-content(n,c) ::=
2865 # c-flow-sequence(n,c) | c-flow-mapping(n,c)
2866 # | c-single-quoted(n,c) | c-double-quoted(n,c)
2867  
2868 rule '157', c_flow_json_content => sub {
2869 12 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2870 12 debug_rule("c_flow_json_content",$n,$c) if DEBUG;
2871 12 $self->any(
2872 [ $self->func('c_flow_sequence'), $n, $c ],
2873 [ $self->func('c_flow_mapping'), $n, $c ],
2874 [ $self->func('c_single_quoted'), $n, $c ],
2875 [ $self->func('c_double_quoted'), $n, $c ]
2876 );
2877 2 };
2878  
2879  
2880  
2881 # [158]
2882 # ns-flow-content(n,c) ::=
2883 # ns-flow-yaml-content(n,c) | c-flow-json-content(n,c)
2884  
2885 rule '158', ns_flow_content => sub {
2886 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2887 6 debug_rule("ns_flow_content",$n,$c) if DEBUG;
2888 6 $self->any(
2889 [ $self->func('ns_flow_yaml_content'), $n, $c ],
2890 [ $self->func('c_flow_json_content'), $n, $c ]
2891 );
2892 2 };
2893  
2894  
2895  
2896 # [159]
2897 # ns-flow-yaml-node(n,c) ::=
2898 # c-ns-alias-node
2899 # | ns-flow-yaml-content(n,c)
2900 # | ( c-ns-properties(n,c)
2901 # ( ( s-separate(n,c)
2902 # ns-flow-yaml-content(n,c) )
2903 # | e-scalar ) )
2904  
2905 rule '159', ns_flow_yaml_node => sub {
2906 10 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2907 10 debug_rule("ns_flow_yaml_node",$n,$c) if DEBUG;
2908 10 $self->any(
2909 $self->func('c_ns_alias_node'),
2910 [ $self->func('ns_flow_yaml_content'), $n, $c ],
2911 $self->all(
2912 [ $self->func('c_ns_properties'), $n, $c ],
2913 $self->any(
2914 $self->all(
2915 [ $self->func('s_separate'), $n, $c ],
2916 [ $self->func('ns_flow_content'), $n, $c ]
2917 ),
2918 $self->func('e_scalar')
2919 )
2920 )
2921 );
2922 2 };
2923  
2924  
2925  
2926 # [160]
2927 # c-flow-json-node(n,c) ::=
2928 # ( c-ns-properties(n,c)
2929 # s-separate(n,c) )?
2930 # c-flow-json-content(n,c)
2931  
2932 rule '160', c_flow_json_node => sub {
2933 10 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2934 10 debug_rule("c_flow_json_node",$n,$c) if DEBUG;
2935 10 $self->all(
2936 $self->rep(0, 1,
2937 $self->all(
2938 [ $self->func('c_ns_properties'), $n, $c ],
2939 [ $self->func('s_separate'), $n, $c ]
2940 )),
2941 [ $self->func('c_flow_json_content'), $n, $c ]
2942 );
2943 2 };
2944  
2945  
2946  
2947 # [161]
2948 # ns-flow-node(n,c) ::=
2949 # c-ns-alias-node
2950 # | ns-flow-content(n,c)
2951 # | ( c-ns-properties(n,c)
2952 # ( ( s-separate(n,c)
2953 # ns-flow-content(n,c) )
2954 # | e-scalar ) )
2955  
2956 rule '161', ns_flow_node => sub {
2957 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2958 6 debug_rule("ns_flow_node",$n,$c) if DEBUG;
2959 6 $self->any(
2960 $self->func('c_ns_alias_node'),
2961 [ $self->func('ns_flow_content'), $n, $c ],
2962 $self->all(
2963 [ $self->func('c_ns_properties'), $n, $c ],
2964 $self->any(
2965 $self->all(
2966 [ $self->func('s_separate'), $n, $c ],
2967 [ $self->func('ns_flow_content'), $n, $c ]
2968 ),
2969 $self->func('e_scalar')
2970 )
2971 )
2972 );
2973 2 };
2974  
2975  
2976  
2977 # [162]
2978 # c-b-block-header(m,t) ::=
2979 # ( ( c-indentation-indicator(m)
2980 # c-chomping-indicator(t) )
2981 # | ( c-chomping-indicator(t)
2982 # c-indentation-indicator(m) ) )
2983 # s-b-comment
2984  
2985 rule '162', c_b_block_header => sub {
2986 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
2987 2 debug_rule("c_b_block_header",$n) if DEBUG;
2988 2 $self->all(
2989 $self->any(
2990 $self->all(
2991 [ $self->func('c_indentation_indicator'), $n ],
2992 $self->func('c_chomping_indicator'),
2993 $self->chk(
2994 '=',
2995 $self->any(
2996 $self->func('end_of_stream'),
2997 $self->func('s_white'),
2998 $self->func('b_break')
2999 )
3000 )
3001 ),
3002 $self->all(
3003 $self->func('c_chomping_indicator'),
3004 [ $self->func('c_indentation_indicator'), $n ],
3005 $self->chk(
3006 '=',
3007 $self->any(
3008 $self->func('end_of_stream'),
3009 $self->func('s_white'),
3010 $self->func('b_break')
3011 )
3012 )
3013 )
3014 ),
3015 $self->func('s_b_comment')
3016 );
3017 2 };
3018  
3019  
3020  
3021 # [163]
3022 # c-indentation-indicator(m) ::=
3023 # ( ns-dec-digit => m = ns-dec-digit - x:30 )
3024 # ( <empty> => m = auto-detect() )
3025  
3026 rule '163', c_indentation_indicator => sub {
3027 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3028 2 debug_rule("c_indentation_indicator",$n) if DEBUG;
3029 2 $self->any(
3030 $self->if($self->rng("\x{31}", "\x{39}"), $self->set('m', $self->ord($self->func('match')))),
3031 $self->if($self->func('empty'), $self->set('m', [ $self->func('auto_detect'), $n ]))
3032 );
3033 2 };
3034  
3035  
3036  
3037 # [164]
3038 # c-chomping-indicator(t) ::=
3039 # ( '-' => t = strip )
3040 # ( '+' => t = keep )
3041 # ( <empty> => t = clip )
3042  
3043 rule '164', c_chomping_indicator => sub {
3044 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3045 2 debug_rule("c_chomping_indicator") if DEBUG;
3046 2 $self->any(
3047 $self->if($self->chr('-'), $self->set('t', "strip")),
3048 $self->if($self->chr('+'), $self->set('t', "keep")),
3049 $self->if($self->func('empty'), $self->set('t', "clip"))
3050 );
3051 2 };
3052  
3053  
3054  
3055 # [165]
3056 # b-chomped-last(t) ::=
3057 # ( t = strip => b-non-content | <end_of_file> )
3058 # ( t = clip => b-as-line-feed | <end_of_file> )
3059 # ( t = keep => b-as-line-feed | <end_of_file> )
3060  
3061 rule '165', b_chomped_last => sub {
3062 2 ▶ my ($self, $t) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3063 2 debug_rule("b_chomped_last",$t) if DEBUG;
3064 2 $self->case(
3065 $t,
3066 {
3067 'clip' => $self->any( $self->func('b_as_line_feed'), $self->func('end_of_stream') ),
3068 'keep' => $self->any( $self->func('b_as_line_feed'), $self->func('end_of_stream') ),
3069 'strip' => $self->any( $self->func('b_non_content'), $self->func('end_of_stream') ),
3070 }
3071 );
3072 2 };
3073  
3074  
3075  
3076 # [166]
3077 # l-chomped-empty(n,t) ::=
3078 # ( t = strip => l-strip-empty(n) )
3079 # ( t = clip => l-strip-empty(n) )
3080 # ( t = keep => l-keep-empty(n) )
3081  
3082 rule '166', l_chomped_empty => sub {
3083 2 ▶ my ($self, $n, $t) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3084 2 debug_rule("l_chomped_empty",$n,$t) if DEBUG;
3085 2 $self->case(
3086 $t,
3087 {
3088 'clip' => [ $self->func('l_strip_empty'), $n ],
3089 'keep' => [ $self->func('l_keep_empty'), $n ],
3090 'strip' => [ $self->func('l_strip_empty'), $n ],
3091 }
3092 );
3093 2 };
3094  
3095  
3096  
3097 # [167]
3098 # l-strip-empty(n) ::=
3099 # ( s-indent(<=n) b-non-content )*
3100 # l-trail-comments(n)?
3101  
3102 rule '167', l_strip_empty => sub {
3103 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3104 2 debug_rule("l_strip_empty",$n) if DEBUG;
3105 2 $self->all(
3106 $self->rep(0, undef,
3107 $self->all(
3108 [ $self->func('s_indent_le'), $n ],
3109 $self->func('b_non_content')
3110 )),
3111 $self->rep2(0, 1, [ $self->func('l_trail_comments'), $n ])
3112 );
3113 2 };
3114  
3115  
3116  
3117 # [168]
3118 # l-keep-empty(n) ::=
3119 # l-empty(n,block-in)*
3120 # l-trail-comments(n)?
3121  
3122 rule '168', l_keep_empty => sub {
3123 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3124 0 debug_rule("l_keep_empty",$n) if DEBUG;
3125 0 $self->all(
3126 $self->rep(0, undef, [ $self->func('l_empty'), $n, "block-in" ]),
3127 $self->rep2(0, 1, [ $self->func('l_trail_comments'), $n ])
3128 );
3129 2 };
3130  
3131  
3132  
3133 # [169]
3134 # l-trail-comments(n) ::=
3135 # s-indent(<n)
3136 # c-nb-comment-text b-comment
3137 # l-comment*
3138  
3139 rule '169', l_trail_comments => sub {
3140 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3141 2 debug_rule("l_trail_comments",$n) if DEBUG;
3142 2 $self->all(
3143 [ $self->func('s_indent_lt'), $n ],
3144 $self->func('c_nb_comment_text'),
3145 $self->func('b_comment'),
3146 $self->rep(0, undef, $self->func('l_comment'))
3147 );
3148 2 };
3149  
3150  
3151  
3152 # [170]
3153 # c-l+literal(n) ::=
3154 # '|' c-b-block-header(m,t)
3155 # l-literal-content(n+m,t)
3156  
3157 rule '170', c_l_literal => sub {
3158 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3159 6 debug_rule("c_l_literal",$n) if DEBUG;
3160 6 $self->all(
3161 $self->chr('|'),
3162 [ $self->func('c_b_block_header'), $n ],
3163 [ $self->func('l_literal_content'), $self->add($n, $self->m()), $self->t() ]
3164 );
3165 2 };
3166  
3167  
3168  
3169 # [171]
3170 # l-nb-literal-text(n) ::=
3171 # l-empty(n,block-in)*
3172 # s-indent(n) nb-char+
3173  
3174 rule '171', l_nb_literal_text => sub {
3175 8 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3176 8 debug_rule("l_nb_literal_text",$n) if DEBUG;
3177 8 $self->all(
3178 $self->rep(0, undef, [ $self->func('l_empty'), $n, "block-in" ]),
3179 [ $self->func('s_indent'), $n ],
3180 $self->rep2(1, undef, $self->func('nb_char'))
3181 );
3182 2 };
3183  
3184  
3185  
3186 # [172]
3187 # b-nb-literal-next(n) ::=
3188 # b-as-line-feed
3189 # l-nb-literal-text(n)
3190  
3191 rule '172', b_nb_literal_next => sub {
3192 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3193 6 debug_rule("b_nb_literal_next",$n) if DEBUG;
3194 6 $self->all(
3195 $self->func('b_as_line_feed'),
3196 [ $self->func('l_nb_literal_text'), $n ]
3197 );
3198 2 };
3199  
3200  
3201  
3202 # [173]
3203 # l-literal-content(n,t) ::=
3204 # ( l-nb-literal-text(n)
3205 # b-nb-literal-next(n)*
3206 # b-chomped-last(t) )?
3207 # l-chomped-empty(n,t)
3208  
3209 rule '173', l_literal_content => sub {
3210 2 ▶ my ($self, $n, $t) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3211 2 debug_rule("l_literal_content",$n,$t) if DEBUG;
3212 2 $self->all(
3213 $self->rep(0, 1,
3214 $self->all(
3215 [ $self->func('l_nb_literal_text'), $n ],
3216 $self->rep(0, undef, [ $self->func('b_nb_literal_next'), $n ]),
3217 [ $self->func('b_chomped_last'), $t ]
3218 )),
3219 [ $self->func('l_chomped_empty'), $n, $t ]
3220 );
3221 2 };
3222  
3223  
3224  
3225 # [174]
3226 # c-l+folded(n) ::=
3227 # '>' c-b-block-header(m,t)
3228 # l-folded-content(n+m,t)
3229  
3230 rule '174', c_l_folded => sub {
3231 4 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3232 4 debug_rule("c_l_folded",$n) if DEBUG;
3233 4 $self->all(
3234 $self->chr('>'),
3235 [ $self->func('c_b_block_header'), $n ],
3236 [ $self->func('l_folded_content'), $self->add($n, $self->m()), $self->t() ]
3237 );
3238 2 };
3239  
3240  
3241  
3242 # [175]
3243 # s-nb-folded-text(n) ::=
3244 # s-indent(n) ns-char
3245 # nb-char*
3246  
3247 rule '175', s_nb_folded_text => sub {
3248 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3249 0 debug_rule("s_nb_folded_text",$n) if DEBUG;
3250 0 $self->all(
3251 [ $self->func('s_indent'), $n ],
3252 $self->func('ns_char'),
3253 $self->rep(0, undef, $self->func('nb_char'))
3254 );
3255 2 };
3256  
3257  
3258  
3259 # [176]
3260 # l-nb-folded-lines(n) ::=
3261 # s-nb-folded-text(n)
3262 # ( b-l-folded(n,block-in) s-nb-folded-text(n) )*
3263  
3264 rule '176', l_nb_folded_lines => sub {
3265 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3266 0 debug_rule("l_nb_folded_lines",$n) if DEBUG;
3267 0 $self->all(
3268 [ $self->func('s_nb_folded_text'), $n ],
3269 $self->rep(0, undef,
3270 $self->all(
3271 [ $self->func('b_l_folded'), $n, "block-in" ],
3272 [ $self->func('s_nb_folded_text'), $n ]
3273 ))
3274 );
3275 2 };
3276  
3277  
3278  
3279 # [177]
3280 # s-nb-spaced-text(n) ::=
3281 # s-indent(n) s-white
3282 # nb-char*
3283  
3284 rule '177', s_nb_spaced_text => sub {
3285 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3286 0 debug_rule("s_nb_spaced_text",$n) if DEBUG;
3287 0 $self->all(
3288 [ $self->func('s_indent'), $n ],
3289 $self->func('s_white'),
3290 $self->rep(0, undef, $self->func('nb_char'))
3291 );
3292 2 };
3293  
3294  
3295  
3296 # [178]
3297 # b-l-spaced(n) ::=
3298 # b-as-line-feed
3299 # l-empty(n,block-in)*
3300  
3301 rule '178', b_l_spaced => sub {
3302 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3303 0 debug_rule("b_l_spaced",$n) if DEBUG;
3304 0 $self->all(
3305 $self->func('b_as_line_feed'),
3306 $self->rep(0, undef, [ $self->func('l_empty'), $n, "block-in" ])
3307 );
3308 2 };
3309  
3310  
3311  
3312 # [179]
3313 # l-nb-spaced-lines(n) ::=
3314 # s-nb-spaced-text(n)
3315 # ( b-l-spaced(n) s-nb-spaced-text(n) )*
3316  
3317 rule '179', l_nb_spaced_lines => sub {
3318 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3319 0 debug_rule("l_nb_spaced_lines",$n) if DEBUG;
3320 0 $self->all(
3321 [ $self->func('s_nb_spaced_text'), $n ],
3322 $self->rep(0, undef,
3323 $self->all(
3324 [ $self->func('b_l_spaced'), $n ],
3325 [ $self->func('s_nb_spaced_text'), $n ]
3326 ))
3327 );
3328 2 };
3329  
3330  
3331  
3332 # [180]
3333 # l-nb-same-lines(n) ::=
3334 # l-empty(n,block-in)*
3335 # ( l-nb-folded-lines(n) | l-nb-spaced-lines(n) )
3336  
3337 rule '180', l_nb_same_lines => sub {
3338 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3339 0 debug_rule("l_nb_same_lines",$n) if DEBUG;
3340 0 $self->all(
3341 $self->rep(0, undef, [ $self->func('l_empty'), $n, "block-in" ]),
3342 $self->any(
3343 [ $self->func('l_nb_folded_lines'), $n ],
3344 [ $self->func('l_nb_spaced_lines'), $n ]
3345 )
3346 );
3347 2 };
3348  
3349  
3350  
3351 # [181]
3352 # l-nb-diff-lines(n) ::=
3353 # l-nb-same-lines(n)
3354 # ( b-as-line-feed l-nb-same-lines(n) )*
3355  
3356 rule '181', l_nb_diff_lines => sub {
3357 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3358 0 debug_rule("l_nb_diff_lines",$n) if DEBUG;
3359 0 $self->all(
3360 [ $self->func('l_nb_same_lines'), $n ],
3361 $self->rep(0, undef,
3362 $self->all(
3363 $self->func('b_as_line_feed'),
3364 [ $self->func('l_nb_same_lines'), $n ]
3365 ))
3366 );
3367 2 };
3368  
3369  
3370  
3371 # [182]
3372 # l-folded-content(n,t) ::=
3373 # ( l-nb-diff-lines(n)
3374 # b-chomped-last(t) )?
3375 # l-chomped-empty(n,t)
3376  
3377 rule '182', l_folded_content => sub {
3378 0 ▶ my ($self, $n, $t) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3379 0 debug_rule("l_folded_content",$n,$t) if DEBUG;
3380 0 $self->all(
3381 $self->rep(0, 1,
3382 $self->all(
3383 [ $self->func('l_nb_diff_lines'), $n ],
3384 [ $self->func('b_chomped_last'), $t ]
3385 )),
3386 [ $self->func('l_chomped_empty'), $n, $t ]
3387 );
3388 2 };
3389  
3390  
3391  
3392 # [183]
3393 # l+block-sequence(n) ::=
3394 # ( s-indent(n+m)
3395 # c-l-block-seq-entry(n+m) )+
3396 # <for_some_fixed_auto-detected_m_>_0>
3397  
3398 rule '183', l_block_sequence => sub {
3399 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.0
3400 2 ▶ my $m = $self->call([$self->func('auto_detect_indent'), $n], 'number') or return false;
Branch: 1 branch
BranchTrueFalseTotal
my $m = $self->call([$self->func("auto_detect_indent"), $n], "number") or return &false() 0 2 2
3401 2 debug_rule("l_block_sequence",$n) if DEBUG;
3402 2 $self->all(
3403 $self->rep(1, undef,
3404 $self->all(
3405 [ $self->func('s_indent'), $self->add($n, $m) ],
3406 [ $self->func('c_l_block_seq_entry'), $self->add($n, $m) ]
3407 ))
3408 );
3409 2 };
3410  
3411  
3412  
3413 # [184]
3414 # c-l-block-seq-entry(n) ::=
3415 # '-' <not_followed_by_an_ns-char>
3416 # s-l+block-indented(n,block-in)
3417  
3418 rule '184', c_l_block_seq_entry => sub {
3419 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3420 2 debug_rule("c_l_block_seq_entry",$n) if DEBUG;
3421 2 $self->all(
3422 $self->chr('-'),
3423 $self->chk('!', $self->func('ns_char')),
3424 [ $self->func('s_l_block_indented'), $n, "block-in" ]
3425 );
3426 2 };
3427  
3428  
3429  
3430 # [185]
3431 # s-l+block-indented(n,c) ::=
3432 # ( s-indent(m)
3433 # ( ns-l-compact-sequence(n+1+m)
3434 # | ns-l-compact-mapping(n+1+m) ) )
3435 # | s-l+block-node(n,c)
3436 # | ( e-node s-l-comments )
3437  
3438 rule '185', s_l_block_indented => sub {
3439 0 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3440 0 my $m = $self->call([$self->func('auto_detect_indent'), $n], 'number');
3441 0 debug_rule("s_l_block_indented",$n,$c) if DEBUG;
3442 0 $self->any(
3443 $self->all(
3444 [ $self->func('s_indent'), $m ],
3445 $self->any(
3446 [ $self->func('ns_l_compact_sequence'), $self->add($n, $self->add(1, $m)) ],
3447 [ $self->func('ns_l_compact_mapping'), $self->add($n, $self->add(1, $m)) ]
3448 )
3449 ),
3450 [ $self->func('s_l_block_node'), $n, $c ],
3451 $self->all(
3452 $self->func('e_node'),
3453 $self->func('s_l_comments')
3454 )
3455 );
3456 2 };
3457  
3458  
3459  
3460 # [186]
3461 # ns-l-compact-sequence(n) ::=
3462 # c-l-block-seq-entry(n)
3463 # ( s-indent(n) c-l-block-seq-entry(n) )*
3464  
3465 rule '186', ns_l_compact_sequence => sub {
3466 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3467 0 debug_rule("ns_l_compact_sequence",$n) if DEBUG;
3468 0 $self->all(
3469 [ $self->func('c_l_block_seq_entry'), $n ],
3470 $self->rep(0, undef,
3471 $self->all(
3472 [ $self->func('s_indent'), $n ],
3473 [ $self->func('c_l_block_seq_entry'), $n ]
3474 ))
3475 );
3476 2 };
3477  
3478  
3479  
3480 # [187]
3481 # l+block-mapping(n) ::=
3482 # ( s-indent(n+m)
3483 # ns-l-block-map-entry(n+m) )+
3484 # <for_some_fixed_auto-detected_m_>_0>
3485  
3486 rule '187', l_block_mapping => sub {
3487 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.0
3488 2 ▶ my $m = $self->call([$self->func('auto_detect_indent'), $n], 'number') or return false;
Branch: 1 branch
BranchTrueFalseTotal
my $m = $self->call([$self->func("auto_detect_indent"), $n], "number") or return &false() 0 2 2
3489 2 debug_rule("l_block_mapping",$n) if DEBUG;
3490 2 $self->all(
3491 $self->rep(1, undef,
3492 $self->all(
3493 [ $self->func('s_indent'), $self->add($n, $m) ],
3494 [ $self->func('ns_l_block_map_entry'), $self->add($n, $m) ]
3495 ))
3496 );
3497 2 };
3498  
3499  
3500  
3501 # [188]
3502 # ns-l-block-map-entry(n) ::=
3503 # c-l-block-map-explicit-entry(n)
3504 # | ns-l-block-map-implicit-entry(n)
3505  
3506 rule '188', ns_l_block_map_entry => sub {
3507 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3508 6 debug_rule("ns_l_block_map_entry",$n) if DEBUG;
3509 6 $self->any(
3510 [ $self->func('c_l_block_map_explicit_entry'), $n ],
3511 [ $self->func('ns_l_block_map_implicit_entry'), $n ]
3512 );
3513 2 };
3514  
3515  
3516  
3517 # [189]
3518 # c-l-block-map-explicit-entry(n) ::=
3519 # c-l-block-map-explicit-key(n)
3520 # ( l-block-map-explicit-value(n)
3521 # | e-node )
3522  
3523 rule '189', c_l_block_map_explicit_entry => sub {
3524 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3525 6 debug_rule("c_l_block_map_explicit_entry",$n) if DEBUG;
3526 6 $self->all(
3527 [ $self->func('c_l_block_map_explicit_key'), $n ],
3528 $self->any(
3529 [ $self->func('l_block_map_explicit_value'), $n ],
3530 $self->func('e_node')
3531 )
3532 );
3533 2 };
3534  
3535  
3536  
3537 # [190]
3538 # c-l-block-map-explicit-key(n) ::=
3539 # '?'
3540 # s-l+block-indented(n,block-out)
3541  
3542 rule '190', c_l_block_map_explicit_key => sub {
3543 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3544 6 debug_rule("c_l_block_map_explicit_key",$n) if DEBUG;
3545 6 $self->all(
3546 $self->chr('?'),
3547 $self->chk(
3548 '=',
3549 $self->any(
3550 $self->func('end_of_stream'),
3551 $self->func('s_white'),
3552 $self->func('b_break')
3553 )
3554 ),
3555 [ $self->func('s_l_block_indented'), $n, "block-out" ]
3556 );
3557 2 };
3558  
3559  
3560  
3561 # [191]
3562 # l-block-map-explicit-value(n) ::=
3563 # s-indent(n)
3564 # ':' s-l+block-indented(n,block-out)
3565  
3566 rule '191', l_block_map_explicit_value => sub {
3567 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3568 0 debug_rule("l_block_map_explicit_value",$n) if DEBUG;
3569 0 $self->all(
3570 [ $self->func('s_indent'), $n ],
3571 $self->chr(':'),
3572 [ $self->func('s_l_block_indented'), $n, "block-out" ]
3573 );
3574 2 };
3575  
3576  
3577  
3578 # [192]
3579 # ns-l-block-map-implicit-entry(n) ::=
3580 # (
3581 # ns-s-block-map-implicit-key
3582 # | e-node )
3583 # c-l-block-map-implicit-value(n)
3584  
3585 rule '192', ns_l_block_map_implicit_entry => sub {
3586 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3587 6 debug_rule("ns_l_block_map_implicit_entry",$n) if DEBUG;
3588 6 $self->all(
3589 $self->any(
3590 $self->func('ns_s_block_map_implicit_key'),
3591 $self->func('e_node')
3592 ),
3593 [ $self->func('c_l_block_map_implicit_value'), $n ]
3594 );
3595 2 };
3596  
3597  
3598  
3599 # [193]
3600 # ns-s-block-map-implicit-key ::=
3601 # c-s-implicit-json-key(block-key)
3602 # | ns-s-implicit-yaml-key(block-key)
3603  
3604 rule '193', ns_s_block_map_implicit_key => sub {
3605 6 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3606 6 debug_rule("ns_s_block_map_implicit_key") if DEBUG;
3607 6 $self->any(
3608 [ $self->func('c_s_implicit_json_key'), "block-key" ],
3609 [ $self->func('ns_s_implicit_yaml_key'), "block-key" ]
3610 );
3611 2 };
3612  
3613  
3614  
3615 # [194]
3616 # c-l-block-map-implicit-value(n) ::=
3617 # ':' (
3618 # s-l+block-node(n,block-out)
3619 # | ( e-node s-l-comments ) )
3620  
3621 rule '194', c_l_block_map_implicit_value => sub {
3622 6 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3623 6 debug_rule("c_l_block_map_implicit_value",$n) if DEBUG;
3624 6 $self->all(
3625 $self->chr(':'),
3626 $self->any(
3627 [ $self->func('s_l_block_node'), $n, "block-out" ],
3628 $self->all(
3629 $self->func('e_node'),
3630 $self->func('s_l_comments')
3631 )
3632 )
3633 );
3634 2 };
3635  
3636  
3637  
3638 # [195]
3639 # ns-l-compact-mapping(n) ::=
3640 # ns-l-block-map-entry(n)
3641 # ( s-indent(n) ns-l-block-map-entry(n) )*
3642  
3643 rule '195', ns_l_compact_mapping => sub {
3644 0 ▶ my ($self, $n) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3645 0 debug_rule("ns_l_compact_mapping",$n) if DEBUG;
3646 0 $self->all(
3647 [ $self->func('ns_l_block_map_entry'), $n ],
3648 $self->rep(0, undef,
3649 $self->all(
3650 [ $self->func('s_indent'), $n ],
3651 [ $self->func('ns_l_block_map_entry'), $n ]
3652 ))
3653 );
3654 2 };
3655  
3656  
3657  
3658 # [196]
3659 # s-l+block-node(n,c) ::=
3660 # s-l+block-in-block(n,c) | s-l+flow-in-block(n)
3661  
3662 rule '196', s_l_block_node => sub {
3663 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3664 6 debug_rule("s_l_block_node",$n,$c) if DEBUG;
3665 6 $self->any(
3666 [ $self->func('s_l_block_in_block'), $n, $c ],
3667 [ $self->func('s_l_flow_in_block'), $n ]
3668 );
3669 2 };
3670  
3671  
3672  
3673 # [197]
3674 # s-l+flow-in-block(n) ::=
3675 # s-separate(n+1,flow-out)
3676 # ns-flow-node(n+1,flow-out) s-l-comments
3677  
3678 rule '197', s_l_flow_in_block => sub {
3679 2 ▶ my ($self, $n) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3680 2 debug_rule("s_l_flow_in_block",$n) if DEBUG;
3681 2 $self->all(
3682 [ $self->func('s_separate'), $self->add($n, 1), "flow-out" ],
3683 [ $self->func('ns_flow_node'), $self->add($n, 1), "flow-out" ],
3684 $self->func('s_l_comments')
3685 );
3686 2 };
3687  
3688  
3689  
3690 # [198]
3691 # s-l+block-in-block(n,c) ::=
3692 # s-l+block-scalar(n,c) | s-l+block-collection(n,c)
3693  
3694 rule '198', s_l_block_in_block => sub {
3695 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3696 6 debug_rule("s_l_block_in_block",$n,$c) if DEBUG;
3697 6 $self->any(
3698 [ $self->func('s_l_block_scalar'), $n, $c ],
3699 [ $self->func('s_l_block_collection'), $n, $c ]
3700 );
3701 2 };
3702  
3703  
3704  
3705 # [199]
3706 # s-l+block-scalar(n,c) ::=
3707 # s-separate(n+1,c)
3708 # ( c-ns-properties(n+1,c) s-separate(n+1,c) )?
3709 # ( c-l+literal(n) | c-l+folded(n) )
3710  
3711 rule '199', s_l_block_scalar => sub {
3712 6 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3713 6 debug_rule("s_l_block_scalar",$n,$c) if DEBUG;
3714 6 $self->all(
3715 [ $self->func('s_separate'), $self->add($n, 1), $c ],
3716 $self->rep(0, 1,
3717 $self->all(
3718 [ $self->func('c_ns_properties'), $self->add($n, 1), $c ],
3719 [ $self->func('s_separate'), $self->add($n, 1), $c ]
3720 )),
3721 $self->any(
3722 [ $self->func('c_l_literal'), $n ],
3723 [ $self->func('c_l_folded'), $n ]
3724 )
3725 );
3726 2 };
3727  
3728  
3729  
3730 # [200]
3731 # s-l+block-collection(n,c) ::=
3732 # ( s-separate(n+1,c)
3733 # c-ns-properties(n+1,c) )?
3734 # s-l-comments
3735 # ( l+block-sequence(seq-spaces(n,c))
3736 # | l+block-mapping(n) )
3737  
3738 rule '200', s_l_block_collection => sub {
3739 4 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3740 4 debug_rule("s_l_block_collection",$n,$c) if DEBUG;
3741 4 $self->all(
3742 $self->rep(0, 1,
3743 $self->all(
3744 [ $self->func('s_separate'), $self->add($n, 1), $c ],
3745 $self->any(
3746 $self->all(
3747 [ $self->func('c_ns_properties'), $self->add($n, 1), $c ],
3748 $self->func('s_l_comments')
3749 ),
3750 $self->all(
3751 $self->func('c_ns_tag_property'),
3752 $self->func('s_l_comments')
3753 ),
3754 $self->all(
3755 $self->func('c_ns_anchor_property'),
3756 $self->func('s_l_comments')
3757 )
3758 )
3759 )),
3760 $self->func('s_l_comments'),
3761 $self->any(
3762 [ $self->func('l_block_sequence'), [ $self->func('seq_spaces'), $n, $c ] ],
3763 [ $self->func('l_block_mapping'), $n ]
3764 )
3765 );
3766 2 };
3767  
3768  
3769  
3770 # [201]
3771 # seq-spaces(n,c) ::=
3772 # ( c = block-out => n-1 )
3773 # ( c = block-in => n )
3774  
3775 rule '201', seq_spaces => sub {
3776 2 ▶ my ($self, $n, $c) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3777 2 debug_rule("seq_spaces",$n,$c) if DEBUG;
3778 2 $self->flip(
3779 $c,
3780 {
3781 'block-in' => $n,
3782 'block-out' => $self->sub($n, 1),
3783 }
3784 );
3785 2 };
3786  
3787  
3788  
3789 # [202]
3790 # l-document-prefix ::=
3791 # c-byte-order-mark? l-comment*
3792  
3793 rule '202', l_document_prefix => sub {
3794 4 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3795 4 debug_rule("l_document_prefix") if DEBUG;
3796 4 $self->all(
3797 $self->rep(0, 1, $self->func('c_byte_order_mark')),
3798 $self->rep2(0, undef, $self->func('l_comment'))
3799 );
3800 2 };
3801  
3802  
3803  
3804 # [203]
3805 # c-directives-end ::=
3806 # '-' '-' '-'
3807  
3808 rule '203', c_directives_end => sub {
3809 4 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3810 4 debug_rule("c_directives_end") if DEBUG;
3811 4 $self->all(
3812 $self->chr('-'),
3813 $self->chr('-'),
3814 $self->chr('-'),
3815 $self->chk(
3816 '=',
3817 $self->any(
3818 $self->func('end_of_stream'),
3819 $self->func('s_white'),
3820 $self->func('b_break')
3821 )
3822 )
3823 );
3824 2 };
3825  
3826  
3827  
3828 # [204]
3829 # c-document-end ::=
3830 # '.' '.' '.'
3831  
3832 rule '204', c_document_end => sub {
3833 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3834 2 debug_rule("c_document_end") if DEBUG;
3835 2 $self->all(
3836 $self->chr('.'),
3837 $self->chr('.'),
3838 $self->chr('.')
3839 );
3840 2 };
3841  
3842  
3843  
3844 # [205]
3845 # l-document-suffix ::=
3846 # c-document-end s-l-comments
3847  
3848 rule '205', l_document_suffix => sub {
3849 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3850 2 debug_rule("l_document_suffix") if DEBUG;
3851 2 $self->all(
3852 $self->func('c_document_end'),
3853 $self->func('s_l_comments')
3854 );
3855 2 };
3856  
3857  
3858  
3859 # [206]
3860 # c-forbidden ::=
3861 # <start_of_line>
3862 # ( c-directives-end | c-document-end )
3863 # ( b-char | s-white | <end_of_file> )
3864  
3865 rule '206', c_forbidden => sub {
3866 0 ▶ my ($self) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
3867 0 debug_rule("c_forbidden") if DEBUG;
3868 0 $self->all(
3869 $self->func('start_of_line'),
3870 $self->any(
3871 $self->func('c_directives_end'),
3872 $self->func('c_document_end')
3873 ),
3874 $self->any(
3875 $self->func('b_char'),
3876 $self->func('s_white'),
3877 $self->func('end_of_stream')
3878 )
3879 );
3880 2 };
3881  
3882  
3883  
3884 # [207]
3885 # l-bare-document ::=
3886 # s-l+block-node(-1,block-in)
3887 # <excluding_c-forbidden_content>
3888  
3889 rule '207', l_bare_document => sub {
3890 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3891 2 debug_rule("l_bare_document") if DEBUG;
3892 2 $self->all(
3893 $self->exclude($self->func('c_forbidden')),
3894 [ $self->func('s_l_block_node'), -1, "block-in" ]
3895 );
3896 2 };
3897  
3898  
3899  
3900 # [208]
3901 # l-explicit-document ::=
3902 # c-directives-end
3903 # ( l-bare-document
3904 # | ( e-node s-l-comments ) )
3905  
3906 rule '208', l_explicit_document => sub {
3907 4 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3908 4 debug_rule("l_explicit_document") if DEBUG;
3909 4 $self->all(
3910 $self->func('c_directives_end'),
3911 $self->any(
3912 $self->func('l_bare_document'),
3913 $self->all(
3914 $self->func('e_node'),
3915 $self->func('s_l_comments')
3916 )
3917 )
3918 );
3919 2 };
3920  
3921  
3922  
3923 # [209]
3924 # l-directive-document ::=
3925 # l-directive+
3926 # l-explicit-document
3927  
3928 rule '209', l_directive_document => sub {
3929 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3930 2 debug_rule("l_directive_document") if DEBUG;
3931 2 $self->all(
3932 $self->rep(1, undef, $self->func('l_directive')),
3933 $self->func('l_explicit_document')
3934 );
3935 2 };
3936  
3937  
3938  
3939 # [210]
3940 # l-any-document ::=
3941 # l-directive-document
3942 # | l-explicit-document
3943 # | l-bare-document
3944  
3945 rule '210', l_any_document => sub {
3946 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3947 2 debug_rule("l_any_document") if DEBUG;
3948 2 $self->any(
3949 $self->func('l_directive_document'),
3950 $self->func('l_explicit_document'),
3951 $self->func('l_bare_document')
3952 );
3953 2 };
3954  
3955  
3956  
3957 # [211]
3958 # l-yaml-stream ::=
3959 # l-document-prefix* l-any-document?
3960 # ( ( l-document-suffix+ l-document-prefix*
3961 # l-any-document? )
3962 # | ( l-document-prefix* l-explicit-document? ) )*
3963  
3964 rule '211', l_yaml_stream => sub {
3965 2 ▶ my ($self) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
3966 2 debug_rule("l_yaml_stream") if DEBUG;
3967 2 $self->all(
3968 $self->func('l_document_prefix'),
3969 $self->rep(0, 1, $self->func('l_any_document')),
3970 $self->rep2(0, undef,
3971 $self->any(
3972 $self->all(
3973 $self->func('l_document_suffix'),
3974 $self->rep(0, undef, $self->func('l_document_prefix')),
3975 $self->rep2(0, 1, $self->func('l_any_document'))
3976 ),
3977 $self->all(
3978 $self->func('l_document_prefix'),
3979 $self->rep(0, 1, $self->func('l_explicit_document'))
3980 )
3981 ))
3982 );
3983 2 };
3984  
3985  
3986  
3987 2 1;
3988  
3989  
3990 ###
3991 # This is a parser class. It has a parse() method and parsing primitives for
3992 # the grammar. It calls methods in the receiver class, when a rule matches:
3993 ###
3994  
3995 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
3996  
3997 package PerlYamlReferenceParserParser;
3998  
3999 2 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
4000 2 ▶use PerlYamlReferenceParserPrelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
4001 2 ▶use PerlYamlReferenceParserGrammar;
Subroutine BEGIN: called CC=1 SCAR=0.0
4002  
4003 2 ▶use base 'PerlYamlReferenceParserGrammar';
Subroutine BEGIN: called CC=1 SCAR=0.0
4004  
4005 2 ▶use constant TRACE => $ENV{TRACE};
Subroutine BEGIN: called CC=1 SCAR=0.0
4006  
4007 0 ▶sub receiver { $_[0]->{receiver} }
Subroutine receiver: not called CC=1 SCAR=6.9
Pod undocumented
4008  
4009 sub new {
4010 2 ▶ my ($class, $receiver) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
4011  
4012 2 my $self = bless {
4013 receiver => $receiver,
4014 pos => 0,
4015 end => 0,
4016 state => [],
4017 trace_num => 0,
4018 trace_line => 0,
4019 trace_on => true,
4020 trace_off => 0,
4021 trace_info => ['', '', ''],
4022 }, $class;
4023  
4024 2 $receiver->{parser} = $self;
4025  
4026 2 return $self;
4027 }
4028  
4029 sub parse {
4030 2 ▶ my ($self, $input) = @_;
Subroutine parse: called CC=5 SCAR=16.9
Pod undocumented
4031  
4032 2 ▶ $input = decode_utf8($input)
Branch: 1 branch
BranchTrueFalseTotal
unless &Encode::is_utf8($input) 2 0 2
4033 unless Encode::is_utf8($input);
4034 2 $self->{input} = $input;
4035  
4036 2 $self->{end} = length $self->{input};
4037  
4038 2 $self->{trace_on} = not $self->trace_start if TRACE;
4039  
4040 2 my $ok;
4041 2 eval {
4042 2 $ok = $self->call($self->func('TOP'));
4043 2 $self->trace_flush;
4044 };
4045 2 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 2 2
4046 0 $self->trace_flush;
4047 0 die $@;
4048 }
4049  
4050 2 ▶ die "Parser failed" if not $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 2 2
4051 die "Parser finished before end of input"
4052 2 ▶ if $self->{pos} < $self->{end};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"pos"} < $self->{"end"} 0 2 2
4053  
4054 2 return true;
4055 }
4056  
4057 sub state_curr {
4058 16522 ▶ my ($self) = @_;
Subroutine state_curr: called CC=2 SCAR=6.9
Pod undocumented
4059 16522 ▶ $self->{state}[-1] || {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"state"}[-1] or {"name", undef, "doc", &false(), "lvl", 0, "beg", 0, "end", 0, "m", undef, "t", undef} 4 16518 16522
4060 name => undef,
4061 doc => false,
4062 lvl => 0,
4063 beg => 0,
4064 end => 0,
4065 m => undef,
4066 t => undef,
4067 };
4068 }
4069  
4070 sub state_prev {
4071 4 ▶ my ($self) = @_;
Subroutine state_prev: called CC=1 SCAR=0.0
Pod undocumented
4072 4 $self->{state}[-2]
4073 }
4074  
4075 sub state_push {
4076 6484 ▶ my ($self, $name) = @_;
Subroutine state_push: called CC=1 SCAR=0.0
Pod undocumented
4077  
4078 6484 my $curr = $self->state_curr;
4079  
4080 6484 push @{$self->{state}}, {
4081 name => $name,
4082 doc => $curr->{doc},
4083 lvl => $curr->{lvl} + 1,
4084 beg => $self->{pos},
4085 end => undef,
4086 m => $curr->{m},
4087 t => $curr->{t},
4088 6484 };
4089 }
4090  
4091 sub state_pop {
4092 6484 ▶ my ($self) = @_;
Subroutine state_pop: called CC=2 SCAR=7.0
Pod undocumented
4093 6484 my $child = pop @{$self->{state}};
4094 6484 my $curr = $self->state_curr;
4095 6484 ▶ return unless defined $curr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $curr 0 6484 6484
4096 6484 $curr->{beg} = $child->{beg};
4097 6484 $curr->{end} = $self->{pos};
4098 }
4099  
4100 sub call {
4101 6486 ▶ my ($self, $func, $type) = @_;
Subroutine call: called CC=16 SCAR=28.0
Pod undocumented
4102 6486 ▶ $type //= 'boolean';
Condition100%2/2
$type //= "boolean"
l!l
366450
MC/DC100%1/1
$type //= "boolean"
$type
Truth table100%2/2
A
A= $type
Aresult
11
00
4103  
4104 6486 my $args = [];
4105 6486 ▶ ($func, @$args) = @$func if isArray $func;
Branch: 1 branch
BranchTrueFalseTotal
if isArray($func) 516 5970 6486
4106  
4107 6486 ▶ return $func if isNumber $func or isString $func;
Branch: 1 branch
BranchTrueFalseTotal
if isNumber($func) or isString($func) 2 6484 6486
Condition66%2/3
isNumber($func) or isString($func)
l!l&&r!l&&!r
026484
MC/DC50%1/2
isNumber($func) or isString($func)
isNumber($func) isString($func)
Truth table66%2/3
A or B
A= isNumber($func)B= isString($func)
ABresult
1X1
011
000
4108  
4109 6484 ▶ FAIL "Bad call type '${\ typeof $func}' for '$func'"
Branch: 1 branch
BranchTrueFalseTotal
unless isFunction($func) 0 6484 6484
4110 unless isFunction $func;
4111  
4112 6484 ▶ my $trace = $func->{trace} //= $func->{name};
Condition33%1/3
$func->{"trace"} //= $func->{"name"}
l!l&&r!l&&!r
648400
MC/DC0%0/2
$func->{"trace"} //= $func->{"name"}
$func->{"trace"} $func->{"name"}
Truth table33%1/3
A //= B
A= $func->{"trace"}B= $func->{"name"}
ABresult
1X1
011
000
4113  
4114 6484 $self->state_push($trace);
4115  
4116 6484 $self->{trace_num}++;
4117 6484 $self->trace('?', $trace, $args) if TRACE;
4118  
4119 6484 ▶ if ($func->{name} eq 'l_bare_document') {
Branch: 1 branch
BranchTrueFalseTotal
if ($func->{"name"} eq "l_bare_document") 2 6482 6484
4120 2 $self->state_curr->{doc} = true;
4121 }
4122  
4123 @$args = map {
4124 6484 isArray($_) ? $self->call($_, 'any') :
4125 774 ▶ isFunction($_) ? $_->{func}->() :
Branch: 2 branches
BranchTrueFalseTotal
isArray($_) ? : 4 770 774
isFunction($_) ? : 44 726 770
4126 $_;
4127 } @$args;
4128  
4129 6484 my $pos = $self->{pos};
4130 6484 $self->receive($func, 'try', $pos);
4131  
4132 6484 my $value = $func->{func}->($self, @$args);
4133 6484 ▶ while (isFunction($value) or isArray($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (isFunction($value) or isArray($value)) 2446 6484 8930
Condition100%3/3
isFunction($value) or isArray($value)
l!l&&r!l&&!r
2422246484
MC/DC100%2/2
isFunction($value) or isArray($value)
isFunction($value) isArray($value)
Truth table100%3/3
A or B
A= isFunction($value)B= isArray($value)
ABresult
1X1
011
000
4134 2446 $value = $self->call($value);
4135 }
4136  
4137 6484 ▶ FAIL "Calling '$trace' returned '${\ typeof($value)}' instead of '$type'"
Branch: 1 branch
BranchTrueFalseTotal
if $type ne "any" and typeof($value) ne $type 0 6484 6484
Condition66%2/3
$type ne "any" and typeof($value) ne $type
!ll&&!rl&&r
664780
MC/DC0%0/2
$type ne "any" and typeof($value) ne $type
$type ne "any" typeof($value) ne $type
Truth table66%2/3
A and B
A= $type ne "any"B= typeof($value) ne $type
ABresult
0X0
100
111
4138 if $type ne 'any' and typeof($value) ne $type;
4139  
4140 6484 $self->{trace_num}++;
4141 6484 ▶ if ($type ne 'boolean') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type ne 'boolean') { } 24 6460 6484
4142 24 $self->trace('>', $value) if TRACE;
4143 }
4144 else {
4145 6460 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 1906 4554 6460
4146 1906 $self->trace('+', $trace) if TRACE;
4147 1906 $self->receive($func, 'got', $pos);
4148 }
4149 else {
4150 4554 $self->trace('x', $trace) if TRACE;
4151 4554 $self->receive($func, 'not', $pos);
4152 }
4153 }
4154  
4155 6484 $self->state_pop;
4156 6484 return $value;
4157 }
4158  
4159 sub receive {
4160 12944 ▶ my ($self, $func, $type, $pos) = @_;
Subroutine receive: called CC=3 SCAR=11.0
Pod undocumented
4161  
4162 12944 ▶ $func->{receivers} //= $self->make_receivers;
Condition66%2/3
$func->{"receivers"} //= $self->make_receivers
l!l&&r!l&&!r
656863760
MC/DC0%0/2
$func->{"receivers"} //= $self->make_receivers
$func->{"receivers"} $self->make_receivers
Truth table66%2/3
A //= B
A= $func->{"receivers"}B= $self->make_receivers
ABresult
1X1
011
000
4163 12944 my $receiver = $func->{receivers}{$type};
4164 12944 ▶ return unless $receiver;
Branch: 1 branch
BranchTrueFalseTotal
unless $receiver 12758 186 12944
4165  
4166 $receiver->($self->{receiver}, {
4167 186 text => substr($self->{input}, $pos, $self->{pos}-$pos),
4168 state => $self->state_curr,
4169 start => $pos,
4170 });
4171 }
4172  
4173 sub make_receivers {
4174 6376 ▶ my ($self) = @_;
Subroutine make_receivers: called CC=4 SCAR=13.9
Pod undocumented
4175 6376 my $i = @{$self->{state}};
4176 6376 my $names = [];
4177 6376 my $n;
4178 6376 ▶ while ($i > 0 and not(($n = $self->{state}[--$i]{name}) =~ /_/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0 and not +($n = $self->{"state"}[--$i]{"name"}) =~ /_/u) 5764 6376 12140
Condition100%3/3
$i > 0 and not +($n = $self->{"state"}[--$i]{"name"}) =~ /_/u
!ll&&!rl&&r
263745764
MC/DC100%2/2
$i > 0 and not +($n = $self->{"state"}[--$i]{"name"}) =~ /_/u
$i > 0 not +($n = $self->{"state"}[--$i]{"name"}) =~ /_/u
Truth table100%3/3
A and not(B)
A= $i > 0B= not +($n = $self->{"state"}[--$i]{"name"}) =~ /_/u
ABresult
0X0
100
111
4179 5764 ▶ if ($n =~ /^chr\((.)\)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n =~ /^chr\((.)\)$/u) { } 788 4976 5764
4180 788 $n = hex_char $1;
4181 }
4182 else {
4183 4976 $n =~ s/\(.*//;
4184 }
4185 5764 unshift @$names, $n;
4186 }
4187 6376 my $name = join '__', $n, @$names;
4188  
4189 return {
4190 try => $self->{receiver}->can("try__$name"),
4191 got => $self->{receiver}->can("got__$name"),
4192 6376 not => $self->{receiver}->can("not__$name"),
4193 };
4194 }
4195  
4196 # Match all subrule methods:
4197 sub all {
4198 864 ▶ my ($self, @funcs) = @_;
Subroutine all: called CC=1 SCAR=0.0
Pod undocumented
4199 name all => sub {
4200 754 ▶ my $pos = $self->{pos};
Subroutine __ANON__: called CC=4 SCAR=13.9
4201 754 for my $func (@funcs) {
4202 1074 ▶ FAIL '*** Missing function in @all group:', \@funcs
Branch: 1 branch
BranchTrueFalseTotal
unless defined $func 0 1074 1074
4203 unless defined $func;
4204  
4205 1074 ▶ if (not $self->call($func)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->call($func)) 612 462 1074
4206 612 $self->{pos} = $pos;
4207 612 return false;
4208 }
4209 }
4210  
4211 142 return true;
4212 864 };
4213 }
4214  
4215 # Match any subrule method. Rules are tried in order and stops on first match:
4216 sub any {
4217 886 ▶ my ($self, @funcs) = @_;
Subroutine any: called CC=1 SCAR=0.0
Pod undocumented
4218 name any => sub {
4219 818 ▶ for my $func (@funcs) {
Subroutine __ANON__: called CC=3 SCAR=11.0
4220 2042 ▶ if ($self->call($func)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->call($func)) 322 1720 2042
4221 322 return true;
4222 }
4223 }
4224  
4225 496 return false;
4226 886 };
4227 }
4228  
4229 sub may {
4230 6 ▶ my ($self, $func) = @_;
Subroutine may: called CC=1 SCAR=0.0
Pod undocumented
4231 name may => sub {
4232 6 ▶ $self->call($func);
Subroutine __ANON__: called CC=1 SCAR=0.0
4233 6 };
4234 }
4235  
4236 # Repeat a rule a certain number of times:
4237 sub rep {
4238 492 ▶ my ($self, $min, $max, $func) = @_;
Subroutine rep: called CC=2 SCAR=7.0
Pod undocumented
4239 name rep => sub {
4240 274 ▶ return false if defined $max and $max < 0;
Subroutine __ANON__: called CC=10 SCAR=23.2
Branch: 1 branch
BranchTrueFalseTotal
if defined $max and $max < 0 0 274 274
Condition66%2/3
defined $max and $max < 0
!ll&&!rl&&r
1401340
MC/DC0%0/2
defined $max and $max < 0
defined $max $max < 0
Truth table66%2/3
A and B
A= defined $maxB= $max < 0
ABresult
0X0
100
111
4241 274 my $count = 0;
4242 274 my $pos = $self->{pos};
4243 274 my $pos_start = $pos;
4244 274 ▶ while (not(defined $max) or $count < $max) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $max or $count < $max) 312 42 354
Condition100%3/3
not defined $max or $count < $max
l!l&&r!l&&!r
17813442
MC/DC100%2/2
not defined $max or $count < $max
not defined $max $count < $max
Truth table100%3/3
not(A) or B
A= not defined $maxB= $count < $max
ABresult
1X1
011
000
4245 312 ▶ last unless $self->call($func);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->call($func) 228 84 312
4246 84 ▶ last if $self->{pos} == $pos;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"pos"} == $pos 4 80 84
4247 80 $count++;
4248 80 $pos = $self->{pos};
4249 }
4250 274 ▶ if ($count >= $min and (not(defined $max) or $count <= $max)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count >= $min and !defined($max) || $count <= $max) 216 58 274
Condition66%4/6
$count >= $min and !defined($max) || $count <= $max
!ll&&!rl&&r
580216
not defined $max or $count <= $max
l!l&&r!l&&!r
861300
MC/DC33%1/3
$count >= $min and !defined($max) || $count <= $max
$count >= $min not defined $max $count <= $max
Truth table50%2/4
A and not(B) or C
A= $count >= $minB= not defined $maxC= $count <= $max
ABCresult
0XX0
1000
11X1
1011
4251 216 return true;
4252 }
4253 58 $self->{pos} = $pos_start;
4254 58 return false;
4255 492 ▶ }, "rep($min,${\ ($max // 'null')})";
Condition100%2/2
$max // "null"
l!l
228264
MC/DC100%1/1
$max // "null"
$max
Truth table100%2/2
A
A= $max
Aresult
11
00
4256 }
4257 sub rep2 {
4258 48 ▶ my ($self, $min, $max, $func) = @_;
Subroutine rep2: called CC=2 SCAR=7.0
Pod undocumented
4259 name rep2 => sub {
4260 22 ▶ return false if defined $max and $max < 0;
Subroutine __ANON__: called CC=10 SCAR=23.8
Branch: 1 branch
BranchTrueFalseTotal
if defined $max and $max < 0 0 22 22
Condition66%2/3
defined $max and $max < 0
!ll&&!rl&&r
12100
MC/DC0%0/2
defined $max and $max < 0
defined $max $max < 0
Truth table66%2/3
A and B
A= defined $maxB= $max < 0
ABresult
0X0
100
111
4261 22 my $count = 0;
4262 22 my $pos = $self->{pos};
4263 22 my $pos_start = $pos;
4264 22 ▶ while (not(defined $max) or $count < $max) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $max or $count < $max) 48 6 54
Condition100%3/3
not defined $max or $count < $max
l!l&&r!l&&!r
38106
MC/DC100%2/2
not defined $max or $count < $max
not defined $max $count < $max
Truth table100%3/3
not(A) or B
A= not defined $maxB= $count < $max
ABresult
1X1
011
000
4265 48 ▶ last unless $self->call($func);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->call($func) 12 36 48
4266 36 ▶ last if $self->{pos} == $pos;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"pos"} == $pos 4 32 36
4267 32 $count++;
4268 32 $pos = $self->{pos};
4269 }
4270 22 ▶ if ($count >= $min and (not(defined $max) or $count <= $max)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count >= $min and !defined($max) || $count <= $max) 22 0 22
Condition66%4/6
$count >= $min and !defined($max) || $count <= $max
!ll&&!rl&&r
0220
not defined $max or $count <= $max
l!l&&r!l&&!r
12100
MC/DC0%0/3
$count >= $min and !defined($max) || $count <= $max
$count >= $min not defined $max $count <= $max
Truth table25%1/4
A and not(B) or C
A= $count >= $minB= not defined $maxC= $count <= $max
ABCresult
0XX0
1000
11X1
1011
4271 22 return true;
4272 }
4273 0 $self->{pos} = $pos_start;
4274 0 return false;
4275 48 ▶ }, "rep2($min,${\ ($max // 'null')})";
Condition100%2/2
$max // "null"
l!l
3414
MC/DC100%1/1
$max // "null"
$max
Truth table100%2/2
A
A= $max
Aresult
11
00
4276 }
4277  
4278 # Call a rule depending on state value:
4279 sub case {
4280 72 ▶ my ($self, $var, $map) = @_;
Subroutine case: called CC=1 SCAR=0.0
Pod undocumented
4281 name case => sub {
4282 72 ▶ my $rule = $map->{$var};
Subroutine __ANON__: called CC=2 SCAR=7.1
4283 72 ▶ defined $rule or
Branch: 1 branch
BranchTrueFalseTotal
defined $rule or FAIL("Can't find '${var}' in:", $map) 0 72 72
4284 FAIL "Can't find '$var' in:", $map;
4285 72 $self->call($rule);
4286 72 }, "case($var,${\ stringify $map})";
4287 }
4288  
4289 # Call a rule depending on state value:
4290 sub flip {
4291 4 ▶ my ($self, $var, $map) = @_;
Subroutine flip: called CC=3 SCAR=12.0
Pod undocumented
4292 4 my $value = $map->{$var};
4293 4 ▶ defined $value or
Branch: 1 branch
BranchTrueFalseTotal
defined $value or FAIL("Can't find '${var}' in:", $map) 0 4 4
4294 FAIL "Can't find '$var' in:", $map;
4295 4 ▶ return $value if not ref $value;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value 4 0 4
4296 0 return $self->call($value, 'number');
4297 }
4298 2 name flip => \&flip;
4299  
4300 sub the_end {
4301 1894 ▶ my ($self) = @_;
Subroutine the_end: called CC=4 SCAR=14.1
Pod undocumented
4302 return (
4303 $self->{pos} >= $self->{end} or (
4304 $self->state_curr->{doc} and
4305 $self->start_of_line and
4306 1894 ▶ substr($self->{input}, $self->{pos}) =~
Condition77%7/9
$self->{'pos'} >= $self->{'end'} || $self->state_curr->{'doc'} && $self->start_of_line && substr($self->{'input'}, $self->{'pos'}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
l!l&&r!l&&!r
8801806
$self->state_curr->{"doc"} and $self->start_of_line and substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
!ll&&!rl&&r
15242820
$self->state_curr->{"doc"} and $self->start_of_line
!ll&&!rl&&r
321492282
MC/DC25%1/4
$self->{'pos'} >= $self->{'end'} || $self->state_curr->{'doc'} && $self->start_of_line && substr($self->{'input'}, $self->{'pos'}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
$self->{'pos'} >= $self->{'end'} $self->state_curr->{"doc"} $self->start_of_line substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
Truth table80%4/5
A || B and C and D
A= $self->{'pos'} >= $self->{'end'}B= $self->state_curr->{"doc"}C= $self->start_of_lineD= substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
ABCDresult
1XXX1
01111
00XX0
010X0
01100
4307 /^(?:---|\.\.\.)(?=\s|\z)/
4308 )
4309 );
4310 }
4311  
4312 # Match a single char:
4313 sub chr {
4314 2004 ▶ my ($self, $char) = @_;
Subroutine chr: called CC=1 SCAR=0.1
Pod undocumented
4315 name chr => sub {
4316 1640 ▶ return false if $self->the_end;
Subroutine __ANON__: called CC=7 SCAR=20.2
Branch: 1 branch
BranchTrueFalseTotal
if $self->the_end 86 1554 1640
4317 1554 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"pos"} >= $self->{"end"} or $self->state_curr->{"doc"} and $self->start_of_line and substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u) 0 1554 1554
Condition66%6/9
$self->{"pos"} >= $self->{"end"} or $self->state_curr->{"doc"} and $self->start_of_line and substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
l!l&&r!l&&!r
001554
$self->state_curr->{"doc"} and $self->start_of_line and substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
!ll&&!rl&&r
12882660
$self->state_curr->{"doc"} and $self->start_of_line
!ll&&!rl&&r
321256266
MC/DC0%0/4
$self->{"pos"} >= $self->{"end"} or $self->state_curr->{"doc"} and $self->start_of_line and substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
$self->{"pos"} >= $self->{"end"} $self->state_curr->{"doc"} $self->start_of_line substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
Truth table20%1/5
A or B and C and D
A= $self->{"pos"} >= $self->{"end"}B= $self->state_curr->{"doc"}C= $self->start_of_lineD= substr($self->{"input"}, $self->{"pos"}) =~ /^(?:---|\.\.\.)(?=\s|\z)/u
ABCDresult
1XXX1
01111
00XX0
010X0
01100
4318 $self->{pos} >= $self->{end} or (
4319 $self->state_curr->{doc} and
4320 $self->start_of_line and
4321 substr($self->{input}, $self->{pos}) =~
4322 /^(?:---|\.\.\.)(?=\s|\z)/
4323 )
4324 ) {
4325 0 return false;
4326 }
4327 1554 ▶ if (substr($self->{input}, $self->{pos}, 1) eq $char) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($self->{"input"}, $self->{"pos"}, 1) eq $char) 120 1434 1554
4328 120 $self->{pos}++;
4329 120 return true;
4330 }
4331 1434 return false;
4332 2004 }, "chr(${\ stringify($char)})";
4333 }
4334  
4335 # Match a char in a range:
4336 sub rng {
4337 330 ▶ my ($self, $low, $high) = @_;
Subroutine rng: called CC=1 SCAR=0.0
Pod undocumented
4338 name rng => sub {
4339 78 ▶ return false if $self->the_end;
Subroutine __ANON__: called CC=4 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
if $self->the_end 0 78 78
4340 78 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($low le substr($self->{"input"}, $self->{"pos"}, 1) and substr($self->{"input"}, $self->{"pos"}, 1) le $high) 76 2 78
Condition66%2/3
$low le substr($self->{"input"}, $self->{"pos"}, 1) and substr($self->{"input"}, $self->{"pos"}, 1) le $high
!ll&&!rl&&r
2076
MC/DC50%1/2
$low le substr($self->{"input"}, $self->{"pos"}, 1) and substr($self->{"input"}, $self->{"pos"}, 1) le $high
$low le substr($self->{"input"}, $self->{"pos"}, 1) substr($self->{"input"}, $self->{"pos"}, 1) le $high
Truth table66%2/3
A and B
A= $low le substr($self->{"input"}, $self->{"pos"}, 1)B= substr($self->{"input"}, $self->{"pos"}, 1) le $high
ABresult
0X0
100
111
4341 $low le substr($self->{input}, $self->{pos}, 1) and
4342 substr($self->{input}, $self->{pos}, 1) le $high
4343 ) {
4344 76 $self->{pos}++;
4345 76 return true;
4346 }
4347 2 return false;
4348 330 }, "rng(${\ stringify($low)},${\ stringify($high)})";
4349 }
4350  
4351 # Must match first rule but none of others:
4352 sub but {
4353 176 ▶ my ($self, @funcs) = @_;
Subroutine but: called CC=1 SCAR=0.0
Pod undocumented
4354 name but => sub {
4355 176 ▶ return false if $self->the_end;
Subroutine __ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
BranchTrueFalseTotal
if $self->the_end 2 174 176
4356 174 my $pos1 = $self->{pos};
4357 174 ▶ return false unless $self->call($funcs[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->call($funcs[0]) 8 166 174
4358 166 my $pos2 = $self->{pos};
4359 166 $self->{pos} = $pos1;
4360 166 for my $func (@funcs[1..$#funcs]) {
4361 250 ▶ if ($self->call($func)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->call($func)) 24 226 250
4362 24 $self->{pos} = $pos1;
4363 24 return false;
4364 }
4365 }
4366 142 $self->{pos} = $pos2;
4367 142 return true;
4368 }
4369 176 }
4370  
4371 sub chk {
4372 84 ▶ my ($self, $type, $expr) = @_;
Subroutine chk: called CC=1 SCAR=0.0
Pod undocumented
4373 name chk => sub {
4374 20 ▶ my $pos = $self->{pos};
Subroutine __ANON__: called CC=3 SCAR=11.0
4375 20 ▶ $self->{pos}-- if $type eq '<=';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "<=" 12 8 20
4376 20 my $ok = $self->call($expr);
4377 20 $self->{pos} = $pos;
4378 20 ▶ return $type eq '!' ? not($ok) : $ok;
Branch: 1 branch
BranchTrueFalseTotal
$type eq '!' ? : 0 20 20
4379 84 }, "chk($type, ${\ stringify $expr})";
4380 }
4381  
4382 sub set {
4383 10 ▶ my ($self, $var, $expr) = @_;
Subroutine set: called CC=1 SCAR=0.1
Pod undocumented
4384 name set => sub {
4385 4 ▶ my $value = $self->call($expr, 'any');
Subroutine __ANON__: called CC=7 SCAR=19.9
4386 4 ▶ return false if $value == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $value == -1 0 4 4
4387 4 ▶ $value = $self->auto_detect if $value eq 'auto-detect';
Branch: 1 branch
BranchTrueFalseTotal
if $value eq "auto-detect" 0 4 4
4388 4 my $state = $self->state_prev;
4389 4 $state->{$var} = $value;
4390 4 ▶ if ($state->{name} ne 'all') {
Branch: 1 branch
BranchTrueFalseTotal
if ($state->{"name"} ne "all") 4 0 4
4391 4 my $size = @{$self->{state}};
4392 4 ▶ for (my $i = 3; $i < $size; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $size) 44 0 44
4393 44 ▶ FAIL "failed to traverse state stack in 'set'"
Branch: 1 branch
BranchTrueFalseTotal
if $i > $size - 2 0 44 44
4394 if $i > $size - 2;
4395 44 $state = $self->{state}[0 - $i];
4396 44 $state->{$var} = $value;
4397 44 ▶ last if $state->{name} eq 's_l_block_scalar';
Branch: 1 branch
BranchTrueFalseTotal
if $state->{"name"} eq "s_l_block_scalar" 4 40 44
4398 }
4399 }
4400 4 return true;
4401 10 }, "set('$var', ${\ stringify $expr})";
4402 }
4403  
4404 sub max {
4405 20 ▶ my ($self, $max) = @_;
Subroutine max: called CC=1 SCAR=0.0
Pod undocumented
4406 name max => sub {
4407 20 ▶ return true;
Subroutine __ANON__: called CC=1 SCAR=0.0
4408 20 };
4409 }
4410  
4411 sub exclude {
4412 2 ▶ my ($self, $rule) = @_;
Subroutine exclude: called CC=1 SCAR=0.0
Pod undocumented
4413 name exclude => sub {
4414 2 ▶ return true;
Subroutine __ANON__: called CC=1 SCAR=0.0
4415 2 };
4416 }
4417  
4418 sub add {
4419 48 ▶ my ($self, $x, $y) = @_;
Subroutine add: called CC=1 SCAR=0.1
Pod undocumented
4420 name add => sub {
4421 42 ▶ $y = $self->call($y, 'number') if isFunction $y;
Subroutine __ANON__: called CC=3 SCAR=11.4
Branch: 1 branch
BranchTrueFalseTotal
if isFunction($y) 2 40 42
4422 42 ▶ FAIL "y is '${\ stringify $y}', not number in 'add'"
Branch: 1 branch
BranchTrueFalseTotal
unless isNumber($y) 0 42 42
4423 unless isNumber $y;
4424 42 return $x + $y;
4425 48 }, "add($x,${\ stringify $y})";
4426 }
4427  
4428 sub sub {
4429 2 ▶ my ($self, $x, $y) = @_;
Subroutine sub: called CC=1 SCAR=0.4
Pod undocumented
4430 name sub => sub {
4431 0 ▶ return $x - $y;
Subroutine __ANON__: not called CC=1 SCAR=6.9
4432 2 }, "sub($x,$y)";
4433 }
4434  
4435 # This method does not need to return a function since it is never
4436 # called in the grammar.
4437 sub match {
4438 6 ▶ my ($self) = @_;
Subroutine match: called CC=4 SCAR=13.9
Pod undocumented
4439 6 my $state = $self->{state};
4440 6 my $i = @$state - 1;
4441 6 ▶ while ($i > 0 && not defined $state->[$i]{end}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0 and not defined $state->[$i]{"end"}) 18 6 24
Condition66%2/3
$i > 0 and not defined $state->[$i]{"end"}
!ll&&!rl&&r
0618
MC/DC50%1/2
$i > 0 and not defined $state->[$i]{"end"}
$i > 0 not defined $state->[$i]{"end"}
Truth table66%2/3
A and not(B)
A= $i > 0B= not defined $state->[$i]{"end"}
ABresult
0X0
100
111
4442 18 ▶ FAIL "Can't find match" if $i == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $i == 1 0 18 18
4443 18 $i--;
4444 }
4445  
4446 6 my ($beg, $end) = @{$self->{state}[$i]}{qw<beg end>};
4447 6 return substr($self->{input}, $beg, ($end - $beg));
4448 }
4449 2 name match => \&match;
4450  
4451 sub len {
4452 6 ▶ my ($self, $str) = @_;
Subroutine len: called CC=1 SCAR=0.0
Pod undocumented
4453 name len => sub {
4454 6 ▶ $str = $self->call($str, 'string') unless isString($str);
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
unless isString($str) 6 0 6
4455 6 return length $str;
4456 6 };
4457 }
4458  
4459 sub ord {
4460 2 ▶ my ($self, $str) = @_;
Subroutine ord: called CC=1 SCAR=2.6
Pod undocumented
4461 name ord => sub {
4462 # Should be `$self->call($str, 'string')`, but... Perl
4463 0 ▶ $str = $self->call($str, 'number') unless isString($str);
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
unless isString($str) 0 0 0
4464 0 return ord($str) - 48;
4465 2 };
4466 }
4467  
4468 sub if {
4469 10 ▶ my ($self, $test, $do_if_true) = @_;
Subroutine if: called CC=1 SCAR=0.0
Pod undocumented
4470 name if => sub {
4471 10 ▶ $test = $self->call($test, 'boolean') unless isBoolean $test;
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
unless isBoolean($test) 10 0 10
4472 10 ▶ if ($test) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test) 4 6 10
4473 4 $self->call($do_if_true);
4474 4 return true;
4475 }
4476 6 return false;
4477 10 };
4478 }
4479  
4480 sub lt {
4481 4 ▶ my ($self, $x, $y) = @_;
Subroutine lt: called CC=1 SCAR=0.1
Pod undocumented
4482 name lt => sub {
4483 4 ▶ $x = $self->call($x, 'number') unless isNumber($x);
Subroutine __ANON__: called CC=4 SCAR=15.2
Branch: 1 branch
BranchTrueFalseTotal
unless isNumber($x) 4 0 4
4484 4 ▶ $y = $self->call($y, 'number') unless isNumber($y);
Branch: 1 branch
BranchTrueFalseTotal
unless isNumber($y) 0 4 4
4485 4 ▶ return $x < $y ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$x < $y ? : 4 0 4
4486 4 }, "lt(${\ stringify $x},${\ stringify $y})";
4487 }
4488  
4489 sub le {
4490 2 ▶ my ($self, $x, $y) = @_;
Subroutine le: called CC=1 SCAR=0.1
Pod undocumented
4491 name le => sub {
4492 2 ▶ $x = $self->call($x, 'number') unless isNumber($x);
Subroutine __ANON__: called CC=4 SCAR=15.2
Branch: 1 branch
BranchTrueFalseTotal
unless isNumber($x) 2 0 2
4493 2 ▶ $y = $self->call($y, 'number') unless isNumber($y);
Branch: 1 branch
BranchTrueFalseTotal
unless isNumber($y) 0 2 2
4494 2 ▶ return $x <= $y ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$x <= $y ? : 2 0 2
4495 2 }, "le(${\ stringify $x},${\ stringify $y})";
4496 }
4497  
4498 sub m {
4499 10 ▶ my ($self) = @_;
Subroutine m: called CC=1 SCAR=0.0
Pod undocumented
4500 name m => sub {
4501 2 ▶ $self->state_curr->{m};
Subroutine __ANON__: called CC=1 SCAR=0.0
4502 10 };
4503 }
4504  
4505 sub t {
4506 10 ▶ my ($self) = @_;
Subroutine t: called CC=1 SCAR=0.0
Pod undocumented
4507 name t => sub {
4508 2 ▶ $self->state_curr->{t};
Subroutine __ANON__: called CC=1 SCAR=0.0
4509 10 };
4510 }
4511  
4512 #------------------------------------------------------------------------------
4513 # Special grammar rules
4514 #------------------------------------------------------------------------------
4515 sub start_of_line {
4516 3364 ▶ my ($self) = @_;
Subroutine start_of_line: called CC=4 SCAR=13.9
Pod undocumented
4517 (
4518 $self->{pos} == 0 ||
4519 $self->{pos} >= $self->{end} ||
4520 3364 ▶ substr($self->{input}, $self->{pos} - 1, 1) eq "\n"
Branch: 1 branch
BranchTrueFalseTotal
$self->{'pos'} == 0 || $self->{'pos'} >= $self->{'end'} || substr($self->{'input'}, $self->{'pos'} - 1, 1) eq "\n" ? : 564 2800 3364
Condition100%6/6
$self->{"pos"} == 0 or $self->{"pos"} >= $self->{"end"} or substr($self->{"input"}, $self->{"pos"} - 1, 1) eq "\n"
l!l&&r!l&&!r
45602800
$self->{"pos"} == 0 or $self->{"pos"} >= $self->{"end"}
l!l&&r!l&&!r
223360
MC/DC100%3/3
$self->{"pos"} == 0 or $self->{"pos"} >= $self->{"end"} or substr($self->{"input"}, $self->{"pos"} - 1, 1) eq "\n"
$self->{"pos"} == 0 $self->{"pos"} >= $self->{"end"} substr($self->{"input"}, $self->{"pos"} - 1, 1) eq "\n"
Truth table100%4/4
A or B or C
A= $self->{"pos"} == 0B= $self->{"pos"} >= $self->{"end"}C= substr($self->{"input"}, $self->{"pos"} - 1, 1) eq "\n"
ABCresult
1XX1
01X1
0011
0000
4521 ) ? true : false;
4522 }
4523 2 name 'start_of_line', \&start_of_line;
4524  
4525 sub end_of_stream {
4526 34 ▶ my ($self) = @_;
Subroutine end_of_stream: called CC=2 SCAR=6.9
Pod undocumented
4527 34 ▶ ($self->{pos} >= $self->{end}) ? true : false;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'pos'} >= $self->{'end'} ? : 2 32 34
4528 }
4529 2 name 'end_of_stream', \&end_of_stream;
4530  
4531 10 ▶sub empty { true }
Subroutine empty: called CC=1 SCAR=0.0
Pod undocumented
4532 2 name 'empty', \&empty;
4533  
4534 sub auto_detect_indent {
4535 4 ▶ my ($self, $n) = @_;
Subroutine auto_detect_indent: called CC=7 SCAR=23.2
Pod undocumented
4536 4 my $pos = $self->{pos};
4537 4 ▶ my $in_seq = ($pos > 0 && substr($self->{input}, $pos - 1, 1) =~ /^[\-\?\:]$/);
Condition33%1/3
$pos > 0 && substr($self->{'input'}, $pos - 1, 1) =~ /^[\-\?\:]$/u
!ll&&!rl&&r
040
MC/DC0%0/2
$pos > 0 && substr($self->{'input'}, $pos - 1, 1) =~ /^[\-\?\:]$/u
$pos > 0 substr($self->{'input'}, $pos - 1, 1) =~ /^[\-\?\:]$/u
Truth table33%1/3
A && B
A= $pos > 0B= substr($self->{'input'}, $pos - 1, 1) =~ /^[\-\?\:]$/u
ABresult
0X0
100
111
4538 4 ▶ substr($self->{input}, $pos) =~ /^
Branch: 1 branch
BranchTrueFalseTotal
substr($self->{"input"}, $pos) =~ /^ ( (?: \ * (?:\#.*)? \n )* ) (\ *) /ux or FAIL("auto_detect_indent") 0 4 4
4539 (
4540 (?:
4541 \ *
4542 (?:\#.*)?
4543 \n
4544 )*
4545 )
4546 (\ *)
4547 /x or FAIL "auto_detect_indent";
4548 4 my $pre = $1;
4549 4 my $m = length($2);
4550 4 ▶ if ($in_seq and not length $pre) {
Branch: 1 branch
BranchTrueFalseTotal
if ($in_seq and not length $pre) { } 0 4 4
Condition33%1/3
$in_seq and not length $pre
!ll&&!rl&&r
400
MC/DC0%0/2
$in_seq and not length $pre
$in_seq not length $pre
Truth table33%1/3
A and not(B)
A= $in_seqB= not length $pre
ABresult
0X0
100
111
4551 0 ▶ $m++ if $n == -1;
Branch: 1 branch
BranchTrueFalseTotal
if $n == -1 0 0 0
4552 }
4553 else {
4554 4 $m -= $n;
4555 }
4556 4 ▶ $m = 0 if $m < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $m < 0 0 4 4
4557 4 return $m;
4558 }
4559 2 name 'auto_detect_indent', \&auto_detect_indent;
4560  
4561 sub auto_detect {
4562 2 ▶ my ($self, $n) = @_;
Subroutine auto_detect: called CC=4 SCAR=14.3
Pod undocumented
4563 2 ▶ substr($self->{input}, $self->{pos}) =~ /^.*\n((?:\ *\n)*)(\ *)/
Branch: 1 branch
BranchTrueFalseTotal
substr($self->{"input"}, $self->{"pos"}) =~ /^.*\n((?:\ *\n)*)(\ *)/u or return 1 0 2 2
4564 or return 1;
4565 2 my $pre = $1;
4566 2 my $m = length($2) - $n;
4567 2 ▶ $m = 1 if $m < 1;
Branch: 1 branch
BranchTrueFalseTotal
if $m < 1 0 2 2
4568 # XXX change 'die' to 'error' for reporting parse errors
4569 2 ▶ die "Spaces found after indent in auto-detect (5LLU)"
Branch: 1 branch
BranchTrueFalseTotal
if $pre =~ /^.{$m}./mu 0 2 2
4570 if $pre =~ /^.{$m}./m;
4571 2 return $m;
4572 }
4573 2 name 'auto_detect', \&auto_detect;
4574  
4575 #------------------------------------------------------------------------------
4576 # Trace debugging
4577 #------------------------------------------------------------------------------
4578 sub trace_start {
4579 0 ▶ '' || "$ENV{TRACE_START}";
Subroutine trace_start: not called CC=1 SCAR=6.9
Pod undocumented
4580 }
4581  
4582 sub trace_quiet {
4583 0 ▶ return [] if $ENV{DEBUG};
Subroutine trace_quiet: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"DEBUG"} 0 0 0
4584  
4585 0 my @small = (
4586 'b_as_line_feed',
4587 's_indent',
4588 'nb_char',
4589 );
4590  
4591 0 my @noisy = (
4592 'c_directives_end',
4593 'c_l_folded',
4594 'c_l_literal',
4595 'c_ns_alias_node',
4596 'c_ns_anchor_property',
4597 'c_ns_tag_property',
4598 'l_directive_document',
4599 'l_document_prefix',
4600 'ns_flow_content',
4601 'ns_plain',
4602 's_l_comments',
4603 's_separate',
4604 );
4605  
4606 return [
4607 0 ▶ split(',', ($ENV{TRACE_QUIET} || '')),
Condition0%0/2
$ENV{'TRACE_QUIET'} || ''
l!l
00
MC/DC0%0/1
$ENV{'TRACE_QUIET'} || ''
$ENV{'TRACE_QUIET'}
Truth table0%0/2
A
A= $ENV{'TRACE_QUIET'}
Aresult
11
00
4608 @noisy,
4609 ];
4610 }
4611  
4612 sub trace {
4613 0 ▶ my ($self, $type, $call, $args) = @_;
Subroutine trace: not called CC=20 SCAR=60.4
Pod undocumented
4614 0 ▶ $args //= [];
Condition0%0/2
$args //= []
l!l
00
MC/DC0%0/1
$args //= []
$args
Truth table0%0/2
A
A= $args
Aresult
11
00
4615  
4616 0 ▶ $call = "'$call'" if $call =~ /^($| |.* $)/;
Branch: 1 branch
BranchTrueFalseTotal
if $call =~ /^($| |.* $)/u 0 0 0
4617 0 ▶ return unless $self->{trace_on} or $call eq $self->trace_start;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"trace_on"} or $call eq $self->trace_start 0 0 0
Condition0%0/3
$self->{"trace_on"} or $call eq $self->trace_start
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"trace_on"} or $call eq $self->trace_start
$self->{"trace_on"} $call eq $self->trace_start
Truth table0%0/3
A or B
A= $self->{"trace_on"}B= $call eq $self->trace_start
ABresult
1X1
011
000
4618  
4619 0 my $level = $self->state_curr->{lvl};
4620 0 my $indent = ' ' x $level;
4621 0 ▶ if ($level > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($level > 0) 0 0 0
4622 0 my $l = length "$level";
4623 0 $indent = "$level" . substr($indent, $l);
4624 }
4625  
4626 0 my $input = substr($self->{input}, $self->{pos});
4627 0 ▶ $input = substr($input, 0, 30) . '…'
Branch: 1 branch
BranchTrueFalseTotal
if length $input > 30 0 0 0
4628 if length($input) > 30;
4629 0 $input =~ s/\t/\\t/g;
4630 0 $input =~ s/\r/\\r/g;
4631 0 $input =~ s/\n/\\n/g;
4632  
4633 my $line = sprintf(
4634 "%s%s %-40s %4d '%s'\n",
4635 $indent,
4636 $type,
4637 $self->trace_format_call($call, $args),
4638 $self->{pos},
4639 0 $input,
4640 );
4641  
4642 0 ▶ if ($ENV{DEBUG}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"DEBUG"}) 0 0 0
4643 warn sprintf "%6d %s",
4644 0 $self->{trace_num}, $line;
4645 0 return;
4646 }
4647  
4648 0 my $trace_info = undef;
4649 0 $level = "${level}_$call";
4650 0 ▶ if ($type eq '?' and not $self->{trace_off}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "?" and not $self->{"trace_off"}) 0 0 0
Condition0%0/3
$type eq "?" and not $self->{"trace_off"}
!ll&&!rl&&r
000
MC/DC0%0/2
$type eq "?" and not $self->{"trace_off"}
$type eq "?" not $self->{"trace_off"}
Truth table0%0/3
A and not(B)
A= $type eq "?"B= not $self->{"trace_off"}
ABresult
0X0
100
111
4651 0 $trace_info = [$type, $level, $line, $self->{trace_num}];
4652 }
4653 0 ▶ if (grep $_ eq $call, @{$self->trace_quiet}) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(($_ eq $call), @{$self->trace_quiet;})) 0 0 0
4654 0 ▶ $self->{trace_off} += $type eq '?' ? 1 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$type eq '?' ? : 0 0 0
4655 }
4656 0 ▶ if ($type ne '?' and not $self->{trace_off}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type ne "?" and not $self->{"trace_off"}) 0 0 0
Condition0%0/3
$type ne "?" and not $self->{"trace_off"}
!ll&&!rl&&r
000
MC/DC0%0/2
$type ne "?" and not $self->{"trace_off"}
$type ne "?" not $self->{"trace_off"}
Truth table0%0/3
A and not(B)
A= $type ne "?"B= not $self->{"trace_off"}
ABresult
0X0
100
111
4657 0 $trace_info = [$type, $level, $line, $self->{trace_num}];
4658 }
4659  
4660 0 ▶ if (defined $trace_info) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $trace_info) 0 0 0
4661 my ($prev_type, $prev_level, $prev_line, $trace_num) =
4662 0 @{$self->{trace_info}};
4663 0 ▶ if ($prev_type eq '?' and $prev_level eq $level) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_type eq "?" and $prev_level eq $level) 0 0 0
Condition0%0/3
$prev_type eq "?" and $prev_level eq $level
!ll&&!rl&&r
000
MC/DC0%0/2
$prev_type eq "?" and $prev_level eq $level
$prev_type eq "?" $prev_level eq $level
Truth table0%0/3
A and B
A= $prev_type eq "?"B= $prev_level eq $level
ABresult
0X0
100
111
4664 0 $trace_info->[1] = '';
4665 0 ▶ if ($line =~ /^\d*\ *\+/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /^\d*\ *\+/u) { } 0 0 0
4666 0 $prev_line =~ s/\?/=/;
4667 }
4668 else {
4669 0 $prev_line =~ s/\?/!/;
4670 }
4671 }
4672 0 ▶ if ($prev_level) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_level) 0 0 0
4673 warn sprintf "%5d %6d %s",
4674 0 ++$self->{trace_line}, $trace_num, $prev_line;
4675 }
4676  
4677 0 $self->{trace_info} = $trace_info;
4678 }
4679  
4680 0 ▶ if ($call eq $self->trace_start) {
Branch: 1 branch
BranchTrueFalseTotal
if ($call eq $self->trace_start) 0 0 0
4681 0 $self->{trace_on} = not $self->{trace_on};
4682 }
4683 }
4684  
4685 sub trace_format_call {
4686 0 ▶ my ($self, $call, $args) = @_;
Subroutine trace_format_call: not called CC=2 SCAR=17.9
Pod undocumented
4687 0 ▶ return $call unless @$args;
Branch: 1 branch
BranchTrueFalseTotal
unless @$args 0 0 0
4688 0 my $list = join ',', map stringify($_), @$args;
4689 0 return "$call($list)";
4690 }
4691  
4692 sub trace_flush {
4693 2 ▶ my ($self) = @_;
Subroutine trace_flush: called CC=2 SCAR=7.4
Pod undocumented
4694 2 my ($type, $level, $line, $count) = @{$self->{trace_info}};
4695 2 ▶ if (my $line = $self->{trace_info}[2]) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $line = $self->{"trace_info"}[2]) 0 2 2
4696 warn sprintf "%5d %6d %s",
4697 0 ++$self->{trace_line}, $count, $line;
4698 }
4699 }
4700  
4701 2 1;
4702  
4703 # vim: sw=2:
4704  
4705  
4706 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
4707 package PerlYamlReferenceParserReceiver;
4708 2 ▶use PerlYamlReferenceParserPrelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
4709  
4710 sub stream_start_event {
4711 2 ▶ { event => 'stream_start' };
Subroutine stream_start_event: called CC=1 SCAR=0.0
4712 }
4713 sub stream_end_event {
4714 2 ▶ { event => 'stream_end' };
Subroutine stream_end_event: called CC=1 SCAR=0.0
4715 }
4716 sub document_start_event {
4717 4 ▶ { event => 'document_start', explicit => (shift || false), version => undef };
Subroutine document_start_event: called CC=2 SCAR=9.2
Condition33%1/3
shift() || &false()
l!l&&r!l&&!r
004
MC/DC0%0/2
shift() || &false()
shift() &false()
Truth table33%1/3
A || B
A= shift()B= &false()
ABresult
1X1
011
000
4718 }
4719 sub document_end_event {
4720 2 ▶ { event => 'document_end', explicit => (shift || false) };
Subroutine document_end_event: called CC=2 SCAR=9.2
Condition33%1/3
shift() || &false()
l!l&&r!l&&!r
002
MC/DC0%0/2
shift() || &false()
shift() &false()
Truth table33%1/3
A || B
A= shift()B= &false()
ABresult
1X1
011
000
4721 }
4722 sub mapping_start_event {
4723 6 ▶ { event => 'mapping_start', flow => (shift || false) };
Subroutine mapping_start_event: called CC=2 SCAR=7.2
Condition66%2/3
shift() || &false()
l!l&&r!l&&!r
402
MC/DC50%1/2
shift() || &false()
shift() &false()
Truth table66%2/3
A || B
A= shift()B= &false()
ABresult
1X1
011
000
4724 }
4725 sub mapping_end_event {
4726 2 ▶ { event => 'mapping_end' };
Subroutine mapping_end_event: called CC=1 SCAR=0.0
4727 }
4728 sub sequence_start_event {
4729 4 ▶ { event => 'sequence_start', flow => (shift || false) };
Subroutine sequence_start_event: called CC=2 SCAR=7.2
Condition66%2/3
shift() || &false()
l!l&&r!l&&!r
202
MC/DC50%1/2
shift() || &false()
shift() &false()
Truth table66%2/3
A || B
A= shift()B= &false()
ABresult
1X1
011
000
4730 }
4731 sub sequence_end_event {
4732 2 ▶ { event => 'sequence_end' };
Subroutine sequence_end_event: called CC=1 SCAR=0.0
4733 }
4734 sub scalar_event {
4735 20 ▶ my ($style, $value) = @_;
Subroutine scalar_event: called CC=1 SCAR=0.0
4736 20 { event => 'scalar', style => $style, value => $value };
4737 }
4738 sub alias_event {
4739 0 ▶ { event => 'alias', name => (shift) };
Subroutine alias_event: not called CC=1 SCAR=6.9
4740 }
4741 sub cache {
4742 6 ▶ { text => (shift) };
Subroutine cache: called CC=1 SCAR=0.0
4743 }
4744  
4745 sub new {
4746 2 ▶ my ($class, %self) = @_;
Subroutine new: called CC=1 SCAR=0.0
4747 2 bless {
4748 %self,
4749 event => [],
4750 cache => [],
4751 }, $class;
4752 }
4753  
4754 sub send {
4755 26 ▶ my ($self, $event) = @_;
Subroutine send: called CC=2 SCAR=6.9
4756 26 ▶ if (my $callback = $self->{callback}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $callback = $self->{'callback'}) { } 13 13 26
4757 13 $callback->($event);
4758 }
4759 else {
4760 13 push @{$self->{event}}, $event;
4761 }
4762 }
4763  
4764 sub add {
4765 44 ▶ my ($self, $event) = @_;
Subroutine add: called CC=4 SCAR=14.8
4766 44 ▶ if (defined $event->{event}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $event->{"event"}) 38 6 44
4767 38 ▶ if (my $anchor = $self->{anchor}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $anchor = $self->{"anchor"}) 0 38 38
4768 0 $event->{anchor} = delete $self->{anchor};
4769 }
4770 38 ▶ if (my $tag = $self->{tag}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $tag = $self->{"tag"}) 0 38 38
4771 0 $event->{tag} = delete $self->{tag};
4772 }
4773 }
4774 44 $self->push($event);
4775 44 return $event;
4776 }
4777  
4778 sub push {
4779 74 ▶ my ($self, $event) = @_;
Subroutine push: called CC=3 SCAR=11.0
4780 74 ▶ if (@{$self->{cache}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'cache'};}) { } 52 22 74
4781 52 push @{$self->{cache}[-1]}, $event;
4782 }
4783 else {
4784 22 ▶ if ($event->{event} =~ /(mapping_start|sequence_start|scalar)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"event"} =~ /(mapping_start|sequence_start|scalar)/u) 14 8 22
4785 14 $self->check_document_start;
4786 }
4787 22 $self->send($event);
4788 }
4789 }
4790  
4791 sub cache_up {
4792 34 ▶ my ($self, $event) = @_;
Subroutine cache_up: called CC=2 SCAR=6.9
4793 34 CORE::push @{$self->{cache}}, [];
4794 34 ▶ $self->add($event) if $event;
Branch: 1 branch
BranchTrueFalseTotal
if $event 8 26 34
4795 }
4796  
4797 sub cache_down {
4798 6 ▶ my ($self, $event) = @_;
Subroutine cache_down: called CC=4 SCAR=13.9
4799 6 ▶ my $events = pop @{$self->{cache}} or FAIL 'cache_down';
Branch: 1 branch
BranchTrueFalseTotal
my $events = pop @{$$self{"cache"};} or FAIL("cache_down") 0 6 6
4800 6 $self->push($_) for @$events;
4801 6 ▶ $self->add($event) if $event;
Branch: 1 branch
BranchTrueFalseTotal
if $event 2 4 6
4802 }
4803  
4804 sub cache_drop {
4805 28 ▶ my ($self) = @_;
Subroutine cache_drop: called CC=2 SCAR=7.0
4806 28 ▶ my $events = pop @{$self->{cache}} or FAIL 'cache_drop';
Branch: 1 branch
BranchTrueFalseTotal
my $events = pop @{$$self{"cache"};} or FAIL("cache_drop") 0 28 28
4807 28 return $events;
4808 }
4809  
4810 sub cache_get {
4811 0 ▶ my ($self, $type) = @_;
Subroutine cache_get: not called CC=4 SCAR=30.0
4812 return
4813 $self->{cache}[-1] &&
4814 $self->{cache}[-1][0] &&
4815 $self->{cache}[-1][0]{event} eq $type &&
4816 0 ▶ $self->{cache}[-1][0];
Condition0%0/9
$self->{'cache'}[-1] && $self->{'cache'}[-1][0] && $self->{'cache'}[-1][0]{'event'} eq $type && $self->{'cache'}[-1][0]
!ll&&!rl&&r
000
$self->{"cache"}[-1] and $self->{"cache"}[-1][0] and $self->{"cache"}[-1][0]{"event"} eq $type
!ll&&!rl&&r
000
$self->{"cache"}[-1] and $self->{"cache"}[-1][0]
!ll&&!rl&&r
000
MC/DC0%0/4
$self->{'cache'}[-1] && $self->{'cache'}[-1][0] && $self->{'cache'}[-1][0]{'event'} eq $type && $self->{'cache'}[-1][0]
$self->{"cache"}[-1] $self->{"cache"}[-1][0] $self->{"cache"}[-1][0]{"event"} eq $type $self->{'cache'}[-1][0]
Truth table0%0/5
A and B and C && D
A= $self->{"cache"}[-1]B= $self->{"cache"}[-1][0]C= $self->{"cache"}[-1][0]{"event"} eq $typeD= $self->{'cache'}[-1][0]
ABCDresult
0XXX0
10XX0
110X0
11100
11111
4817 }
4818  
4819 sub check_document_start {
4820 14 ▶ my ($self) = @_;
Subroutine check_document_start: called CC=2 SCAR=6.9
4821 14 ▶ return unless $self->{document_start};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"document_start"} 12 2 14
4822 2 $self->send($self->{document_start});
4823 2 delete $self->{document_start};
4824 2 $self->{document_end} = document_end_event;
4825 }
4826  
4827 sub check_document_end {
4828 4 ▶ my ($self) = @_;
Subroutine check_document_end: called CC=2 SCAR=6.9
4829 4 ▶ return unless $self->{document_end};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"document_end"} 2 2 4
4830 2 $self->send($self->{document_end});
4831 2 delete $self->{document_end};
4832 2 $self->{tag_map} = {};
4833 2 $self->{document_start} = document_start_event;
4834 }
4835  
4836 #------------------------------------------------------------------------------
4837 sub try__l_yaml_stream {
4838 2 ▶ my ($self) = @_;
Subroutine try__l_yaml_stream: called CC=1 SCAR=0.0
4839 2 $self->add(stream_start_event);
4840 2 $self->{tag_map} = {};
4841 2 $self->{document_start} = document_start_event;
4842 2 delete $self->{document_end};
4843 }
4844 sub got__l_yaml_stream {
4845 2 ▶ my ($self) = @_;
Subroutine got__l_yaml_stream: called CC=1 SCAR=0.0
4846 2 $self->check_document_end;
4847 2 $self->add(stream_end_event);
4848 }
4849  
4850 sub got__ns_yaml_version {
4851 0 ▶ my ($self, $o) = @_;
Subroutine got__ns_yaml_version: not called CC=2 SCAR=17.9
4852 die "Multiple %YAML directives not allowed"
4853 0 ▶ if defined $self->{document_start}{version};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"document_start"}{"version"} 0 0 0
4854 0 $self->{document_start}{version} = $o->{text};
4855 }
4856  
4857 sub got__c_tag_handle {
4858 0 ▶ my ($self, $o) = @_;
Subroutine got__c_tag_handle: not called CC=1 SCAR=6.9
4859 0 $self->{tag_handle} = $o->{text};
4860 }
4861 sub got__ns_tag_prefix {
4862 0 ▶ my ($self, $o) = @_;
Subroutine got__ns_tag_prefix: not called CC=1 SCAR=6.9
4863 0 $self->{tag_map}{$self->{tag_handle}} = $o->{text};
4864 }
4865  
4866 sub got__c_directives_end {
4867 2 ▶ my ($self) = @_;
Subroutine got__c_directives_end: called CC=1 SCAR=0.0
4868 2 $self->check_document_end;
4869 2 $self->{document_start}{explicit} = true;
4870 }
4871 sub got__c_document_end {
4872 0 ▶ my ($self) = @_;
Subroutine got__c_document_end: not called CC=2 SCAR=17.9
4873 $self->{document_end}{explicit} = true
4874 0 ▶ if defined $self->{document_end};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"document_end"} 0 0 0
4875 0 $self->check_document_end;
4876 }
4877  
4878 0 ▶sub got__c_flow_mapping__all__x7b { $_[0]->add(mapping_start_event(true)) }
Subroutine got__c_flow_mapping__all__x7b: not called CC=1 SCAR=6.9
4879 0 ▶sub got__c_flow_mapping__all__x7d { $_[0]->add(mapping_end_event) }
Subroutine got__c_flow_mapping__all__x7d: not called CC=1 SCAR=6.9
4880  
4881 2 ▶sub got__c_flow_sequence__all__x5b { $_[0]->add(sequence_start_event(true)) }
Subroutine got__c_flow_sequence__all__x5b: called CC=1 SCAR=0.0
4882 2 ▶sub got__c_flow_sequence__all__x5d { $_[0]->add(sequence_end_event) }
Subroutine got__c_flow_sequence__all__x5d: called CC=1 SCAR=0.0
4883  
4884 2 ▶sub try__l_block_mapping { $_[0]->cache_up(mapping_start_event) }
Subroutine try__l_block_mapping: called CC=1 SCAR=0.0
4885 2 ▶sub got__l_block_mapping { $_[0]->cache_down(mapping_end_event) }
Subroutine got__l_block_mapping: called CC=1 SCAR=0.0
4886 0 ▶sub not__l_block_mapping { $_[0]->cache_drop }
Subroutine not__l_block_mapping: not called CC=1 SCAR=6.9
4887  
4888 2 ▶sub try__l_block_sequence { $_[0]->cache_up(sequence_start_event) }
Subroutine try__l_block_sequence: called CC=1 SCAR=0.0
4889 0 ▶sub got__l_block_sequence { $_[0]->cache_down(sequence_end_event) }
Subroutine got__l_block_sequence: not called CC=1 SCAR=6.9
4890 sub not__l_block_sequence {
4891 2 ▶ my ($self) = @_;
Subroutine not__l_block_sequence: called CC=1 SCAR=0.0
4892 2 my $event = $_[0]->cache_drop->[0];
4893 2 $self->{anchor} = $event->{anchor};
4894 2 $self->{tag} = $event->{tag};
4895 }
4896  
4897 0 ▶sub try__ns_l_compact_mapping { $_[0]->cache_up(mapping_start_event) }
Subroutine try__ns_l_compact_mapping: not called CC=1 SCAR=6.9
4898 0 ▶sub got__ns_l_compact_mapping { $_[0]->cache_down(mapping_end_event) }
Subroutine got__ns_l_compact_mapping: not called CC=1 SCAR=6.9
4899 0 ▶sub not__ns_l_compact_mapping { $_[0]->cache_drop }
Subroutine not__ns_l_compact_mapping: not called CC=1 SCAR=6.9
4900  
4901 0 ▶sub try__ns_l_compact_sequence { $_[0]->cache_up(sequence_start_event) }
Subroutine try__ns_l_compact_sequence: not called CC=1 SCAR=6.9
4902 0 ▶sub got__ns_l_compact_sequence { $_[0]->cache_down(sequence_end_event) }
Subroutine got__ns_l_compact_sequence: not called CC=1 SCAR=6.9
4903 0 ▶sub not__ns_l_compact_sequence { $_[0]->cache_drop }
Subroutine not__ns_l_compact_sequence: not called CC=1 SCAR=6.9
4904  
4905 4 ▶sub try__ns_flow_pair { $_[0]->cache_up(mapping_start_event(true)) }
Subroutine try__ns_flow_pair: called CC=1 SCAR=0.0
4906 0 ▶sub got__ns_flow_pair { $_[0]->cache_down(mapping_end_event) }
Subroutine got__ns_flow_pair: not called CC=1 SCAR=6.9
4907 4 ▶sub not__ns_flow_pair { $_[0]->cache_drop }
Subroutine not__ns_flow_pair: called CC=1 SCAR=0.0
4908  
4909 6 ▶sub try__ns_l_block_map_implicit_entry { $_[0]->cache_up }
Subroutine try__ns_l_block_map_implicit_entry: called CC=1 SCAR=0.0
4910 4 ▶sub got__ns_l_block_map_implicit_entry { $_[0]->cache_down }
Subroutine got__ns_l_block_map_implicit_entry: called CC=1 SCAR=0.0
4911 2 ▶sub not__ns_l_block_map_implicit_entry { $_[0]->cache_drop }
Subroutine not__ns_l_block_map_implicit_entry: called CC=1 SCAR=0.0
4912  
4913 6 ▶sub try__c_l_block_map_explicit_entry { $_[0]->cache_up }
Subroutine try__c_l_block_map_explicit_entry: called CC=1 SCAR=0.0
4914 0 ▶sub got__c_l_block_map_explicit_entry { $_[0]->cache_down }
Subroutine got__c_l_block_map_explicit_entry: not called CC=1 SCAR=6.9
4915 6 ▶sub not__c_l_block_map_explicit_entry { $_[0]->cache_drop }
Subroutine not__c_l_block_map_explicit_entry: called CC=1 SCAR=0.0
4916  
4917 4 ▶sub try__c_ns_flow_map_empty_key_entry { $_[0]->cache_up }
Subroutine try__c_ns_flow_map_empty_key_entry: called CC=1 SCAR=0.0
4918 0 ▶sub got__c_ns_flow_map_empty_key_entry { $_[0]->cache_down }
Subroutine got__c_ns_flow_map_empty_key_entry: not called CC=1 SCAR=6.9
4919 4 ▶sub not__c_ns_flow_map_empty_key_entry { $_[0]->cache_drop }
Subroutine not__c_ns_flow_map_empty_key_entry: called CC=1 SCAR=0.0
4920  
4921 sub got__ns_plain {
4922 12 ▶ my ($self, $o) = @_;
Subroutine got__ns_plain: called CC=2 SCAR=7.9
4923 12 my $text = $o->{text};
4924 12 $text =~ s/(?:[\ \t]*\r?\n[\ \t]*)/\n/g;
4925 12 ▶ $text =~ s/(\n)(\n*)/length($2) ? $2 : ' '/ge;
Branch: 1 branch
BranchTrueFalseTotal
length $2 ? : 0 0 0
4926 12 $self->add(scalar_event(plain => $text));
4927 }
4928  
4929 sub got__c_single_quoted {
4930 0 ▶ my ($self, $o) = @_;
Subroutine got__c_single_quoted: not called CC=2 SCAR=17.9
4931 0 my $text = substr($o->{text}, 1, -1);
4932 0 $text =~ s/(?:[\ \t]*\r?\n[\ \t]*)/\n/g;
4933 0 ▶ $text =~ s/(\n)(\n*)/length($2) ? $2 : ' '/ge;
Branch: 1 branch
BranchTrueFalseTotal
length $2 ? : 0 0 0
4934 0 $text =~ s/''/'/g;
4935 0 $self->add(scalar_event(single => $text));
4936 }
4937  
4938 sub got__c_double_quoted {
4939 0 ▶ my ($self, $o) = @_;
Subroutine got__c_double_quoted: not called CC=2 SCAR=17.9
4940 0 my $text = substr($o->{text}, 1, -1);
4941 0 $text =~ s/(?:(?<!\\)[\ \t]*\r?\n[\ \t]*)/\n/g;
4942 0 $text =~ s/\\\n[\ \t]*//g;
4943 0 ▶ $text =~ s/(\n)(\n*)/length($2) ? $2 : ' '/ge;
Branch: 1 branch
BranchTrueFalseTotal
length $2 ? : 0 0 0
4944 0 $text =~ s/\\(["\/])/$1/g;
4945 0 $text =~ s/\\ / /g;
4946 0 $text =~ s/\\b/\b/g;
4947 0 $text =~ s/\\\t/\t/g;
4948 0 $text =~ s/\\t/\t/g;
4949 0 $text =~ s/\\n/\n/g;
4950 0 $text =~ s/\\r/\r/g;
4951 0 $text =~ s/\\x([0-9a-fA-F]{2})/chr(hex($1))/eg;
4952 0 $text =~ s/\\u([0-9a-fA-F]{4})/chr(hex($1))/eg;
4953 0 $text =~ s/\\U([0-9a-fA-F]{8})/chr(hex($1))/eg;
4954 0 $text =~ s/\\\\/\\/g;
4955 0 $self->add(scalar_event(double => $text));
4956 }
4957  
4958 sub got__l_empty {
4959 0 ▶ my ($self) = @_;
Subroutine got__l_empty: not called CC=2 SCAR=17.9
4960 0 ▶ $self->add(cache '') if $self->{in_scalar};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"in_scalar"} 0 0 0
4961 }
4962 sub got__l_nb_literal_text__all__rep2 {
4963 6 ▶ my ($self, $o) = @_;
Subroutine got__l_nb_literal_text__all__rep2: called CC=1 SCAR=0.0
4964 6 $self->add(cache $o->{text});
4965 }
4966 sub try__c_l_literal {
4967 6 ▶ my ($self) = @_;
Subroutine try__c_l_literal: called CC=1 SCAR=0.0
4968 6 $self->{in_scalar} = true;
4969 6 $self->cache_up;
4970 }
4971 sub got__c_l_literal {
4972 2 ▶ my ($self) = @_;
Subroutine got__c_l_literal: called CC=5 SCAR=18.3
4973 2 delete $self->{in_scalar};
4974 2 my $lines = $self->cache_drop;
4975 2 ▶ pop @$lines if @$lines and $lines->[-1]{text} eq '';
Branch: 1 branch
BranchTrueFalseTotal
if @$lines and $lines->[-1]{"text"} eq "" 0 2 2
Condition33%1/3
@$lines and $lines->[-1]{"text"} eq ""
!ll&&!rl&&r
020
MC/DC0%0/2
@$lines and $lines->[-1]{"text"} eq ""
@$lines $lines->[-1]{"text"} eq ""
Truth table33%1/3
A and B
A= @$linesB= $lines->[-1]{"text"} eq ""
ABresult
0X0
100
111
4976 2 my $text = join '', map "$_->{text}\n", @$lines;
4977 2 my $t = $self->{parser}->state_curr->{t};
4978 2 ▶ if ($t eq 'clip') {
Branch: 2 branches
BranchTrueFalseTotal
if ($t eq 'clip') { } 2 0 2
elsif ($t eq 'strip') { } 0 0 0
4979 2 $text =~ s/\n+\z/\n/;
4980 }
4981 elsif ($t eq 'strip') {
4982 0 $text =~ s/\n+\z//;
4983 }
4984 2 $self->add(scalar_event(literal => $text));
4985 }
4986 sub not__c_l_literal {
4987 4 ▶ my ($self) = @_;
Subroutine not__c_l_literal: called CC=1 SCAR=0.0
4988 4 delete $self->{in_scalar};
4989 4 $_[0]->cache_drop;
4990 }
4991  
4992 sub got__ns_char {
4993 46 ▶ my ($self, $o) = @_;
Subroutine got__ns_char: called CC=2 SCAR=7.2
4994 46 ▶ $self->{first} = $o->{text} if $self->{in_scalar};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"in_scalar"} 0 46 46
4995 }
4996 sub got__s_white {
4997 26 ▶ my ($self, $o) = @_;
Subroutine got__s_white: called CC=2 SCAR=7.2
4998 26 ▶ $self->{first} = $o->{text} if $self->{in_scalar};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"in_scalar"} 0 26 26
4999 }
5000 sub got__s_nb_folded_text__all__rep {
5001 0 ▶ my ($self, $o) = @_;
Subroutine got__s_nb_folded_text__all__rep: not called CC=1 SCAR=6.9
5002 0 $self->add(cache "$self->{first}$o->{text}");
5003 }
5004 sub got__s_nb_spaced_text__all__rep {
5005 0 ▶ my ($self, $o) = @_;
Subroutine got__s_nb_spaced_text__all__rep: not called CC=1 SCAR=6.9
5006 0 $self->add(cache "$self->{first}$o->{text}");
5007 }
5008 sub try__c_l_folded {
5009 4 ▶ my ($self) = @_;
Subroutine try__c_l_folded: called CC=1 SCAR=0.0
5010 4 $self->{in_scalar} = true;
5011 4 $self->{first} = '';
5012 4 $self->cache_up;
5013 }
5014 sub got__c_l_folded {
5015 0 ▶ my ($self) = @_;
Subroutine got__c_l_folded: not called CC=4 SCAR=30.0
5016 0 delete $self->{in_scalar};
5017  
5018 0 my @lines = map $_->{text}, @{$self->cache_drop};
5019 0 my $text = join "\n", @lines;
5020 0 $text =~ s/^(\S.*)\n(?=\S)/$1 /gm;
5021 0 $text =~ s/^(\S.*)\n(\n+)/$1$2/gm;
5022 0 $text =~ s/^([\ \t]+\S.*)\n(\n+)(?=\S)/$1$2/gm;
5023 0 $text .= "\n";
5024  
5025 0 my $t = $self->{parser}->state_curr->{t};
5026 0 ▶ if ($t eq 'clip') {
Branch: 2 branches
BranchTrueFalseTotal
if ($t eq 'clip') { } 0 0 0
elsif ($t eq 'strip') { } 0 0 0
5027 0 $text =~ s/\n+\z/\n/;
5028 0 ▶ $text = '' if $text eq "\n";
Branch: 1 branch
BranchTrueFalseTotal
if $text eq "\n" 0 0 0
5029 }
5030 elsif ($t eq 'strip') {
5031 0 $text =~ s/\n+\z//;
5032 }
5033 0 $self->add(scalar_event(folded => $text));
5034 }
5035 sub not__c_l_folded {
5036 4 ▶ my ($self) = @_;
Subroutine not__c_l_folded: called CC=1 SCAR=0.0
5037 4 delete $self->{in_scalar};
5038 4 $_[0]->cache_drop;
5039 }
5040  
5041 6 ▶sub got__e_scalar { $_[0]->add(scalar_event(plain => '')) }
Subroutine got__e_scalar: called CC=1 SCAR=0.0
5042  
5043 sub not__s_l_block_collection__all__rep__all__any__all {
5044 12 ▶ my ($self) = @_;
Subroutine not__s_l_block_collection__all__rep__all__any__all: called CC=1 SCAR=0.0
5045 12 delete $self->{anchor};
5046 12 delete $self->{tag};
5047 }
5048  
5049 sub got__c_ns_anchor_property {
5050 0 ▶ my ($self, $o) = @_;
Subroutine got__c_ns_anchor_property: not called CC=1 SCAR=6.9
5051 0 $self->{anchor} = substr($o->{text}, 1);
5052 }
5053  
5054 sub got__c_ns_tag_property {
5055 0 ▶ my ($self, $o) = @_;
Subroutine got__c_ns_tag_property: not called CC=7 SCAR=40.3
5056 0 my $tag = $o->{text};
5057 0 my $prefix;
5058 0 ▶ if ($tag =~ /^!<(.*)>$/) {
Branch: 4 branches
BranchTrueFalseTotal
if ($tag =~ /^!<(.*)>$/u) { } 0 0 0
elsif ($tag =~ /^!!(.*)/u) { } 0 0 0
elsif ($tag =~ /^(!.*?!)/u) { } 0 0 0
elsif (defined($prefix = $self->{'tag_map'}{'!'})) { } 0 0 0
5059 0 $self->{tag} = $1;
5060 }
5061 elsif ($tag =~ /^!!(.*)/) {
5062 0 ▶ if (defined($prefix = $self->{tag_map}{'!!'})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($prefix = $self->{'tag_map'}{'!!'})) { } 0 0 0
5063 0 $self->{tag} = $prefix . substr($tag, 2);
5064 }
5065 else {
5066 0 $self->{tag} = "tag:yaml.org,2002:$1";
5067 }
5068 }
5069 elsif ($tag =~ /^(!.*?!)/) {
5070 0 $prefix = $self->{tag_map}{$1};
5071 0 ▶ if (defined $prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $prefix) { } 0 0 0
5072 0 $self->{tag} = $prefix . substr($tag, length($1));
5073 }
5074 else {
5075 0 die "No %TAG entry for '$prefix'";
5076 }
5077 }
5078 elsif (defined($prefix = $self->{tag_map}{'!'})) {
5079 0 $self->{tag} = $prefix . substr($tag, 1);
5080 }
5081 else {
5082 0 $self->{tag} = $tag;
5083 }
5084 0 $self->{tag} =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/eg;
5085 }
5086  
5087 sub got__c_ns_alias_node {
5088 0 ▶ my ($self, $o) = @_;
Subroutine got__c_ns_alias_node: not called CC=1 SCAR=6.9
5089 0 my $name = $o->{text};
5090 0 $name =~ s/^\*//;
5091 0 $self->add(alias_event($name));
5092 }
5093  
5094 2 1;
5095  
5096 # vim: sw=2:
5097  
5098  
5099 2 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
5100 package PerlYamlReferenceParserTestReceiver;
5101 2 ▶use base 'PerlYamlReferenceParserReceiver';
Subroutine BEGIN: called CC=1 SCAR=0.0
5102  
5103 2 ▶use PerlYamlReferenceParserPrelude;
Subroutine BEGIN: called CC=1 SCAR=0.0
5104  
5105 2 my $event_map = {
5106 stream_start => '+STR',
5107 stream_end => '-STR',
5108 document_start => '+DOC',
5109 document_end => '-DOC',
5110 mapping_start => '+MAP',
5111 mapping_end => '-MAP',
5112 sequence_start => '+SEQ',
5113 sequence_end => '-SEQ',
5114 scalar => '=VAL',
5115 alias => '=ALI',
5116 };
5117  
5118 2 my $style_map = {
5119 plain => ':',
5120 single => "'",
5121 double => '"',
5122 literal => '|',
5123 folded => '>',
5124 };
5125  
5126 sub output {
5127 1 ▶ my ($self) = @_;
Subroutine output: called CC=13 SCAR=26.4
5128 join '', map {
5129 13 my $type = $event_map->{$_->{event}};
5130 13 my @event = ($type);
5131 13 ▶ push @event, '---' if $type eq '+DOC' and $_->{explicit};
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "+DOC" and $_->{"explicit"} 1 12 13
Condition66%2/3
$type eq "+DOC" and $_->{"explicit"}
!ll&&!rl&&r
1201
MC/DC50%1/2
$type eq "+DOC" and $_->{"explicit"}
$type eq "+DOC" $_->{"explicit"}
Truth table66%2/3
A and B
A= $type eq "+DOC"B= $_->{"explicit"}
ABresult
0X0
100
111
5132 13 ▶ push @event, '...' if $type eq '-DOC' and $_->{explicit};
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "-DOC" and $_->{"explicit"} 0 13 13
Condition66%2/3
$type eq "-DOC" and $_->{"explicit"}
!ll&&!rl&&r
1210
MC/DC0%0/2
$type eq "-DOC" and $_->{"explicit"}
$type eq "-DOC" $_->{"explicit"}
Truth table66%2/3
A and B
A= $type eq "-DOC"B= $_->{"explicit"}
ABresult
0X0
100
111
5133 13 ▶ push @event, '{}' if $type eq '+MAP' and $_->{flow};
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "+MAP" and $_->{"flow"} 0 13 13
Condition66%2/3
$type eq "+MAP" and $_->{"flow"}
!ll&&!rl&&r
1210
MC/DC0%0/2
$type eq "+MAP" and $_->{"flow"}
$type eq "+MAP" $_->{"flow"}
Truth table66%2/3
A and B
A= $type eq "+MAP"B= $_->{"flow"}
ABresult
0X0
100
111
5134 13 ▶ push @event, '[]' if $type eq '+SEQ' and $_->{flow};
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "+SEQ" and $_->{"flow"} 1 12 13
Condition66%2/3
$type eq "+SEQ" and $_->{"flow"}
!ll&&!rl&&r
1201
MC/DC50%1/2
$type eq "+SEQ" and $_->{"flow"}
$type eq "+SEQ" $_->{"flow"}
Truth table66%2/3
A and B
A= $type eq "+SEQ"B= $_->{"flow"}
ABresult
0X0
100
111
5135 13 ▶ push @event, "&$_->{anchor}" if $_->{anchor};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"anchor"} 0 13 13
5136 13 ▶ push @event, "<$_->{tag}>" if $_->{tag};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"tag"} 0 13 13
5137 13 ▶ push @event, "*$_->{name}" if $_->{name};
Branch: 1 branch
BranchTrueFalseTotal
if $_->{"name"} 0 13 13
5138 13 ▶ if (exists $_->{value}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $_->{"value"}) 5 8 13
5139 5 my $style = $style_map->{$_->{style}};
5140 5 my $value = $_->{value};
5141 5 $value =~ s/\\/\\\\/g;
5142 5 $value =~ s/\x08/\\b/g;
5143 5 $value =~ s/\t/\\t/g;
5144 5 $value =~ s/\n/\\n/g;
5145 5 $value =~ s/\r/\\r/g;
5146 5 push @event, "$style$value";
5147 }
5148 13 join(' ', @event) . "\n";
5149 1 } @{$self->{event}};
5150 }
5151  
5152 2 1;
5153  
5154 # vim: sw=2:
5155  
↑ Summary