line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gherkin::AstNode; |
2
|
|
|
|
|
|
|
$Gherkin::AstNode::VERSION = '27.0.0'; |
3
|
1
|
|
|
1
|
|
11
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
36
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Class::XSAccessor accessors => [ qw/rule_type/, ]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
39
|
|
|
39
|
0
|
83
|
my ( $class, $rule_type ) = @_; |
10
|
39
|
|
|
|
|
165
|
bless { rule_type => $rule_type, _sub_items => {} }, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub add { |
14
|
69
|
|
|
69
|
0
|
15029
|
my ( $self, $rule_type, $obj ) = @_; |
15
|
69
|
|
100
|
|
|
86
|
push( @{ ( $self->{'_sub_items'}->{$rule_type} ||= [] ) }, $obj ); |
|
69
|
|
|
|
|
470
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get_single { |
19
|
78
|
|
|
78
|
0
|
134
|
my ( $self, $rule_type ) = @_; |
20
|
78
|
|
|
|
|
127
|
my $items = $self->{'_sub_items'}->{$rule_type}; |
21
|
78
|
100
|
|
|
|
229
|
return $items unless $items; |
22
|
39
|
|
|
|
|
109
|
return $items->[0]; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_items { |
26
|
21
|
|
|
21
|
0
|
39
|
my ( $self, $rule_type ) = @_; |
27
|
21
|
|
100
|
|
|
75
|
return $self->{'_sub_items'}->{$rule_type} || []; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_token { |
31
|
21
|
|
|
21
|
0
|
38
|
my ( $self, $token_type ) = @_; |
32
|
21
|
|
|
|
|
41
|
return $self->get_single($token_type); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_tokens { |
36
|
0
|
|
|
0
|
0
|
|
my ( $self, $token_type ) = @_; |
37
|
0
|
|
0
|
|
|
|
return $self->{'_sub_items'}->{$token_type} || []; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |