| 1 | # ABSTRACT: YAML Parser | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 51 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 51 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | package YAML::PP::Parser; | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 51 | our $VERSION = 'v0.41.1'; # TRIAL VERSION | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 51 | ▶ | use constant TRACE => $ENV{YAML_PP_TRACE} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 51 | ▶ | use constant DEBUG => ($ENV{YAML_PP_DEBUG} || $ENV{YAML_PP_TRACE}) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.0
Branch: 1 branch
Condition66%2/3
$ENV{"YAML_PP_DEBUG"} or $ENV{"YAML_PP_TRACE"}
MC/DC50%1/2
$ENV{"YAML_PP_DEBUG"} or $ENV{"YAML_PP_TRACE"}
$ENV{"YAML_PP_DEBUG"}
$ENV{"YAML_PP_TRACE"}
Truth table66%2/3
A or B
A= $ENV{"YAML_PP_DEBUG"}B= $ENV{"YAML_PP_TRACE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 51 | ▶ | use YAML::PP::Common qw/ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 13 | YAML_DOUBLE_QUOTED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 14 | YAML_LITERAL_SCALAR_STYLE YAML_FOLDED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 15 | YAML_FLOW_SEQUENCE_STYLE YAML_FLOW_MAPPING_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 51 | /; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 51 | ▶ | use YAML::PP::Render; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 51 | ▶ | use YAML::PP::Lexer; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 51 | ▶ | use YAML::PP::Grammar qw/ $GRAMMAR /; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 51 | ▶ | use YAML::PP::Exception; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 51 | ▶ | use YAML::PP::Reader; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 51 | ▶ | use Carp qw/ croak /; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 4767 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 4767 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 4767 | ▶ | my $reader = delete $args{reader} || YAML::PP::Reader->new; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
delete $args{'reader'} || 'YAML::PP::Reader'->new
MC/DC0%0/2
delete $args{'reader'} || 'YAML::PP::Reader'->new
delete $args{'reader'}
'YAML::PP::Reader'->new
Truth table33%1/3
A || B
A= delete $args{'reader'}B= 'YAML::PP::Reader'->new
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 4767 | my $default_yaml_version = delete $args{default_yaml_version}; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 4767 | ▶ | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$default_yaml_version || '1.2'
MC/DC100%1/1
$default_yaml_version || '1.2'
$default_yaml_version
Truth table100%2/2
A
A= $default_yaml_version
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | default_yaml_version => $default_yaml_version || '1.2', | ||||||||||||||||||||||||||||||||||||||||||
| 31 | lexer => YAML::PP::Lexer->new( | ||||||||||||||||||||||||||||||||||||||||||
| 32 | reader => $reader, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 34 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 4767 | my $receiver = delete $args{receiver}; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 4767 | ▶ | if ($receiver) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 4002 | $self->set_receiver($receiver); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 4767 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | my $clone = { | |||||||||||||||||||||||||||||||||||||||||
| 45 | default_yaml_version => $self->default_yaml_version, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | lexer => YAML::PP::Lexer->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 47 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 9 | return bless $clone, ref $self; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 765 | ▶ | sub receiver { return $_[0]->{receiver} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
receiver: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 4776 | ▶ | sub set_receiver { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_receiver: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 4776 | my ($self, $receiver) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 4776 | my $callback; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 4776 | ▶ | if (ref $receiver eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 4002 | $callback = $receiver; | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 41424 | ▶ | $callback = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 41424 | my ($self, $event, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 41424 | return $receiver->$event($info); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 774 | }; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 4776 | $self->{callback} = $callback; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 4776 | $self->{receiver} = $receiver; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 4 | ▶ | sub reader { return $_[0]->lexer->{reader} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reader: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 7690 | ▶ | sub set_reader { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_reader: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 7690 | my ($self, $reader) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 7690 | $self->lexer->set_reader($reader); | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 165874 | ▶ | sub lexer { return $_[0]->{lexer} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lexer: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 104519 | ▶ | sub callback { return $_[0]->{callback} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callback: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub set_callback { $_[0]->{callback} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_callback: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 28894 | ▶ | sub level { return $#{ $_[0]->{offset} } } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
level: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 126335 | ▶ | sub offset { return $_[0]->{offset} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
offset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 7690 | ▶ | sub set_offset { $_[0]->{offset} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_offset: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 211451 | ▶ | sub events { return $_[0]->{events} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
events: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 7690 | ▶ | sub set_events { $_[0]->{events} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_events: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 66424 | ▶ | sub new_node { return $_[0]->{new_node} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_node: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 99279 | ▶ | sub set_new_node { $_[0]->{new_node} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_new_node: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 2856 | ▶ | sub tagmap { return $_[0]->{tagmap} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tagmap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 15810 | ▶ | sub set_tagmap { $_[0]->{tagmap} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tagmap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 36201 | ▶ | sub tokens { return $_[0]->{tokens} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 7690 | ▶ | sub set_tokens { $_[0]->{tokens} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_tokens: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 163004 | ▶ | sub event_stack { return $_[0]->{event_stack} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
event_stack: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 7690 | ▶ | sub set_event_stack { $_[0]->{event_stack} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_event_stack: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 7699 | ▶ | sub default_yaml_version { return $_[0]->{default_yaml_version} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_yaml_version: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 8347 | ▶ | sub yaml_version { return $_[0]->{yaml_version} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
yaml_version: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 7848 | ▶ | sub set_yaml_version { $_[0]->{yaml_version} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_yaml_version: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 8475 | ▶ | sub yaml_version_directive { return $_[0]->{yaml_version_directive} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
yaml_version_directive: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 16164 | ▶ | sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_yaml_version_directive: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 34331 | ▶ | sub rule { return $_[0]->{rule} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 183177 | ▶ | sub set_rule { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_rule: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 183177 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 51 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 183177 | DEBUG and $self->info("set_rule($name)"); | |||||||||||||||||||||||||||||||||||||||||
| 99 | 183177 | $self->{rule} = $name; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 7690 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 7690 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 7690 | $self->set_offset([]); | |||||||||||||||||||||||||||||||||||||||||
| 105 | 7690 | $self->set_events([]); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 7690 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 7690 | $self->set_tagmap({ | |||||||||||||||||||||||||||||||||||||||||
| 108 | '!!' => "tag:yaml.org,2002:", | ||||||||||||||||||||||||||||||||||||||||||
| 109 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 7690 | $self->set_tokens([]); | |||||||||||||||||||||||||||||||||||||||||
| 111 | 7690 | $self->set_rule(undef); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 7690 | $self->set_event_stack([]); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 7690 | $self->set_yaml_version($self->default_yaml_version); | |||||||||||||||||||||||||||||||||||||||||
| 114 | 7690 | $self->set_yaml_version_directive(undef); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 7690 | $self->lexer->init; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 5479 | ▶ | sub parse_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 5479 | my ($self, $yaml) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 5479 | $self->set_reader(YAML::PP::Reader->new( input => $yaml )); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 5479 | $self->parse(); | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my ($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $self->set_reader(YAML::PP::Reader::File->new( input => $file )); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->parse(); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 51 | my %nodetypes = ( | |||||||||||||||||||||||||||||||||||||||||
| 131 | MAPVALUE => 'NODETYPE_COMPLEX', | ||||||||||||||||||||||||||||||||||||||||||
| 132 | MAP => 'NODETYPE_MAP', | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # IMAP => 'NODETYPE_SEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 134 | SEQ => 'NODETYPE_SEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 135 | SEQ0 => 'NODETYPE_SEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 136 | FLOWMAP => 'NODETYPE_FLOWMAP', | ||||||||||||||||||||||||||||||||||||||||||
| 137 | FLOWMAPVALUE => 'NODETYPE_FLOWMAPVALUE', | ||||||||||||||||||||||||||||||||||||||||||
| 138 | FLOWSEQ => 'NODETYPE_FLOWSEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 139 | FLOWSEQ_NEXT => 'FLOWSEQ_NEXT', | ||||||||||||||||||||||||||||||||||||||||||
| 140 | DOC => 'FULLNODE', | ||||||||||||||||||||||||||||||||||||||||||
| 141 | DOC_END => 'DOCUMENT_END', | ||||||||||||||||||||||||||||||||||||||||||
| 142 | STR => 'STREAM', | ||||||||||||||||||||||||||||||||||||||||||
| 143 | END_FLOW => 'END_FLOW', | ||||||||||||||||||||||||||||||||||||||||||
| 144 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 7690 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 7690 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 7690 | TRACE and warn "=== parse()\n"; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 7690 | TRACE and $self->debug_yaml; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 7690 | $self->init; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 7690 | $self->lexer->init; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 7690 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 153 | 7690 | $self->start_stream; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 7690 | $self->set_rule( 'STREAM' ); | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 7690 | $self->parse_tokens(); | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 7528 | $self->end_stream; | |||||||||||||||||||||||||||||||||||||||||
| 159 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 7690 | ▶ | if (my $error = $@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 162 | ▶ | if (ref $error) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 124 | croak "$error\n "; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 38 | croak $error; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 7528 | DEBUG and $self->highlight_yaml; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 7528 | TRACE and $self->debug_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 41914 | ▶ | sub lex_next_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lex_next_tokens: called CC=18 SCAR=28.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 41914 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 41914 | DEBUG and $self->info("----------------> lex_next_tokens"); | |||||||||||||||||||||||||||||||||||||||||
| 175 | 41914 | TRACE and $self->debug_events; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 41914 | my $indent = $self->offset->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 41914 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 41914 | my $next_tokens = $self->lexer->fetch_next_tokens($indent); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 41879 | ▶ | return unless @$next_tokens; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 34342 | my $next = $next_tokens->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 34342 | ▶ | return 1 if ($next->{name} ne 'SPACE'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 28195 | my $flow = $event_types->[-1] =~ m/^FLOW/; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 28195 | my $space = length $next->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 28195 | my $tokens = $self->tokens; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 28195 | ▶ | if (not $space) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 14465 | shift @$next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 13730 | push @$tokens, shift @$next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 28195 | ▶ | if ($flow) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 720 | ▶ | if ($space >= $indent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 717 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 3 | $self->exception("Bad indendation in " . $self->events->[-1]); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 27475 | $next = $next_tokens->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 27475 | ▶ | if ($space > $indent ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 8267 | ▶ | return 1 if $indent < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 2122 | ▶ | unless ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 4 | $self->exception("Bad indendation in " . $self->events->[-1]); | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 2118 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 19208 | ▶ | if ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 1289 | ▶ | if ($space < $indent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 437 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 437 | $self->remove_nodes($space); | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | # unindented sequence starts | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 852 | my $exp = $self->events->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 852 | my $seq_start = $next->{name} eq 'DASH'; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 852 | ▶ | if ( $seq_start and ($exp eq 'MAPVALUE' or $exp eq 'MAP')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$seq_start and $exp eq "MAPVALUE" || $exp eq "MAP"
$exp eq "MAPVALUE" or $exp eq "MAP"
MC/DC100%3/3
$seq_start and $exp eq "MAPVALUE" || $exp eq "MAP"
$seq_start
$exp eq "MAPVALUE"
$exp eq "MAP"
Truth table100%4/4
A and B or C
A= $seq_startB= $exp eq "MAPVALUE"C= $exp eq "MAP"
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 289 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 17919 | ▶ | if ($space < $indent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 2199 | $self->remove_nodes($space); | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 19208 | my $exp = $self->events->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 19208 | ▶ | if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$exp eq "SEQ0" and $next->{"name"} ne "DASH"
MC/DC100%2/2
$exp eq "SEQ0" and $next->{"name"} ne "DASH"
$exp eq "SEQ0"
$next->{"name"} ne "DASH"
Truth table100%3/3
A and B
A= $exp eq "SEQ0"B= $next->{"name"} ne "DASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 242 | TRACE and $self->info("In unindented sequence"); | |||||||||||||||||||||||||||||||||||||||||
| 235 | 242 | $self->end_sequence; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 242 | $exp = $self->events->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 19208 | ▶ | if ($self->offset->[-1] != $space) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 4 | $self->exception("Expected " . $self->events->[-1]); | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 19204 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 51 | my %next_event = ( | |||||||||||||||||||||||||||||||||||||||||
| 246 | MAP => 'MAPVALUE', | ||||||||||||||||||||||||||||||||||||||||||
| 247 | IMAP => 'IMAPVALUE', | ||||||||||||||||||||||||||||||||||||||||||
| 248 | MAPVALUE => 'MAP', | ||||||||||||||||||||||||||||||||||||||||||
| 249 | IMAPVALUE => 'IMAP', | ||||||||||||||||||||||||||||||||||||||||||
| 250 | SEQ => 'SEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 251 | SEQ0 => 'SEQ0', | ||||||||||||||||||||||||||||||||||||||||||
| 252 | DOC => 'DOC_END', | ||||||||||||||||||||||||||||||||||||||||||
| 253 | STR => 'STR', | ||||||||||||||||||||||||||||||||||||||||||
| 254 | FLOWSEQ => 'FLOWSEQ_NEXT', | ||||||||||||||||||||||||||||||||||||||||||
| 255 | FLOWSEQ_NEXT => 'FLOWSEQ', | ||||||||||||||||||||||||||||||||||||||||||
| 256 | FLOWMAP => 'FLOWMAPVALUE', | ||||||||||||||||||||||||||||||||||||||||||
| 257 | FLOWMAPVALUE => 'FLOWMAP', | ||||||||||||||||||||||||||||||||||||||||||
| 258 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 51 | my %event_to_method = ( | |||||||||||||||||||||||||||||||||||||||||
| 261 | MAP => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||
| 262 | IMAP => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||
| 263 | FLOWMAP => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||
| 264 | SEQ => 'sequence', | ||||||||||||||||||||||||||||||||||||||||||
| 265 | SEQ0 => 'sequence', | ||||||||||||||||||||||||||||||||||||||||||
| 266 | FLOWSEQ => 'sequence', | ||||||||||||||||||||||||||||||||||||||||||
| 267 | DOC => 'document', | ||||||||||||||||||||||||||||||||||||||||||
| 268 | STR => 'stream', | ||||||||||||||||||||||||||||||||||||||||||
| 269 | VAL => 'scalar', | ||||||||||||||||||||||||||||||||||||||||||
| 270 | ALI => 'alias', | ||||||||||||||||||||||||||||||||||||||||||
| 271 | MAPVALUE => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||
| 272 | IMAPVALUE => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | #sub process_events { | ||||||||||||||||||||||||||||||||||||||||||
| 276 | # my ($self, $res) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 277 | # | ||||||||||||||||||||||||||||||||||||||||||
| 278 | # my $event_stack = $self->event_stack; | ||||||||||||||||||||||||||||||||||||||||||
| 279 | # return unless @$event_stack; | ||||||||||||||||||||||||||||||||||||||||||
| 280 | # | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # if (@$event_stack == 1 and $event_stack->[0]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||||
| 282 | # return; | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | # | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # my $event_types = $self->events; | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # my $properties; | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # my @send_events; | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # for my $event (@$event_stack) { | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$event], ['event']); | ||||||||||||||||||||||||||||||||||||||||||
| 290 | # my ($type, $info) = @$event; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # if ($type eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||||
| 292 | # $properties = $info; | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # elsif ($type eq 'scalar') { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | # $info->{name} = 'scalar_event'; | ||||||||||||||||||||||||||||||||||||||||||
| 296 | # $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||||||||||||||||||||||||||||||||||||||||
| 297 | # push @send_events, $info; | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # elsif ($type eq 'begin') { | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # my $name = $info->{name}; | ||||||||||||||||||||||||||||||||||||||||||
| 301 | # $info->{name} = $event_to_method{ $name } . '_start_event'; | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # push @{ $event_types }, $name; | ||||||||||||||||||||||||||||||||||||||||||
| 303 | # push @{ $self->offset }, $info->{offset}; | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # push @send_events, $info; | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | # elsif ($type eq 'end') { | ||||||||||||||||||||||||||||||||||||||||||
| 307 | # my $name = $info->{name}; | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # $info->{name} = $event_to_method{ $name } . '_end_event'; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # $self->$type($name, $info); | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # push @send_events, $info; | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # if (@$event_types) { | ||||||||||||||||||||||||||||||||||||||||||
| 312 | # $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||||||||||||||||||||||||||||||||||||||||
| 313 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 315 | # elsif ($type eq 'alias') { | ||||||||||||||||||||||||||||||||||||||||||
| 316 | # if ($properties) { | ||||||||||||||||||||||||||||||||||||||||||
| 317 | # $self->exception("Parse error: Alias not allowed in this context"); | ||||||||||||||||||||||||||||||||||||||||||
| 318 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | # $info->{name} = 'alias_event'; | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||||||||||||||||||||||||||||||||||||||||
| 321 | # push @send_events, $info; | ||||||||||||||||||||||||||||||||||||||||||
| 322 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | # @$event_stack = (); | ||||||||||||||||||||||||||||||||||||||||||
| 325 | # for my $info (@send_events) { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | # DEBUG and $self->debug_event( $info ); | ||||||||||||||||||||||||||||||||||||||||||
| 327 | # $self->callback->($self, $info->{name}, $info); | ||||||||||||||||||||||||||||||||||||||||||
| 328 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 51 | my %fetch_method = ( | |||||||||||||||||||||||||||||||||||||||||
| 332 | '"' => 'fetch_quoted', | ||||||||||||||||||||||||||||||||||||||||||
| 333 | "'" => 'fetch_quoted', | ||||||||||||||||||||||||||||||||||||||||||
| 334 | '|' => 'fetch_block', | ||||||||||||||||||||||||||||||||||||||||||
| 335 | '>' => 'fetch_block', | ||||||||||||||||||||||||||||||||||||||||||
| 336 | '' => 'fetch_plain', | ||||||||||||||||||||||||||||||||||||||||||
| 337 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 7690 | ▶ | sub parse_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_tokens: called CC=25 SCAR=32.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 7690 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 341 | 7690 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 7690 | my $offsets = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 7690 | my $tokens = $self->tokens; | |||||||||||||||||||||||||||||||||||||||||
| 344 | 7690 | my $next_tokens = $self->lexer->next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 7690 | ▶ | unless ($self->lex_next_tokens) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 69 | $self->end_document(1); | |||||||||||||||||||||||||||||||||||||||||
| 348 | 69 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 7587 | ▶ | unless ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 7587 | ▶ | if ($self->level > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | my $new_rule = $nodetypes{ $event_types->[-1] } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | or die "Did not find '$event_types->[-1]'"; | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self->set_rule( $new_rule ); | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 7587 | my $rule_name = $self->rule; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 7587 | DEBUG and $self->info("----------------> parse_tokens($rule_name)"); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 7587 | ▶ | my $rule = $GRAMMAR->{ $rule_name } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | or die "Could not find rule $rule_name"; | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 7587 | TRACE and $self->debug_rules($rule); | |||||||||||||||||||||||||||||||||||||||||
| 364 | 7587 | TRACE and $self->debug_yaml; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 7587 | DEBUG and $self->debug_next_line; | |||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 7587 | ▶ | RULE: while ($rule_name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | 291090 | DEBUG and $self->info("RULE: $rule_name"); | |||||||||||||||||||||||||||||||||||||||||
| 369 | 291090 | TRACE and $self->debug_tokens($next_tokens); | |||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 291090 | ▶ | unless (@$next_tokens) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $self->exception("No more tokens"); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 291090 | TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']); | |||||||||||||||||||||||||||||||||||||||||
| 375 | 291090 | my $got = $next_tokens->[0]->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 291090 | ▶ | if ($got eq 'CONTEXT') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 46305 | my $context = shift @$next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 46305 | my $indent = $offsets->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 379 | 46305 | ▶ | $indent++ unless $self->lexer->flowcontext; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 46305 | my $method = $fetch_method{ $context->{value} }; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 46305 | my $partial = $self->lexer->$method($indent, $context->{value}); | |||||||||||||||||||||||||||||||||||||||||
| 382 | 46279 | next RULE; | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 244785 | my $def = $rule->{ $got }; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 244785 | ▶ | if ($def) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 163029 | push @$tokens, shift @$next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | elsif ($def = $rule->{DEFAULT}) { | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 81708 | $got = 'DEFAULT'; | |||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 48 | $self->expected( | |||||||||||||||||||||||||||||||||||||||||
| 393 | expected => [keys %$rule], | ||||||||||||||||||||||||||||||||||||||||||
| 394 | got => $next_tokens->[0], | ||||||||||||||||||||||||||||||||||||||||||
| 395 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 244737 | DEBUG and $self->got("---got $got"); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 244737 | ▶ | if (my $sub = $def->{match}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 122388 | DEBUG and $self->info("CALLBACK $sub"); | |||||||||||||||||||||||||||||||||||||||||
| 401 | 122388 | ▶ | $self->$sub(@$tokens ? $tokens->[-1] : ()); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 244704 | my $eol = $got eq 'EOL'; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 244704 | my $new = $def->{new}; | |||||||||||||||||||||||||||||||||||||||||
| 405 | 244704 | ▶ | if ($new) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 124079 | DEBUG and $self->got("NEW: $new"); | |||||||||||||||||||||||||||||||||||||||||
| 407 | 124079 | $rule_name = $new; | |||||||||||||||||||||||||||||||||||||||||
| 408 | 124079 | $self->set_rule($rule_name); | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | elsif ($eol) { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | elsif ($def->{return}) { | ||||||||||||||||||||||||||||||||||||||||||
| 413 | 6786 | ▶ | $rule_name = $nodetypes{ $event_types->[-1] } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | or die "Unexpected event type $event_types->[-1]"; | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 6786 | $self->set_rule($rule_name); | |||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 87542 | $rule_name .= " - $got"; # for debugging | |||||||||||||||||||||||||||||||||||||||||
| 419 | 87542 | $rule = $def; | |||||||||||||||||||||||||||||||||||||||||
| 420 | 87542 | next RULE; | |||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 157162 | ▶ | if ($eol) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 34224 | ▶ | unless ($self->lex_next_tokens) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 7468 | ▶ | if ($rule_name eq 'DIRECTIVE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | $self->exception("Directive needs document start"); | |||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 7467 | $self->end_document(1); | |||||||||||||||||||||||||||||||||||||||||
| 428 | 7459 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 26744 | ▶ | unless ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 21307 | ▶ | if ($self->level > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 20423 | ▶ | $rule_name = $nodetypes{ $event_types->[-1] } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | or die "Did not find '$event_types->[-1]'"; | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 20423 | $self->set_rule( $rule_name ); | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 26744 | $rule_name = $self->rule; | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 149682 | ▶ | $rule = $GRAMMAR->{ $rule_name } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 440 | or die "Unexpected rule $rule_name"; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | die "Unexpected"; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 242 | ▶ | sub end_sequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_sequence: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 242 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 449 | 242 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 450 | 242 | pop @{ $event_types }; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 242 | pop @{ $self->offset }; | |||||||||||||||||||||||||||||||||||||||||
| 452 | 242 | my $info = { name => 'sequence_end_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 453 | 242 | $self->callback->($self, $info->{name} => $info ); | |||||||||||||||||||||||||||||||||||||||||
| 454 | 242 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 11313 | ▶ | sub remove_nodes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_nodes: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 11313 | my ($self, $space) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 459 | 11313 | my $offset = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 460 | 11313 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 11313 | my $exp = $event_types->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 463 | 11313 | ▶ | while (@$offset) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 19939 | ▶ | if ($offset->[ -1 ] <= $space) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | 11306 | last; | |||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 8633 | ▶ | if ($exp eq 'MAPVALUE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 51 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 51 | $exp = 'MAP'; | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 8633 | my $info = { name => $exp }; | |||||||||||||||||||||||||||||||||||||||||
| 472 | 8633 | $info->{name} = $event_to_method{ $exp } . '_end_event'; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 8633 | pop @{ $event_types }; | |||||||||||||||||||||||||||||||||||||||||
| 474 | 8633 | pop @{ $offset }; | |||||||||||||||||||||||||||||||||||||||||
| 475 | 8633 | $self->callback->($self, $info->{name} => $info ); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 8626 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 8626 | $exp = $event_types->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 11306 | return $exp; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 7690 | ▶ | sub start_stream { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_stream: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 7690 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 484 | 7690 | push @{ $self->events }, 'STR'; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 7690 | push @{ $self->offset }, -1; | |||||||||||||||||||||||||||||||||||||||||
| 486 | 7690 | $self->callback->($self, 'stream_start_event', { | |||||||||||||||||||||||||||||||||||||||||
| 487 | name => 'stream_start_event', | ||||||||||||||||||||||||||||||||||||||||||
| 488 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 8316 | ▶ | sub start_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | 8316 | my ($self, $implicit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 493 | 8316 | push @{ $self->events }, 'DOC'; | |||||||||||||||||||||||||||||||||||||||||
| 494 | 8316 | push @{ $self->offset }, -1; | |||||||||||||||||||||||||||||||||||||||||
| 495 | 8316 | my $directive = $self->yaml_version_directive; | |||||||||||||||||||||||||||||||||||||||||
| 496 | 8316 | my %directive; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 8316 | ▶ | if ($directive) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 154 | my ($major, $minor) = split m/\./, $self->yaml_version; | |||||||||||||||||||||||||||||||||||||||||
| 499 | 154 | %directive = ( version_directive => { major => $major, minor => $minor } ); | |||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||
| 501 | 8316 | $self->callback->($self, 'document_start_event', { | |||||||||||||||||||||||||||||||||||||||||
| 502 | name => 'document_start_event', | ||||||||||||||||||||||||||||||||||||||||||
| 503 | implicit => $implicit, | ||||||||||||||||||||||||||||||||||||||||||
| 504 | %directive, | ||||||||||||||||||||||||||||||||||||||||||
| 505 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 506 | 8316 | $self->set_yaml_version_directive(undef); | |||||||||||||||||||||||||||||||||||||||||
| 507 | 8316 | $self->set_rule( 'FULLNODE' ); | |||||||||||||||||||||||||||||||||||||||||
| 508 | 8316 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 3258 | ▶ | sub start_sequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_sequence: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 3258 | my ($self, $offset) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 3258 | my $offsets = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 514 | 3258 | ▶ | if ($offsets->[-1] == $offset) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | 563 | push @{ $self->events }, 'SEQ0'; | |||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||
| 517 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 2695 | push @{ $self->events }, 'SEQ'; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | 3258 | push @{ $offsets }, $offset; | |||||||||||||||||||||||||||||||||||||||||
| 521 | 3258 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 522 | 3258 | my $info = { name => 'sequence_start_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 3258 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | 227 | my $properties = pop @$event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 525 | 227 | $self->node_properties($properties->[1], $info); | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 3258 | $self->callback->($self, 'sequence_start_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 1440 | ▶ | sub start_flow_sequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_flow_sequence: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | 1440 | my ($self, $offset) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 532 | 1440 | my $offsets = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 1440 | my $new_offset = $offsets->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 534 | 1440 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 535 | 1440 | ▶ | if ($new_offset < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 164 | $new_offset = 0; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | elsif ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||||
| 539 | 1213 | ▶ | if ($event_types->[-1] !~ m/^FLOW/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 1008 | $new_offset++; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 1440 | push @{ $self->events }, 'FLOWSEQ'; | |||||||||||||||||||||||||||||||||||||||||
| 544 | 1440 | push @{ $offsets }, $new_offset; | |||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 1440 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 547 | 1440 | my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 548 | 1440 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 42 | $self->fetch_inline_properties($event_stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | 1440 | $self->callback->($self, 'sequence_start_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | 1219 | ▶ | sub start_flow_mapping { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_flow_mapping: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 555 | 1219 | my ($self, $offset, $implicit_flowseq_map) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 556 | 1219 | my $offsets = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 557 | 1219 | my $new_offset = $offsets->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 1219 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 559 | 1219 | ▶ | if ($new_offset < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 560 | 409 | $new_offset = 0; | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | elsif ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 706 | ▶ | if ($event_types->[-1] !~ m/^FLOW/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | 618 | $new_offset++; | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | 1219 | ▶ | push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 1219 | push @{ $offsets }, $new_offset; | |||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 1219 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 571 | 1219 | my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE }; | |||||||||||||||||||||||||||||||||||||||||
| 572 | 1219 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 71 | $self->fetch_inline_properties($event_stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | 1219 | $self->callback->($self, 'mapping_start_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 1416 | ▶ | sub end_flow_sequence { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_flow_sequence: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | 1416 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 580 | 1416 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 581 | 1416 | pop @{ $event_types }; | |||||||||||||||||||||||||||||||||||||||||
| 582 | 1416 | pop @{ $self->offset }; | |||||||||||||||||||||||||||||||||||||||||
| 583 | 1416 | my $info = { name => 'sequence_end_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 584 | 1416 | $self->callback->($self, $info->{name}, $info); | |||||||||||||||||||||||||||||||||||||||||
| 585 | 1416 | ▶ | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | 258 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||
| 588 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 1158 | push @$event_types, 'END_FLOW'; | |||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 1205 | ▶ | sub end_flow_mapping { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_flow_mapping: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 1205 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 595 | 1205 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 596 | 1205 | pop @{ $event_types }; | |||||||||||||||||||||||||||||||||||||||||
| 597 | 1205 | pop @{ $self->offset }; | |||||||||||||||||||||||||||||||||||||||||
| 598 | 1205 | my $info = { name => 'mapping_end_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 599 | 1205 | $self->callback->($self, $info->{name}, $info); | |||||||||||||||||||||||||||||||||||||||||
| 600 | 1197 | ▶ | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 601 | 182 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||
| 603 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 604 | 1015 | push @$event_types, 'END_FLOW'; | |||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 2167 | ▶ | sub cb_end_outer_flow { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_outer_flow: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 609 | 2167 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 610 | 2167 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 611 | 2167 | pop @$event_types; | |||||||||||||||||||||||||||||||||||||||||
| 612 | 2167 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | 5700 | ▶ | sub start_mapping { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_mapping: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 5700 | my ($self, $offset) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 5700 | my $offsets = $self->offset; | |||||||||||||||||||||||||||||||||||||||||
| 618 | 5700 | push @{ $self->events }, 'MAP'; | |||||||||||||||||||||||||||||||||||||||||
| 619 | 5700 | push @{ $offsets }, $offset; | |||||||||||||||||||||||||||||||||||||||||
| 620 | 5700 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 5700 | my $info = { name => 'mapping_start_event' }; | |||||||||||||||||||||||||||||||||||||||||
| 622 | 5700 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 492 | my $properties = pop @$event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 624 | 492 | $self->node_properties($properties->[1], $info); | |||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 5700 | $self->callback->($self, 'mapping_start_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 8678 | ▶ | sub end_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 630 | 8678 | my ($self, $implicit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 8678 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 633 | 8678 | ▶ | if ($event_types->[-1] =~ m/FLOW/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 1 | die "Unexpected end of flow context"; | |||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 636 | 8677 | ▶ | if ($self->new_node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 637 | 501 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | |||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||
| 639 | 8677 | $self->remove_nodes(-1); | |||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | 8670 | ▶ | if ($event_types->[-1] eq 'STR') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 642 | 474 | return; | |||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 8196 | my $last = pop @{ $event_types }; | |||||||||||||||||||||||||||||||||||||||||
| 645 | 8196 | ▶ | if ($last ne 'DOC' and $last ne 'DOC_END') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$last ne "DOC" and $last ne "DOC_END"
MC/DC0%0/2
$last ne "DOC" and $last ne "DOC_END"
$last ne "DOC"
$last ne "DOC_END"
Truth table33%1/3
A and B
A= $last ne "DOC"B= $last ne "DOC_END"
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | $self->exception("Unexpected event type $last"); | |||||||||||||||||||||||||||||||||||||||||
| 647 | } | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 8196 | pop @{ $self->offset }; | |||||||||||||||||||||||||||||||||||||||||
| 649 | 8196 | $self->callback->($self, 'document_end_event', { | |||||||||||||||||||||||||||||||||||||||||
| 650 | name => 'document_end_event', | ||||||||||||||||||||||||||||||||||||||||||
| 651 | implicit => $implicit, | ||||||||||||||||||||||||||||||||||||||||||
| 652 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 653 | 8193 | ▶ | if ($self->yaml_version eq '1.2') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 654 | # In YAML 1.2, directives are only for the following | ||||||||||||||||||||||||||||||||||||||||||
| 655 | # document. In YAML 1.1, they are global | ||||||||||||||||||||||||||||||||||||||||||
| 656 | 8120 | $self->set_tagmap({ '!!' => "tag:yaml.org,2002:" }); | |||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | 8193 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 659 | 8193 | $self->set_rule('STREAM'); | |||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | 7528 | ▶ | sub end_stream { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_stream: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 7528 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 664 | 7528 | my $last = pop @{ $self->events }; | |||||||||||||||||||||||||||||||||||||||||
| 665 | 7528 | ▶ | $self->exception("Unexpected event type $last") unless $last eq 'STR'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 666 | 7528 | pop @{ $self->offset }; | |||||||||||||||||||||||||||||||||||||||||
| 667 | 7528 | $self->callback->($self, 'stream_end_event', { | |||||||||||||||||||||||||||||||||||||||||
| 668 | name => 'stream_end_event', | ||||||||||||||||||||||||||||||||||||||||||
| 669 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 3438 | ▶ | sub fetch_inline_properties { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_inline_properties: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 673 | 3438 | my ($self, $stack, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 674 | 3438 | my $properties = $stack->[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | 3438 | $properties = $properties->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 677 | 3438 | my $property_offset; | |||||||||||||||||||||||||||||||||||||||||
| 678 | 3438 | ▶ | if ($properties) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 3438 | for my $p (@{ $properties->{inline} }) { | |||||||||||||||||||||||||||||||||||||||||
| 680 | 3486 | my $type = $p->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 681 | 3486 | ▶ | if (exists $info->{ $type }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->exception("A node can only have one $type"); | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | 3486 | $info->{ $type } = $p->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 685 | 3486 | ▶ | unless (defined $property_offset) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 3046 | $property_offset = $p->{offset}; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 3046 | $info->{offset} = $p->{offset}; | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||
| 690 | 3438 | delete $properties->{inline}; | |||||||||||||||||||||||||||||||||||||||||
| 691 | 3438 | ▶ | undef $properties unless $properties->{newline}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 3438 | ▶ | unless ($properties) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | 2909 | pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 1164 | ▶ | sub node_properties { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_properties: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 1164 | my ($self, $properties, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 701 | 1164 | ▶ | if ($properties) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | 1164 | for my $p (@{ $properties->{newline} }) { | |||||||||||||||||||||||||||||||||||||||||
| 703 | 1336 | my $type = $p->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 704 | 1336 | ▶ | if (exists $info->{ $type }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | $self->exception("A node can only have one $type"); | |||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||
| 707 | 1335 | $info->{ $type } = $p->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||
| 709 | 1163 | undef $properties; | |||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | 49123 | ▶ | sub scalar_event { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scalar_event: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 714 | 49123 | my ($self, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 715 | 49123 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 716 | 49123 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 717 | 49123 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | 445 | my $properties = pop @$event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 719 | 445 | $properties = $self->node_properties($properties->[1], $info); | |||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 49122 | $info->{name} = 'scalar_event'; | |||||||||||||||||||||||||||||||||||||||||
| 723 | 49122 | $self->callback->($self, 'scalar_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 724 | 49113 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 725 | 49113 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | 556 | ▶ | sub alias_event { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias_event: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | 556 | my ($self, $info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 730 | 556 | my $event_stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 731 | 556 | ▶ | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$event_stack and $event_stack->[-1][0] eq "properties"
MC/DC50%1/2
@$event_stack and $event_stack->[-1][0] eq "properties"
@$event_stack
$event_stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$event_stackB= $event_stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 732 | 2 | $self->exception("Parse error: Alias not allowed in this context"); | |||||||||||||||||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 554 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 735 | 554 | $info->{name} = 'alias_event'; | |||||||||||||||||||||||||||||||||||||||||
| 736 | 554 | $self->callback->($self, 'alias_event', $info); | |||||||||||||||||||||||||||||||||||||||||
| 737 | 551 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 738 | 551 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 5 | ▶ | sub yaml_to_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
yaml_to_tokens: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 5 | my ($class, $type, $input) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 743 | 5 | ▶ | my $yp = YAML::PP::Parser->new( receiver => sub {} ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 5 | my @docs = eval { | |||||||||||||||||||||||||||||||||||||||||
| 745 | 5 | ▶ | $type eq 'string' ? $yp->parse_string($input) : $yp->parse_file($input); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 746 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 747 | 5 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | 5 | my $tokens = $yp->tokens; | |||||||||||||||||||||||||||||||||||||||||
| 750 | 5 | ▶ | if ($error) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 1 | my $remaining_tokens = $yp->_remaining_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 752 | 1 | push @$tokens, map { +{ %$_, name => 'ERROR' } } @$remaining_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 5 | return $error, $tokens; | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 1 | ▶ | sub _remaining_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_remaining_tokens: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 759 | 1 | my @tokens; | |||||||||||||||||||||||||||||||||||||||||
| 760 | 1 | my $next = $self->lexer->next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | push @tokens, @$next; | |||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | my $next_line = $self->lexer->next_line; | |||||||||||||||||||||||||||||||||||||||||
| 763 | 1 | my $remaining = ''; | |||||||||||||||||||||||||||||||||||||||||
| 764 | 1 | ▶ | if ($next_line) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 765 | 1 | ▶ | if ($self->lexer->offset > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 1 | $remaining = $next_line->[1] . $next_line->[2]; | |||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||
| 768 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | $remaining = join '', @$next_line; | |||||||||||||||||||||||||||||||||||||||||
| 770 | } | ||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||
| 772 | 1 | $remaining .= $self->reader->read; | |||||||||||||||||||||||||||||||||||||||||
| 773 | 1 | ▶ | $remaining = '' unless defined $remaining; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | 1 | push @tokens, { name => "ERROR", value => $remaining }; | |||||||||||||||||||||||||||||||||||||||||
| 775 | 1 | return \@tokens; | |||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | # deprecated | ||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | sub event_to_test_suite { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
event_to_test_suite: not called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 780 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | my ($self, $event) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | ▶ | if (ref $event eq 'ARRAY') { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 783 | 0 | return YAML::PP::Common::event_to_test_suite($event->[1]); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 784 | } | ||||||||||||||||||||||||||||||||||||||||||
| 785 | 0 | return YAML::PP::Common::event_to_test_suite($event); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | sub debug_events { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_events: not called CC=1 SCAR=0.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my ($self) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 791 | $self->note("EVENTS: (" # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | . join (' | ', @{ $_[0]->events }) . ')' # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 793 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | $self->debug_offset; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | sub debug_offset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_offset: not called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my ($self) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 800 | $self->note( | ||||||||||||||||||||||||||||||||||||||||||
| 801 | qq{OFFSET: (} | ||||||||||||||||||||||||||||||||||||||||||
| 802 | # uncoverable statement count:1 | ||||||||||||||||||||||||||||||||||||||||||
| 803 | # uncoverable statement count:2 | ||||||||||||||||||||||||||||||||||||||||||
| 804 | # uncoverable statement count:3 | ||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | . join (' | ', map { defined $_ ? sprintf "%-3d", $_ : '?' } @{ $_[0]->offset }) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 806 | # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | . qq/) level=@{[ $_[0]->level ]}]}/ | |||||||||||||||||||||||||||||||||||||||||
| 808 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | ▶ | sub debug_yaml { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_yaml: not called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 812 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | my ($self) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | my $line = $self->lexer->line; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | $self->note("LINE NUMBER: $line"); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my $next_tokens = $self->lexer->next_tokens; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | if (@$next_tokens) { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | $self->debug_tokens($next_tokens); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 819 | } | ||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||||||||||||
| 822 | 1 | ▶ | sub debug_next_line { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_next_line: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 824 | 1 | ▶ | my $next_line = $self->lexer->next_line || []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->lexer->next_line || []
MC/DC0%0/1
$self->lexer->next_line || []
$self->lexer->next_line
Truth table50%1/2
A
A= $self->lexer->next_line
| |||||||||||||||||||||||||||||||||||||||||||
| 825 | 1 | my $line = $next_line->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 826 | 1 | ▶ | $line = '' unless defined $line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | $line =~ s/( +)$/'·' x length $1/e; | |||||||||||||||||||||||||||||||||||||||||
| 828 | 1 | $line =~ s/\t/â–¸/g; | |||||||||||||||||||||||||||||||||||||||||
| 829 | 1 | $self->note("NEXT LINE: >>$line<<"); | |||||||||||||||||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | 1 | ▶ | sub note { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
note: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 833 | 1 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 834 | 1 | $self->_colorize_warn(["yellow"], "============ $msg"); | |||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 28 | ▶ | sub info { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 838 | 28 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 839 | 28 | $self->_colorize_warn(["cyan"], "============ $msg"); | |||||||||||||||||||||||||||||||||||||||||
| 840 | } | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | 14 | ▶ | sub got { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
got: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | 14 | my ($self, $msg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 844 | 14 | $self->_colorize_warn(["green"], "============ $msg"); | |||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | ▶ | sub _colorize_warn { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_colorize_warn: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 848 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | my ($self, $colors, $text) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | require Term::ANSIColor; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | warn Term::ANSIColor::colored($colors, $text), "\n"; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | 0 | ▶ | sub debug_event { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_event: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 855 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | my ($self, $event) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | my $str = YAML::PP::Common::event_to_test_suite($event); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 858 | 0 | require Term::ANSIColor; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | warn Term::ANSIColor::colored(["magenta"], "============ $str"), "\n"; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | sub debug_rules { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_rules: not called CC=5 SCAR=17.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 863 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | my ($self, $rules) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | local $Data::Dumper::Maxdepth = 2; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | $self->note("RULES:"); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | for my $rule ($rules) { # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | ▶ | if (ref $rule eq 'ARRAY') { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | my $first = $rule->[0]; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | if (ref $first eq 'SCALAR') { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | $self->info("-> $$first"); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 873 | else { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | if (ref $first eq 'ARRAY') { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | $first = $first->[0]; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | $self->info("TYPE $first"); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||
| 880 | else { # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | eval { # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | my @keys = sort keys %$rule; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | $self->info("@keys"); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 884 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | ▶ | sub debug_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_tokens: not called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 890 | # uncoverable subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | my ($self, $tokens) = @_; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | ▶ | $tokens ||= $self->tokens; # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$tokens ||= $self->tokens
MC/DC0%0/2
$tokens ||= $self->tokens
$tokens
$self->tokens
Truth table0%0/3
A ||= B
A= $tokensB= $self->tokens
| |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | require Term::ANSIColor; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | for my $token (@$tokens) { # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 895 | my $type = Term::ANSIColor::colored(["green"], # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 896 | sprintf "%-22s L %2d C %2d ", # uncoverable statement | ||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | $token->{name}, $token->{line}, $token->{column} + 1 # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 898 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | local $Data::Dumper::Useqq = 1; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | local $Data::Dumper::Terse = 1; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | require Data::Dumper; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | my $str = Data::Dumper->Dump([$token->{value}], ['str']); # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | chomp $str; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | $str =~ s/(^.|.$)/Term::ANSIColor::colored(['blue'], $1)/ge; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | warn "$type$str\n"; # uncoverable statement | |||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | sub highlight_yaml { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
highlight_yaml: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | require YAML::PP::Highlight; | |||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my $tokens = $self->tokens; | |||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | my $highlighted = YAML::PP::Highlight->ansicolored($tokens); | |||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | warn $highlighted; | |||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | 63 | ▶ | sub exception { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exception: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 919 | 63 | my ($self, $msg, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 920 | 63 | my $next = $self->lexer->next_tokens; | |||||||||||||||||||||||||||||||||||||||||
| 921 | 63 | ▶ | my $line = @$next ? $next->[0]->{line} : $self->lexer->line; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 922 | 63 | ▶ | my $offset = @$next ? $next->[0]->{column} : $self->lexer->offset; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 923 | 63 | $offset++; | |||||||||||||||||||||||||||||||||||||||||
| 924 | 63 | my $next_line = $self->lexer->next_line; | |||||||||||||||||||||||||||||||||||||||||
| 925 | 63 | my $remaining = ''; | |||||||||||||||||||||||||||||||||||||||||
| 926 | 63 | ▶ | if ($next_line) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 38 | ▶ | if ($self->lexer->offset > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 928 | 36 | $remaining = $next_line->[1] . $next_line->[2]; | |||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||
| 930 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 931 | 2 | $remaining = join '', @$next_line; | |||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||
| 934 | 63 | ▶ | my $caller = $args{caller} || [ caller(0) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'caller'} || [caller 0]
MC/DC100%1/1
$args{'caller'} || [caller 0]
$args{'caller'}
Truth table100%2/2
A
A= $args{'caller'}
| |||||||||||||||||||||||||||||||||||||||||||
| 935 | my $e = YAML::PP::Exception->new( | ||||||||||||||||||||||||||||||||||||||||||
| 936 | got => $args{got}, | ||||||||||||||||||||||||||||||||||||||||||
| 937 | expected => $args{expected}, | ||||||||||||||||||||||||||||||||||||||||||
| 938 | 63 | line => $line, | |||||||||||||||||||||||||||||||||||||||||
| 939 | column => $offset, | ||||||||||||||||||||||||||||||||||||||||||
| 940 | msg => $msg, | ||||||||||||||||||||||||||||||||||||||||||
| 941 | next => $next, | ||||||||||||||||||||||||||||||||||||||||||
| 942 | where => $caller->[1] . ' line ' . $caller->[2], | ||||||||||||||||||||||||||||||||||||||||||
| 943 | yaml => $remaining, | ||||||||||||||||||||||||||||||||||||||||||
| 944 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 945 | 63 | croak $e; | |||||||||||||||||||||||||||||||||||||||||
| 946 | } | ||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||
| 948 | 48 | ▶ | sub expected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expected: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 949 | 48 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 950 | 48 | my $expected = $args{expected}; | |||||||||||||||||||||||||||||||||||||||||
| 951 | 48 | @$expected = sort grep { m/^[A-Z_]+$/ } @$expected; | |||||||||||||||||||||||||||||||||||||||||
| 952 | 48 | my $got = $args{got}->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 953 | 48 | my @caller = caller(0); | |||||||||||||||||||||||||||||||||||||||||
| 954 | $self->exception("Expected (@$expected), but got $got", | ||||||||||||||||||||||||||||||||||||||||||
| 955 | caller => \@caller, | ||||||||||||||||||||||||||||||||||||||||||
| 956 | expected => $expected, | ||||||||||||||||||||||||||||||||||||||||||
| 957 | got => $args{got}, | ||||||||||||||||||||||||||||||||||||||||||
| 958 | 48 | ); | |||||||||||||||||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||
| 961 | 2739 | ▶ | sub cb_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_tag: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 962 | 2739 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 963 | 2739 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 964 | 2739 | ▶ | if (! @$stack or $stack->[-1]->[0] ne 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @$stack or $stack->[-1][0] ne "properties"
MC/DC50%1/2
not @$stack or $stack->[-1][0] ne "properties"
not @$stack
$stack->[-1][0] ne "properties"
Truth table66%2/3
not(A) or B
A= not @$stackB= $stack->[-1][0] ne "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 965 | 2239 | push @$stack, [ properties => {} ]; | |||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||
| 967 | 2739 | my $last = $stack->[-1]->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 968 | 2739 | my $tag = $self->_read_tag($token->{value}, $self->tagmap); | |||||||||||||||||||||||||||||||||||||||||
| 969 | 2737 | ▶ | $last->{inline} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$last->{"inline"} ||= []
MC/DC100%1/1
$last->{"inline"} ||= []
$last->{"inline"}
Truth table100%2/2
A
A= $last->{"inline"}
| |||||||||||||||||||||||||||||||||||||||||||
| 970 | 2737 | push @{ $last->{inline} }, { | |||||||||||||||||||||||||||||||||||||||||
| 971 | type => 'tag', | ||||||||||||||||||||||||||||||||||||||||||
| 972 | value => $tag, | ||||||||||||||||||||||||||||||||||||||||||
| 973 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 974 | 2737 | }; | |||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | 2739 | ▶ | sub _read_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_tag: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 978 | 2739 | my ($self, $tag, $map) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 979 | 2739 | ▶ | if ($tag eq '!') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 980 | 75 | return "!"; | |||||||||||||||||||||||||||||||||||||||||
| 981 | } | ||||||||||||||||||||||||||||||||||||||||||
| 982 | elsif ($tag =~ m/^!<(.*)>/) { | ||||||||||||||||||||||||||||||||||||||||||
| 983 | 133 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||
| 985 | elsif ($tag =~ m/^(![^!]*!|!)(.+)/) { | ||||||||||||||||||||||||||||||||||||||||||
| 986 | 2531 | my $alias = $1; | |||||||||||||||||||||||||||||||||||||||||
| 987 | 2531 | my $name = $2; | |||||||||||||||||||||||||||||||||||||||||
| 988 | 2531 | $name =~ s/%([0-9a-fA-F]{2})/chr hex $1/eg; | |||||||||||||||||||||||||||||||||||||||||
| 989 | 2531 | ▶ | if (exists $map->{ $alias }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 990 | 2299 | $tag = $map->{ $alias }. $name; | |||||||||||||||||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||||||||||||||||
| 992 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 993 | 232 | ▶ | if ($alias ne '!' and $alias ne '!!') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$alias ne "!" and $alias ne "!!"
MC/DC50%1/2
$alias ne "!" and $alias ne "!!"
$alias ne "!"
$alias ne "!!"
Truth table66%2/3
A and B
A= $alias ne "!"B= $alias ne "!!"
| |||||||||||||||||||||||||||||||||||||||||||
| 994 | 2 | die "Found undefined tag handle '$alias'"; | |||||||||||||||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||||||||||||||||
| 996 | 230 | $tag = "!$name"; | |||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||
| 999 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | die "Invalid tag"; | |||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | 2529 | return $tag; | |||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 2093 | ▶ | sub cb_anchor { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_anchor: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 2093 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1007 | 2093 | my $anchor = $token->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 1008 | 2093 | $anchor = substr($anchor, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1009 | 2093 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1010 | 2093 | ▶ | if (! @$stack or $stack->[-1]->[0] ne 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @$stack or $stack->[-1][0] ne "properties"
MC/DC50%1/2
not @$stack or $stack->[-1][0] ne "properties"
not @$stack
$stack->[-1][0] ne "properties"
Truth table66%2/3
not(A) or B
A= not @$stackB= $stack->[-1][0] ne "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1011 | 1844 | push @$stack, [ properties => {} ]; | |||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | 2093 | my $last = $stack->[-1]->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1014 | 2093 | ▶ | $last->{inline} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$last->{"inline"} ||= []
MC/DC100%1/1
$last->{"inline"} ||= []
$last->{"inline"}
Truth table100%2/2
A
A= $last->{"inline"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1015 | 2093 | push @{ $last->{inline} }, { | |||||||||||||||||||||||||||||||||||||||||
| 1016 | type => 'anchor', | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | value => $anchor, | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | 2093 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | 1191 | ▶ | sub cb_property_eol { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_property_eol: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1023 | 1191 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1024 | 1191 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1025 | 1191 | my $last = $stack->[-1]->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1026 | 1191 | ▶ | my $inline = delete $last->{inline} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1027 | 1191 | ▶ | my $newline = $last->{newline} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$last->{"newline"} ||= []
MC/DC100%1/1
$last->{"newline"} ||= []
$last->{"newline"}
Truth table100%2/2
A
A= $last->{"newline"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 1191 | push @$newline, @$inline; | |||||||||||||||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | 13172 | ▶ | sub cb_mapkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_mapkey: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 13172 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1033 | 13172 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1034 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1035 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | 13172 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1039 | 13172 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1040 | 72 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | 13172 | push @{ $stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | 13580 | ▶ | sub cb_send_mapkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_mapkey: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1046 | 13580 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1047 | 13580 | my $last = pop @{ $self->event_stack }; | |||||||||||||||||||||||||||||||||||||||||
| 1048 | 13580 | $self->scalar_event($last->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 1049 | 13580 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | 27330 | ▶ | sub cb_send_scalar { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_scalar: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1053 | 27330 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1054 | 27330 | my $last = pop @{ $self->event_stack }; | |||||||||||||||||||||||||||||||||||||||||
| 1055 | 27330 | ▶ | return unless $last; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1056 | 26591 | $self->scalar_event($last->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 1057 | 26581 | my $e = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 26581 | ▶ | if ($e->[-1] eq 'IMAP') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 9 | $self->end_flow_mapping; | |||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||
| 1063 | 113 | ▶ | sub cb_empty_mapkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_mapkey: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1064 | 113 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1065 | 113 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1066 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | value => '', | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | 113 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1071 | 113 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1072 | 9 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | 113 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1075 | 113 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||
| 1078 | 19 | ▶ | sub cb_send_flow_alias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_flow_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1079 | 19 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1080 | 19 | my $alias = substr($token->{value}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1081 | 19 | $self->alias_event({ value => $alias }); | |||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||
| 1084 | 295 | ▶ | sub cb_send_alias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1085 | 295 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1086 | 295 | my $alias = substr($token->{value}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1087 | 295 | $self->alias_event({ value => $alias }); | |||||||||||||||||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||||||||||||||
| 1090 | 62 | ▶ | sub cb_send_alias_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_alias_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1091 | 62 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1092 | 62 | my $alias = substr($token->{value}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1093 | 62 | $self->alias_event({ value => $alias }); | |||||||||||||||||||||||||||||||||||||||||
| 1094 | 61 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | 143 | ▶ | sub cb_send_alias_from_stack { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_alias_from_stack: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1098 | 143 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1099 | 143 | my $last = pop @{ $self->event_stack }; | |||||||||||||||||||||||||||||||||||||||||
| 1100 | 143 | $self->alias_event($last->[1]); | |||||||||||||||||||||||||||||||||||||||||
| 1101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | 180 | ▶ | sub cb_alias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1104 | 180 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1105 | 180 | my $alias = substr($token->{value}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1106 | 180 | push @{ $self->event_stack }, [ alias => { | |||||||||||||||||||||||||||||||||||||||||
| 1107 | value => $alias, | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | 180 | }]; | |||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||
| 1112 | 173 | ▶ | sub cb_question { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_question: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1113 | 173 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1114 | 173 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | 95 | ▶ | sub cb_flow_question { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_flow_question: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1118 | 95 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1119 | 95 | $self->set_new_node(2); | |||||||||||||||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | 54 | ▶ | sub cb_empty_complexvalue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_complexvalue: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1123 | 54 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1124 | 54 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | |||||||||||||||||||||||||||||||||||||||||
| 1125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | 339 | ▶ | sub cb_questionstart { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_questionstart: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1128 | 339 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1129 | 339 | $self->start_mapping($token->{column}); | |||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||||||||||||||||
| 1132 | 405 | ▶ | sub cb_complexcolon { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_complexcolon: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1133 | 405 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1134 | 405 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||
| 1137 | 3258 | ▶ | sub cb_seqstart { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_seqstart: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1138 | 3258 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1139 | 3258 | my $column = $token->{column}; | |||||||||||||||||||||||||||||||||||||||||
| 1140 | 3258 | $self->start_sequence($column); | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 3258 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||
| 1144 | 4287 | ▶ | sub cb_seqitem { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_seqitem: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1145 | 4287 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1146 | 4287 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 4055 | ▶ | sub cb_take_quoted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_take_quoted: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 4055 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1151 | 4055 | my $subtokens = $token->{subtokens}; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | 4055 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1153 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | style => $subtokens->[0]->{value} eq '"' | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | ? YAML_DOUBLE_QUOTED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | : YAML_SINGLE_QUOTED_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | 4055 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1160 | 4055 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1161 | 236 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | 4055 | push @{ $stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | 489 | ▶ | sub cb_quoted_multiline { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_quoted_multiline: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1167 | 489 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1168 | 489 | my $subtokens = $token->{subtokens}; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | 489 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1170 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | style => $subtokens->[0]->{value} eq '"' | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | ? YAML_DOUBLE_QUOTED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | : YAML_SINGLE_QUOTED_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1176 | 489 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1177 | 489 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 16 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | 489 | push @{ $stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1181 | 489 | $self->cb_send_scalar; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | 412 | ▶ | sub cb_take_quoted_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_take_quoted_key: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1185 | 412 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1186 | 412 | $self->cb_take_quoted($token); | |||||||||||||||||||||||||||||||||||||||||
| 1187 | 412 | $self->cb_send_mapkey; | |||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||
| 1190 | 241 | ▶ | sub cb_send_plain_multi { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_plain_multi: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1191 | 241 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1192 | 241 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1193 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | 241 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1198 | 241 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 9 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | 241 | push @{ $stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1202 | 241 | $self->cb_send_scalar; | |||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||
| 1205 | 25412 | ▶ | sub cb_start_plain { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_start_plain: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1206 | 25412 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1207 | 25412 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1208 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | 25412 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1213 | 25412 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1214 | 2216 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | 25412 | push @{ $stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | 1440 | ▶ | sub cb_start_flowseq { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_start_flowseq: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1220 | 1440 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1221 | 1440 | $self->start_flow_sequence($token->{column}); | |||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | 1210 | ▶ | sub cb_start_flowmap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_start_flowmap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1225 | 1210 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1226 | 1210 | $self->start_flow_mapping($token->{column}); | |||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | 1416 | ▶ | sub cb_end_flowseq { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_flowseq: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1230 | 1416 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1231 | 1416 | $self->cb_send_scalar; | |||||||||||||||||||||||||||||||||||||||||
| 1232 | 1416 | $self->end_flow_sequence; | |||||||||||||||||||||||||||||||||||||||||
| 1233 | 1416 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 1234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | 2445 | ▶ | sub cb_flow_comma { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_flow_comma: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1237 | 2445 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1238 | 2445 | my $event_types = $self->events; | |||||||||||||||||||||||||||||||||||||||||
| 1239 | 2445 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 1240 | 2445 | ▶ | if ($event_types->[-1] =~ m/^FLOWSEQ/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1241 | 1752 | $self->cb_send_scalar; | |||||||||||||||||||||||||||||||||||||||||
| 1242 | 1752 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | |||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||
| 1246 | 1218 | ▶ | sub cb_flow_colon { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_flow_colon: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1247 | 1218 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 1218 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | 412 | ▶ | sub cb_empty_flow_mapkey { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_flow_mapkey: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1252 | 412 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1253 | 412 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1254 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | value => '', | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | 412 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1259 | 412 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1260 | 247 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | 412 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | 1087 | ▶ | sub cb_end_flowmap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_flowmap: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1266 | 1087 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1267 | 1087 | $self->end_flow_mapping; | |||||||||||||||||||||||||||||||||||||||||
| 1268 | 1079 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 109 | ▶ | sub cb_end_flowmap_empty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_flowmap_empty: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 109 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1273 | 109 | $self->cb_empty_flowmap_value; | |||||||||||||||||||||||||||||||||||||||||
| 1274 | 109 | $self->end_flow_mapping; | |||||||||||||||||||||||||||||||||||||||||
| 1275 | 109 | $self->set_new_node(0); | |||||||||||||||||||||||||||||||||||||||||
| 1276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 1025 | ▶ | sub cb_flowkey_plain { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_flowkey_plain: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | 1025 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1280 | 1025 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1281 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | 1025 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1286 | 1025 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1287 | 21 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | 1025 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | 162 | ▶ | sub cb_flowkey_quoted { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_flowkey_quoted: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1293 | 162 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1294 | 162 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1295 | 162 | my $subtokens = $token->{subtokens}; | |||||||||||||||||||||||||||||||||||||||||
| 1296 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | style => $subtokens->[0]->{value} eq '"' | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | ? YAML_DOUBLE_QUOTED_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | : YAML_SINGLE_QUOTED_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | 162 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1303 | 162 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 2 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | 162 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | 136 | ▶ | sub cb_empty_flowmap_key_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_flowmap_key_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1310 | 136 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1311 | 136 | $self->cb_empty_flow_mapkey($token); | |||||||||||||||||||||||||||||||||||||||||
| 1312 | 136 | $self->cb_empty_flowmap_value; | |||||||||||||||||||||||||||||||||||||||||
| 1313 | 136 | $self->cb_flow_comma; | |||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 125 | ▶ | sub cb_end_empty_flowmap_key_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_empty_flowmap_key_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1317 | 125 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1318 | 125 | $self->cb_empty_flow_mapkey($token); | |||||||||||||||||||||||||||||||||||||||||
| 1319 | 125 | $self->cb_empty_flowmap_value; | |||||||||||||||||||||||||||||||||||||||||
| 1320 | 125 | $self->cb_flow_comma; | |||||||||||||||||||||||||||||||||||||||||
| 1321 | 125 | $self->cb_end_flowmap; | |||||||||||||||||||||||||||||||||||||||||
| 1322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 577 | ▶ | sub cb_empty_flowmap_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_flowmap_value: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1325 | 577 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1326 | 577 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1327 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1329 | value => '', | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | 577 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1332 | 577 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 167 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1335 | 577 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||
| 1338 | 90 | ▶ | sub cb_empty_flowseq_comma { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_flowseq_comma: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1339 | 90 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1340 | 90 | $self->cb_empty_flowmap_value($token); | |||||||||||||||||||||||||||||||||||||||||
| 1341 | 90 | $self->cb_flow_comma; | |||||||||||||||||||||||||||||||||||||||||
| 1342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | 72 | ▶ | sub cb_empty_flowseq_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_empty_flowseq_end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1345 | 72 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1346 | 72 | $self->cb_empty_flowmap_value($token); | |||||||||||||||||||||||||||||||||||||||||
| 1347 | 72 | $self->cb_end_flowseq; | |||||||||||||||||||||||||||||||||||||||||
| 1348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1349 | |||||||||||||||||||||||||||||||||||||||||||
| 1350 | 37 | ▶ | sub cb_insert_map_alias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_insert_map_alias: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1351 | 37 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1352 | 37 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1353 | 37 | my $scalar = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 1354 | 37 | my $info = $scalar->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1355 | 37 | $self->start_mapping($info->{offset}); | |||||||||||||||||||||||||||||||||||||||||
| 1356 | 37 | $self->alias_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 37 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||
| 1360 | 4894 | ▶ | sub cb_insert_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_insert_map: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1361 | 4894 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1362 | 4894 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1363 | 4894 | my $scalar = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 1364 | 4894 | my $info = $scalar->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1365 | 4894 | $self->start_mapping($info->{offset}); | |||||||||||||||||||||||||||||||||||||||||
| 1366 | 4894 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1367 | 4894 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | |||||||||||||||||||||||||||||||||||||||||||
| 1370 | 7 | ▶ | sub cb_insert_implicit_flowseq_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_insert_implicit_flowseq_map: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1371 | 7 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1372 | 7 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1373 | 7 | my $scalar = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 1374 | 7 | my $info = $scalar->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1375 | 7 | $self->start_flow_mapping($info->{offset}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1376 | 7 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1377 | 7 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | 2 | ▶ | sub cb_insert_empty_implicit_flowseq_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_insert_empty_implicit_flowseq_map: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1381 | 2 | my ($self, $res) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1382 | 2 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1383 | 2 | my $scalar = pop @$stack; | |||||||||||||||||||||||||||||||||||||||||
| 1384 | 2 | my $info = $scalar->[1]; | |||||||||||||||||||||||||||||||||||||||||
| 1385 | 2 | $self->start_flow_mapping($info->{offset}, 1); | |||||||||||||||||||||||||||||||||||||||||
| 1386 | 2 | $self->cb_empty_flowmap_value; | |||||||||||||||||||||||||||||||||||||||||
| 1387 | 2 | $self->set_new_node(2); | |||||||||||||||||||||||||||||||||||||||||
| 1388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||||||||||
| 1390 | 430 | ▶ | sub cb_insert_empty_map { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_insert_empty_map: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1391 | 430 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1392 | 430 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1393 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | style => YAML_PLAIN_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | value => '', | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | 430 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1398 | 430 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 248 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | 430 | $self->start_mapping($info->{offset}); | |||||||||||||||||||||||||||||||||||||||||
| 1402 | 430 | $self->scalar_event($info); | |||||||||||||||||||||||||||||||||||||||||
| 1403 | 430 | $self->set_new_node(1); | |||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||
| 1406 | 1712 | ▶ | sub cb_send_block_scalar { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_send_block_scalar: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1407 | 1712 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1408 | 1712 | my $type = $token->{subtokens}->[0]->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 1409 | 1712 | my $stack = $self->event_stack; | |||||||||||||||||||||||||||||||||||||||||
| 1410 | my $info = { | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | style => $type eq '|' | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | ? YAML_LITERAL_SCALAR_STYLE | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | : YAML_FOLDED_SCALAR_STYLE, | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | value => $token->{value}, | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | offset => $token->{column}, | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | 1712 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1417 | 1712 | ▶ | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$stack and $stack->[-1][0] eq "properties"
MC/DC50%1/2
@$stack and $stack->[-1][0] eq "properties"
@$stack
$stack->[-1][0] eq "properties"
Truth table66%2/3
A and B
A= @$stackB= $stack->[-1][0] eq "properties"
| |||||||||||||||||||||||||||||||||||||||||||
| 1418 | 82 | $self->fetch_inline_properties($stack, $info); | |||||||||||||||||||||||||||||||||||||||||
| 1419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1420 | 1712 | push @{ $self->event_stack }, [ scalar => $info ]; | |||||||||||||||||||||||||||||||||||||||||
| 1421 | 1712 | $self->cb_send_scalar; | |||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | 585 | ▶ | sub cb_end_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1425 | 585 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1426 | 585 | $self->end_document(0); | |||||||||||||||||||||||||||||||||||||||||
| 1427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||
| 1429 | 30 | ▶ | sub cb_end_document_empty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_document_empty: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1430 | 30 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1431 | 30 | $self->end_document(0); | |||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | 3975 | ▶ | sub cb_doc_start_implicit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_doc_start_implicit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1435 | 3975 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1436 | 3975 | $self->start_document(1); | |||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | 3817 | ▶ | sub cb_doc_start_explicit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_doc_start_explicit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1440 | 3817 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1441 | 3817 | $self->start_document(0); | |||||||||||||||||||||||||||||||||||||||||
| 1442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | |||||||||||||||||||||||||||||||||||||||||||
| 1444 | 527 | ▶ | sub cb_end_doc_start_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_end_doc_start_document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1445 | 527 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1446 | 527 | $self->end_document(1); | |||||||||||||||||||||||||||||||||||||||||
| 1447 | 524 | $self->start_document(0); | |||||||||||||||||||||||||||||||||||||||||
| 1448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | 117 | ▶ | sub cb_tag_directive { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_tag_directive: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1451 | 117 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1452 | 117 | my ($name, $tag_alias, $tag_url) = split ' ', $token->{value}; | |||||||||||||||||||||||||||||||||||||||||
| 1453 | 117 | $self->tagmap->{ $tag_alias } = $tag_url; | |||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | 45 | ▶ | sub cb_reserved_directive { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_reserved_directive: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 159 | ▶ | sub cb_set_yaml_version_directive { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cb_set_yaml_version_directive: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1460 | 159 | my ($self, $token) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1461 | 159 | ▶ | if ($self->yaml_version_directive) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1462 | 1 | croak "Found duplicate YAML directive"; | |||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | 158 | my ($version) = $token->{value} =~ m/^%YAML[ \t]+(1\.[12])/; | |||||||||||||||||||||||||||||||||||||||||
| 1465 | 158 | ▶ | $self->set_yaml_version($version || '1.2'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$version || '1.2'
MC/DC100%1/1
$version || '1.2'
$version
Truth table100%2/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 1466 | 158 | $self->set_yaml_version_directive(1); | |||||||||||||||||||||||||||||||||||||||||
| 1467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||
| 1469 | 51 | 1; | |||||||||||||||||||||||||||||||||||||||||