line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gherkin::AstNode; |
2
|
|
|
|
|
|
|
$Gherkin::AstNode::VERSION = '25.0.2'; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Class::XSAccessor accessors => [ qw/rule_type/, ]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
39
|
|
|
39
|
0
|
68
|
my ( $class, $rule_type ) = @_; |
10
|
39
|
|
|
|
|
189
|
bless { rule_type => $rule_type, _sub_items => {} }, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub add { |
14
|
69
|
|
|
69
|
0
|
14547
|
my ( $self, $rule_type, $obj ) = @_; |
15
|
69
|
|
100
|
|
|
86
|
push( @{ ( $self->{'_sub_items'}->{$rule_type} ||= [] ) }, $obj ); |
|
69
|
|
|
|
|
572
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get_single { |
19
|
78
|
|
|
78
|
0
|
125
|
my ( $self, $rule_type ) = @_; |
20
|
78
|
|
|
|
|
123
|
my $items = $self->{'_sub_items'}->{$rule_type}; |
21
|
78
|
100
|
|
|
|
225
|
return $items unless $items; |
22
|
39
|
|
|
|
|
117
|
return $items->[0]; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_items { |
26
|
21
|
|
|
21
|
0
|
39
|
my ( $self, $rule_type ) = @_; |
27
|
21
|
|
100
|
|
|
76
|
return $self->{'_sub_items'}->{$rule_type} || []; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_token { |
31
|
21
|
|
|
21
|
0
|
33
|
my ( $self, $token_type ) = @_; |
32
|
21
|
|
|
|
|
48
|
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; |