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