line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Gherkin::Exceptions; |
5
|
|
|
|
|
|
|
$Gherkin::Exceptions::VERSION = '25.0.1'; |
6
|
|
|
|
|
|
|
use overload |
7
|
1
|
|
|
|
|
15
|
q{""} => 'stringify', |
8
|
1
|
|
|
1
|
|
6
|
fallback => 1; |
|
1
|
|
|
|
|
2
|
|
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub stringify { my $self = shift; $self->message . "\n" } |
|
0
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
0
|
|
sub throw { my $class = shift; die $class->new(@_) } |
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Parent of single and composite exceptions |
14
|
|
|
|
|
|
|
package Gherkin::Exceptions::Parser; |
15
|
|
|
|
|
|
|
$Gherkin::Exceptions::Parser::VERSION = '25.0.1'; |
16
|
1
|
|
|
1
|
|
182
|
use base 'Gherkin::Exceptions'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
145
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Composite exceptions |
19
|
|
|
|
|
|
|
package Gherkin::Exceptions::CompositeParser; |
20
|
|
|
|
|
|
|
$Gherkin::Exceptions::CompositeParser::VERSION = '25.0.1'; |
21
|
1
|
|
|
1
|
|
6
|
use base 'Gherkin::Exceptions::Parser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
448
|
|
22
|
1
|
|
|
1
|
|
7
|
use Class::XSAccessor accessors => [qw/errors/]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
0
|
|
|
0
|
|
|
my ( $class, @errors ) = @_; |
26
|
0
|
|
|
|
|
|
bless { errors => \@errors }, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub message { |
30
|
0
|
|
|
0
|
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
return join "\n", |
32
|
0
|
|
|
|
|
|
( 'Parser errors:', map { $_->message } @{ $self->errors } ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
|
|
sub throw { my $class = shift; die $class->new(@_) } |
|
0
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# Various non-composite exceptions |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
package Gherkin::Exceptions::SingleParser; |
41
|
|
|
|
|
|
|
$Gherkin::Exceptions::SingleParser::VERSION = '25.0.1'; |
42
|
1
|
|
|
1
|
|
362
|
use base 'Gherkin::Exceptions::Parser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
257
|
|
43
|
1
|
|
|
1
|
|
7
|
use Class::XSAccessor accessors => [qw/location/]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub message { |
46
|
0
|
|
|
0
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
return sprintf( '(%i:%i): %s', |
48
|
|
|
|
|
|
|
$self->location->{'line'}, |
49
|
0
|
|
0
|
|
|
|
( $self->location->{'column'} || 0 ), |
50
|
|
|
|
|
|
|
$self->detailed_message ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package Gherkin::Exceptions::NoSuchLanguage; |
54
|
|
|
|
|
|
|
$Gherkin::Exceptions::NoSuchLanguage::VERSION = '25.0.1'; |
55
|
1
|
|
|
1
|
|
305
|
use base 'Gherkin::Exceptions::SingleParser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
358
|
|
56
|
1
|
|
|
1
|
|
9
|
use Class::XSAccessor accessors => [qw/language location/]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub new { |
59
|
0
|
|
|
0
|
|
|
my ( $class, $language, $location ) = @_; |
60
|
0
|
|
|
|
|
|
return bless { language => $language, location => $location }, $class; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub detailed_message { |
64
|
0
|
|
|
0
|
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
return "Language not supported: " . $self->language; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package Gherkin::Exceptions::AstBuilder; |
69
|
|
|
|
|
|
|
$Gherkin::Exceptions::AstBuilder::VERSION = '25.0.1'; |
70
|
1
|
|
|
1
|
|
334
|
use base 'Gherkin::Exceptions::SingleParser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
255
|
|
71
|
1
|
|
|
1
|
|
7
|
use Class::XSAccessor accessors => [qw/location ast_message/]; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub new { |
74
|
0
|
|
|
0
|
|
|
my ( $class, $ast_message, $location ) = @_; |
75
|
0
|
|
|
|
|
|
return bless { ast_message => $ast_message, location => $location }, |
76
|
|
|
|
|
|
|
$class; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub detailed_message { |
80
|
0
|
|
|
0
|
|
|
my $self = shift; |
81
|
0
|
|
|
|
|
|
return $self->ast_message; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
package Gherkin::Exceptions::UnexpectedEOF; |
85
|
|
|
|
|
|
|
$Gherkin::Exceptions::UnexpectedEOF::VERSION = '25.0.1'; |
86
|
1
|
|
|
1
|
|
327
|
use base 'Gherkin::Exceptions::SingleParser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
276
|
|
87
|
1
|
|
|
1
|
|
9
|
use Class::XSAccessor accessors => [qw/location expected_token_types/]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub new { |
90
|
0
|
|
|
0
|
|
|
my ( $class, $received_token, $expected_token_types ) = @_; |
91
|
0
|
|
|
|
|
|
return bless { |
92
|
|
|
|
|
|
|
location => $received_token->location, |
93
|
|
|
|
|
|
|
received_token => $received_token, |
94
|
|
|
|
|
|
|
expected_token_types => $expected_token_types |
95
|
|
|
|
|
|
|
}, $class; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub detailed_message { |
99
|
0
|
|
|
0
|
|
|
my $self = shift; |
100
|
|
|
|
|
|
|
return "unexpected end of file, expected: " . join ', ', |
101
|
0
|
|
|
|
|
|
@{ $self->expected_token_types }; |
|
0
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
package Gherkin::Exceptions::UnexpectedToken; |
105
|
|
|
|
|
|
|
$Gherkin::Exceptions::UnexpectedToken::VERSION = '25.0.1'; |
106
|
1
|
|
|
1
|
|
355
|
use base 'Gherkin::Exceptions::SingleParser'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
252
|
|
107
|
1
|
|
|
|
|
11
|
use Class::XSAccessor accessors => |
108
|
1
|
|
|
1
|
|
6
|
[qw/location received_token_value expected_token_types state_comment/]; |
|
1
|
|
|
|
|
2
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub new { |
111
|
0
|
|
|
0
|
|
|
my ( $class, $received_token, $expected_token_types, $state_comment ) |
112
|
|
|
|
|
|
|
= @_; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $received_token_value = $received_token->token_value; |
115
|
0
|
|
|
|
|
|
$received_token_value =~ s/^\s+//; |
116
|
0
|
|
|
|
|
|
$received_token_value =~ s/\s+$//; |
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my %location = %{ $received_token->location }; |
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$location{'column'} = $received_token->line->indent + 1 |
120
|
0
|
0
|
|
|
|
|
unless defined $location{'column'}; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
return bless { |
123
|
|
|
|
|
|
|
location => \%location, |
124
|
|
|
|
|
|
|
received_token_value => $received_token_value, |
125
|
|
|
|
|
|
|
expected_token_types => $expected_token_types, |
126
|
|
|
|
|
|
|
state_comment => $state_comment, |
127
|
|
|
|
|
|
|
}, $class; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub detailed_message { |
131
|
0
|
|
|
0
|
|
|
my $self = shift; |
132
|
|
|
|
|
|
|
return sprintf( |
133
|
|
|
|
|
|
|
"expected: %s, got '%s'", |
134
|
0
|
|
|
|
|
|
( join ', ', @{ $self->expected_token_types } ), |
|
0
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$self->received_token_value, |
136
|
|
|
|
|
|
|
); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |