| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
42
|
|
|
42
|
|
329
|
use strict; |
|
|
42
|
|
|
|
|
93
|
|
|
|
42
|
|
|
|
|
1293
|
|
|
2
|
42
|
|
|
42
|
|
224
|
use warnings; |
|
|
42
|
|
|
|
|
81
|
|
|
|
42
|
|
|
|
|
2564
|
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Exception; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.036'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
42
|
|
|
42
|
|
52120
|
use overload '""' => \&to_string; |
|
|
42
|
|
|
|
|
43968
|
|
|
|
42
|
|
|
|
|
366
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
38
|
|
|
38
|
0
|
207
|
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
|
38
|
|
|
|
|
261
|
}, $class; |
|
21
|
38
|
|
|
|
|
128
|
return $self; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_string { |
|
25
|
114
|
|
|
114
|
0
|
237
|
my ($self) = @_; |
|
26
|
114
|
|
|
|
|
172
|
my $next = $self->{next}; |
|
27
|
114
|
|
|
|
|
170
|
my $line = $self->{line}; |
|
28
|
114
|
|
|
|
|
154
|
my $column = $self->{column}; |
|
29
|
|
|
|
|
|
|
|
|
30
|
114
|
|
|
|
|
158
|
my $yaml = ''; |
|
31
|
114
|
|
|
|
|
235
|
for my $token (@$next) { |
|
32
|
21
|
50
|
|
|
|
41
|
last if $token->{name} eq 'EOL'; |
|
33
|
21
|
|
|
|
|
37
|
$yaml .= $token->{value}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
114
|
50
|
|
|
|
258
|
$column = '???' unless defined $column; |
|
36
|
|
|
|
|
|
|
|
|
37
|
114
|
|
|
|
|
172
|
my $remaining_yaml = $self->{yaml}; |
|
38
|
114
|
50
|
|
|
|
212
|
$remaining_yaml = '' unless defined $remaining_yaml; |
|
39
|
114
|
|
|
|
|
166
|
$yaml .= $remaining_yaml; |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
114
|
|
|
|
|
142
|
local $@; # avoid bug in old Data::Dumper |
|
|
114
|
|
|
|
|
160
|
|
|
42
|
114
|
|
|
|
|
487
|
require Data::Dumper; |
|
43
|
114
|
|
|
|
|
209
|
local $Data::Dumper::Useqq = 1; |
|
44
|
114
|
|
|
|
|
148
|
local $Data::Dumper::Terse = 1; |
|
45
|
114
|
|
|
|
|
424
|
$yaml = Data::Dumper->Dump([$yaml], ['yaml']); |
|
46
|
114
|
|
|
|
|
4422
|
chomp $yaml; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
114
|
|
|
|
|
172
|
my $lines = 5; |
|
50
|
114
|
|
|
|
|
142
|
my @fields; |
|
51
|
|
|
|
|
|
|
|
|
52
|
114
|
100
|
66
|
|
|
325
|
if ($self->{got} and $self->{expected}) { |
|
53
|
6
|
|
|
|
|
13
|
$lines = 6; |
|
54
|
6
|
|
|
|
|
14
|
$line = $self->{got}->{line}; |
|
55
|
6
|
|
|
|
|
9
|
$column = $self->{got}->{column} + 1; |
|
56
|
|
|
|
|
|
|
@fields = ( |
|
57
|
|
|
|
|
|
|
"Line" => $line, |
|
58
|
|
|
|
|
|
|
"Column" => $column, |
|
59
|
6
|
|
|
|
|
27
|
"Expected", join(" ", @{ $self->{expected} }), |
|
60
|
|
|
|
|
|
|
"Got", $self->{got}->{name}, |
|
61
|
|
|
|
|
|
|
"Where", $self->{where}, |
|
62
|
6
|
|
|
|
|
11
|
"YAML", $yaml, |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
else { |
|
66
|
|
|
|
|
|
|
@fields = ( |
|
67
|
|
|
|
|
|
|
"Line" => $line, |
|
68
|
|
|
|
|
|
|
"Column" => $column, |
|
69
|
|
|
|
|
|
|
"Message", $self->{msg}, |
|
70
|
|
|
|
|
|
|
"Where", $self->{where}, |
|
71
|
108
|
|
|
|
|
353
|
"YAML", $yaml, |
|
72
|
|
|
|
|
|
|
); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
114
|
|
|
|
|
313
|
my $fmt = join "\n", ("%-10s: %s") x $lines; |
|
75
|
114
|
|
|
|
|
583
|
my $string = sprintf $fmt, @fields; |
|
76
|
114
|
|
|
|
|
3784
|
return $string; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |