| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
52
|
|
|
52
|
|
141964
|
use strict; |
|
|
52
|
|
|
|
|
79
|
|
|
|
52
|
|
|
|
|
1814
|
|
|
2
|
52
|
|
|
52
|
|
178
|
use warnings; |
|
|
52
|
|
|
|
|
72
|
|
|
|
52
|
|
|
|
|
4178
|
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Exception; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 'v0.41.0'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
52
|
|
|
52
|
|
23046
|
use overload '""' => \&to_string; |
|
|
52
|
|
|
|
|
64356
|
|
|
|
52
|
|
|
|
|
400
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
124
|
|
|
124
|
0
|
543
|
my ($class, %args) = @_; |
|
11
|
|
|
|
|
|
|
my $self = bless { |
|
12
|
|
|
|
|
|
|
line => $args{line}, |
|
13
|
|
|
|
|
|
|
msg => $args{msg}, |
|
14
|
|
|
|
|
|
|
next => $args{next}, |
|
15
|
|
|
|
|
|
|
where => $args{where}, |
|
16
|
|
|
|
|
|
|
yaml => $args{yaml}, |
|
17
|
|
|
|
|
|
|
got => $args{got}, |
|
18
|
|
|
|
|
|
|
expected => $args{expected}, |
|
19
|
|
|
|
|
|
|
column => $args{column}, |
|
20
|
124
|
|
|
|
|
647
|
}, $class; |
|
21
|
124
|
|
|
|
|
340
|
return $self; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_string { |
|
25
|
372
|
|
|
372
|
0
|
485
|
my ($self) = @_; |
|
26
|
372
|
|
|
|
|
451
|
my $next = $self->{next}; |
|
27
|
372
|
|
|
|
|
409
|
my $line = $self->{line}; |
|
28
|
372
|
|
|
|
|
362
|
my $column = $self->{column}; |
|
29
|
|
|
|
|
|
|
|
|
30
|
372
|
|
|
|
|
376
|
my $yaml = ''; |
|
31
|
372
|
|
|
|
|
683
|
for my $token (@$next) { |
|
32
|
429
|
100
|
|
|
|
585
|
last if $token->{name} eq 'EOL'; |
|
33
|
363
|
|
|
|
|
471
|
$yaml .= $token->{value}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
372
|
50
|
|
|
|
525
|
$column = '???' unless defined $column; |
|
36
|
|
|
|
|
|
|
|
|
37
|
372
|
|
|
|
|
423
|
my $remaining_yaml = $self->{yaml}; |
|
38
|
372
|
50
|
|
|
|
461
|
$remaining_yaml = '' unless defined $remaining_yaml; |
|
39
|
372
|
|
|
|
|
414
|
$yaml .= $remaining_yaml; |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
372
|
|
|
|
|
324
|
local $@; # avoid bug in old Data::Dumper |
|
|
372
|
|
|
|
|
312
|
|
|
42
|
372
|
|
|
|
|
1354
|
require Data::Dumper; |
|
43
|
372
|
|
|
|
|
394
|
local $Data::Dumper::Useqq = 1; |
|
44
|
372
|
|
|
|
|
370
|
local $Data::Dumper::Terse = 1; |
|
45
|
372
|
|
|
|
|
987
|
$yaml = Data::Dumper->Dump([$yaml], ['yaml']); |
|
46
|
372
|
|
|
|
|
11145
|
chomp $yaml; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
372
|
|
|
|
|
371
|
my $lines = 5; |
|
50
|
372
|
|
|
|
|
377
|
my @fields; |
|
51
|
|
|
|
|
|
|
|
|
52
|
372
|
100
|
66
|
|
|
863
|
if ($self->{got} and $self->{expected}) { |
|
53
|
144
|
|
|
|
|
134
|
$lines = 6; |
|
54
|
144
|
|
|
|
|
164
|
$line = $self->{got}->{line}; |
|
55
|
144
|
|
|
|
|
171
|
$column = $self->{got}->{column} + 1; |
|
56
|
|
|
|
|
|
|
@fields = ( |
|
57
|
|
|
|
|
|
|
"Line" => $line, |
|
58
|
|
|
|
|
|
|
"Column" => $column, |
|
59
|
144
|
|
|
|
|
519
|
"Expected", join(" ", @{ $self->{expected} }), |
|
60
|
|
|
|
|
|
|
"Got", $self->{got}->{name}, |
|
61
|
|
|
|
|
|
|
"Where", $self->{where}, |
|
62
|
144
|
|
|
|
|
162
|
"YAML", $yaml, |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
else { |
|
66
|
|
|
|
|
|
|
@fields = ( |
|
67
|
|
|
|
|
|
|
"Line" => $line, |
|
68
|
|
|
|
|
|
|
"Column" => $column, |
|
69
|
|
|
|
|
|
|
"Message", $self->{msg}, |
|
70
|
|
|
|
|
|
|
"Where", $self->{where}, |
|
71
|
228
|
|
|
|
|
563
|
"YAML", $yaml, |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
372
|
|
|
|
|
813
|
my $fmt = join "\n", ("%-10s: %s") x $lines; |
|
75
|
372
|
|
|
|
|
1319
|
my $string = sprintf $fmt, @fields; |
|
76
|
372
|
|
|
|
|
14527
|
return $string; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |