| 1 | package TOML::Parser; | ||||||||||||||||||||||||||||||||||||||
| 2 | 20 | ▶ | use 5.010000; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||
| 7 | 20 | our $VERSION = "0.90_01"; | |||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | 20 | ▶ | use TOML::Parser::Tokenizer qw/:constant/; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | 20 | ▶ | use TOML::Parser::Tokenizer::Strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 11 | 20 | ▶ | use TOML::Parser::Util qw/unescape_str/; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | 20 | ▶ | use Types::Serialiser; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||
| 14 | sub new { | ||||||||||||||||||||||||||||||||||||||
| 15 | 56 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 16 | 56 | ▶ | my $args = (@_ == 1 and ref $_[0] eq 'HASH') ? +shift : +{ @_ }; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1
ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||
| 17 | return bless +{ | ||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | inflate_datetime => sub { $_[0] }, | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | 4 | ▶ | inflate_boolean => sub { $_[0] eq 'true' ? Types::Serialiser::true : Types::Serialiser::false }, | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 20 | 56 | strict_mode => 0, | |||||||||||||||||||||||||||||||||||||
| 21 | %$args, | ||||||||||||||||||||||||||||||||||||||
| 22 | } => $class; | ||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||
| 25 | sub parse_file { | ||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | open my $fh, '<:encoding(utf-8)', $file or die $!; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return $self->parse_fh($fh); | |||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||
| 31 | sub parse_fh { | ||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my ($self, $fh) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_fh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $src = do { local $/; <$fh> }; | |||||||||||||||||||||||||||||||||||||
| 34 | 0 | return $self->parse($src); | |||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||
| 37 | sub _tokenizer_class { | ||||||||||||||||||||||||||||||||||||||
| 38 | 56 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokenizer_class: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 39 | 56 | ▶ | return $self->{strict_mode} ? 'TOML::Parser::Tokenizer::Strict' : 'TOML::Parser::Tokenizer'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||
| 42 | 20 | our @TOKENS; | |||||||||||||||||||||||||||||||||||||
| 43 | 20 | our $ROOT; | |||||||||||||||||||||||||||||||||||||
| 44 | 20 | our $CONTEXT; | |||||||||||||||||||||||||||||||||||||
| 45 | sub parse { | ||||||||||||||||||||||||||||||||||||||
| 46 | 56 | ▶ | my ($self, $src) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||
| 48 | 56 | local $ROOT = {}; | |||||||||||||||||||||||||||||||||||||
| 49 | 56 | local $CONTEXT = $ROOT; | |||||||||||||||||||||||||||||||||||||
| 50 | 56 | local @TOKENS = $self->_tokenizer_class->tokenize($src); | |||||||||||||||||||||||||||||||||||||
| 51 | 36 | ▶ | while (my $token = shift @TOKENS) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 52 | 332 | $self->_parse_token($token); | |||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||
| 54 | 33 | return $ROOT; | |||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||
| 57 | sub _parse_token { | ||||||||||||||||||||||||||||||||||||||
| 58 | 332 | ▶ | my ($self, $token) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_token: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||
| 60 | 332 | my ($type, $val) = @$token; | |||||||||||||||||||||||||||||||||||||
| 61 | 332 | ▶ | if ($type eq TOKEN_TABLE) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||
| 62 | 40 | $self->_parse_table($val); | |||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||
| 64 | elsif ($type eq TOKEN_ARRAY_OF_TABLE) { | ||||||||||||||||||||||||||||||||||||||
| 65 | 17 | $self->_parse_array_of_table($val); | |||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||
| 67 | elsif (my ($key, $value) = $self->_parse_key_and_value($token)) { | ||||||||||||||||||||||||||||||||||||||
| 68 | 213 | ▶ | die "Duplicate key. key:$key" if exists $CONTEXT->{$key}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 69 | 210 | $CONTEXT->{$key} = $value; | |||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||
| 71 | elsif ($type eq TOKEN_COMMENT) { | ||||||||||||||||||||||||||||||||||||||
| 72 | # pass through | ||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||
| 74 | else { | ||||||||||||||||||||||||||||||||||||||
| 75 | 0 | die "Unknown case. type:$type"; | |||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||
| 79 | sub _parse_key_and_value { | ||||||||||||||||||||||||||||||||||||||
| 80 | 319 | ▶ | my ($self, $token) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_key_and_value: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||
| 82 | 319 | my ($type, $val) = @$token; | |||||||||||||||||||||||||||||||||||||
| 83 | 319 | ▶ | if ($type eq TOKEN_KEY) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 84 | 257 | my $token = shift @TOKENS; | |||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | 257 | my $key = $val; | |||||||||||||||||||||||||||||||||||||
| 87 | 257 | my $value = $self->_parse_value_token($token); | |||||||||||||||||||||||||||||||||||||
| 88 | 257 | return ($key, $value); | |||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||
| 91 | 62 | return; | |||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||
| 94 | sub _parse_table { | ||||||||||||||||||||||||||||||||||||||
| 95 | 40 | ▶ | my ($self, $keys) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_table: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||
| 96 | 40 | my @keys = @$keys; | |||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||
| 98 | 40 | $CONTEXT = $ROOT; | |||||||||||||||||||||||||||||||||||||
| 99 | 40 | for my $k (@keys) { | |||||||||||||||||||||||||||||||||||||
| 100 | 67 | ▶ | if (exists $CONTEXT->{$k}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 101 | $CONTEXT = ref $CONTEXT->{$k} eq 'ARRAY' ? $CONTEXT->{$k}->[-1] : | ||||||||||||||||||||||||||||||||||||||
| 102 | 9 | ▶ | ref $CONTEXT->{$k} eq 'HASH' ? $CONTEXT->{$k} : | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 103 | 0 | die "invalid structure. @{[ join '.', @keys ]} cannot be `Table`"; | |||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||
| 105 | else { | ||||||||||||||||||||||||||||||||||||||
| 106 | 58 | ▶ | $CONTEXT = $CONTEXT->{$k} ||= +{}; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$TOML::Parser::CONTEXT->{$k} ||= {}
MC/DC0%0/1
$TOML::Parser::CONTEXT->{$k} ||= {}
$TOML::Parser::CONTEXT->{$k}
Truth table50%1/2
A
A= $TOML::Parser::CONTEXT->{$k}
| |||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||
| 111 | sub _parse_array_of_table { | ||||||||||||||||||||||||||||||||||||||
| 112 | 17 | ▶ | my ($self, $keys) = @_; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_array_of_table: called CC=8 SCAR=24.5
| |||||||||||||||||||||||||||||||||||||||
| 113 | 17 | my @keys = @$keys; | |||||||||||||||||||||||||||||||||||||
| 114 | 17 | my $last_key = pop @keys; | |||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||
| 116 | 17 | $CONTEXT = $ROOT; | |||||||||||||||||||||||||||||||||||||
| 117 | 17 | for my $k (@keys) { | |||||||||||||||||||||||||||||||||||||
| 118 | 6 | ▶ | if (exists $CONTEXT->{$k}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 119 | $CONTEXT = ref $CONTEXT->{$k} eq 'ARRAY' ? $CONTEXT->{$k}->[-1] : | ||||||||||||||||||||||||||||||||||||||
| 120 | 6 | ▶ | ref $CONTEXT->{$k} eq 'HASH' ? $CONTEXT->{$k} : | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 121 | 0 | die "invalid structure. @{[ join '.', @keys ]} cannot be `Array of table`."; | |||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||
| 123 | else { | ||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | $CONTEXT = $CONTEXT->{$k} ||= +{}; | ||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$TOML::Parser::CONTEXT->{$k} ||= {}
MC/DC0%0/1
$TOML::Parser::CONTEXT->{$k} ||= {}
$TOML::Parser::CONTEXT->{$k}
Truth table0%0/2
A
A= $TOML::Parser::CONTEXT->{$k}
| |||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||
| 128 | 17 | ▶ | $CONTEXT->{$last_key} = [] unless exists $CONTEXT->{$last_key}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 129 | 17 | ▶ | die "invalid structure. @{[ join '.', @keys ]} cannot be `Array of table`" unless ref $CONTEXT->{$last_key} eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 130 | 17 | push @{ $CONTEXT->{$last_key} } => $CONTEXT = {}; | |||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||
| 133 | sub _parse_value_token { | ||||||||||||||||||||||||||||||||||||||
| 134 | 326 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_value_token: called CC=23 SCAR=32.0
| |||||||||||||||||||||||||||||||||||||||
| 135 | 326 | my $token = shift; | |||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||
| 137 | 326 | my ($type, $val, @args) = @$token; | |||||||||||||||||||||||||||||||||||||
| 138 | 326 | ▶ | if ($type eq TOKEN_COMMENT) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return; # pass through | |||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||
| 141 | ▶ | elsif ($type eq TOKEN_INTEGER || $type eq TOKEN_FLOAT) { | |||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$type eq "INTEGER" or $type eq "FLOAT"
MC/DC100%2/2
$type eq "INTEGER" or $type eq "FLOAT"
$type eq "INTEGER"
$type eq "FLOAT"
Truth table100%3/3
A or B
A= $type eq "INTEGER"B= $type eq "FLOAT"
| |||||||||||||||||||||||||||||||||||||||
| 142 | 98 | $val =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||
| 143 | 98 | return 0+$val; | |||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||
| 145 | elsif ($type eq TOKEN_BOOLEAN) { | ||||||||||||||||||||||||||||||||||||||
| 146 | 4 | return $self->inflate_boolean($val); | |||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||
| 148 | elsif ($type eq TOKEN_DATETIME) { | ||||||||||||||||||||||||||||||||||||||
| 149 | 2 | return $self->inflate_datetime($val); | |||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||
| 151 | elsif ($type eq TOKEN_STRING) { | ||||||||||||||||||||||||||||||||||||||
| 152 | 157 | my ($is_raw) = @args; | |||||||||||||||||||||||||||||||||||||
| 153 | 157 | ▶ | return $is_raw ? $val : unescape_str($val); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||
| 155 | elsif ($type eq TOKEN_MULTI_LINE_STRING_BEGIN) { | ||||||||||||||||||||||||||||||||||||||
| 156 | 20 | my ($is_raw) = @args; | |||||||||||||||||||||||||||||||||||||
| 157 | 20 | my $value = $self->_parse_value_token(shift @TOKENS); | |||||||||||||||||||||||||||||||||||||
| 158 | 20 | $value =~ s/\A(?:\r\n|[\r\n])//msg; | |||||||||||||||||||||||||||||||||||||
| 159 | 20 | $value =~ s/\\\s+//msg; | |||||||||||||||||||||||||||||||||||||
| 160 | 20 | ▶ | if (my $token = shift @TOKENS) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 161 | 20 | my ($type) = @$token; | |||||||||||||||||||||||||||||||||||||
| 162 | 20 | ▶ | return $value if $type eq TOKEN_MULTI_LINE_STRING_END; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 163 | 0 | die "Unexpected token: $type"; | |||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||
| 166 | elsif ($type eq TOKEN_INLINE_TABLE_BEGIN) { | ||||||||||||||||||||||||||||||||||||||
| 167 | 16 | my %data; | |||||||||||||||||||||||||||||||||||||
| 168 | 16 | ▶ | while (my $token = shift @TOKENS) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 169 | 62 | ▶ | last if $token->[0] eq TOKEN_INLINE_TABLE_END; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 170 | 46 | ▶ | next if $token->[0] eq TOKEN_COMMENT; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 171 | 44 | my ($key, $value) = $self->_parse_key_and_value($token); | |||||||||||||||||||||||||||||||||||||
| 172 | 44 | ▶ | die "Duplicate key. key:$key" if exists $data{$key}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 173 | 44 | $data{$key} = $value; | |||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||
| 175 | 16 | return \%data; | |||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||
| 177 | elsif ($type eq TOKEN_ARRAY_BEGIN) { | ||||||||||||||||||||||||||||||||||||||
| 178 | 29 | my @data; | |||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||
| 180 | my $last_token; | ||||||||||||||||||||||||||||||||||||||
| 181 | 29 | ▶ | while (my $token = shift @TOKENS) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 182 | 85 | ▶ | last if $token->[0] eq TOKEN_ARRAY_END; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 183 | 56 | ▶ | next if $token->[0] eq TOKEN_COMMENT; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 184 | 49 | ▶ | if ($self->{strict_mode}) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 185 | 22 | ▶ | die "Unexpected token: $token->[0]" if defined $last_token && $token->[0] ne $last_token->[0]; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $last_token and $token->[0] ne $last_token->[0]
MC/DC0%0/2
defined $last_token and $token->[0] ne $last_token->[0]
defined $last_token
$token->[0] ne $last_token->[0]
Truth table66%2/3
A and B
A= defined $last_tokenB= $token->[0] ne $last_token->[0]
| |||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||
| 187 | 49 | push @data => $self->_parse_value_token($token); | |||||||||||||||||||||||||||||||||||||
| 188 | 49 | $last_token = $token; | |||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||
| 190 | 29 | return \@data; | |||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||
| 193 | 0 | die "Unexpected token: $type"; | |||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||
| 196 | sub inflate_datetime { | ||||||||||||||||||||||||||||||||||||||
| 197 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate_datetime: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 198 | 2 | return $self->{inflate_datetime}->(@_); | |||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||
| 201 | sub inflate_boolean { | ||||||||||||||||||||||||||||||||||||||
| 202 | 4 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
inflate_boolean: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 203 | 4 | return $self->{inflate_boolean}->(@_); | |||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||
| 206 | 20 | 1; | |||||||||||||||||||||||||||||||||||||
| 207 | __END__ | ||||||||||||||||||||||||||||||||||||||