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