| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::Annotation::Chain; |
|
2
|
2
|
|
|
2
|
|
27
|
use v5.24; |
|
|
2
|
|
|
|
|
8
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use Moo; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
15
|
|
|
4
|
2
|
|
|
2
|
|
728
|
use experimental qw< signatures >; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
|
|
{ our $VERSION = '0.006' } |
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
400
|
use Scalar::Util qw< blessed >; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
108
|
|
|
8
|
2
|
|
|
2
|
|
868
|
use Data::Annotation::Rule; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
71
|
|
|
9
|
2
|
|
|
2
|
|
13
|
use namespace::clean; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has description => (is => 'ro', default => ''); |
|
12
|
|
|
|
|
|
|
has default_retval => (is => 'ro', init_arg => 'default', predicate => 1); |
|
13
|
|
|
|
|
|
|
has parse_context => (is => 'ro', default => sub { return {} }, |
|
14
|
|
|
|
|
|
|
init_arg => 'condition-parse-context'); |
|
15
|
|
|
|
|
|
|
has rules => (is => 'ro', default => sub { [] }); |
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
1
|
11
|
sub evaluate ($self, $state, $overlay) { |
|
|
5
|
|
|
|
|
27
|
|
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
8
|
|
|
18
|
5
|
|
|
|
|
18
|
my $rules = $self->rules; |
|
19
|
5
|
|
50
|
|
|
29
|
my $ri = \($state->{idx} //= 0); |
|
20
|
5
|
|
|
|
|
20
|
while ($$ri <= $rules->$#*) { |
|
21
|
5
|
100
|
|
|
|
131
|
$rules->[$$ri] = Data::Annotation::Rule->new( |
|
22
|
|
|
|
|
|
|
'condition-parse-context' => $self->parse_context, |
|
23
|
|
|
|
|
|
|
$rules->[$$ri]->%*, |
|
24
|
|
|
|
|
|
|
) unless blessed($rules->[$$ri]); |
|
25
|
5
|
|
|
|
|
2242
|
my $rule = $rules->[$$ri++]; |
|
26
|
5
|
100
|
|
|
|
25
|
if (defined(my $outcome = $rule->evaluate($overlay))) { |
|
27
|
3
|
50
|
|
|
|
11
|
my $name = $rule->has_name ? $rule->name : "#@{[ $$ri - 1 ]}"; |
|
|
3
|
|
|
|
|
17
|
|
|
28
|
3
|
|
|
|
|
19
|
return ($outcome, $name); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
} |
|
31
|
2
|
100
|
|
|
|
20
|
return $self->has_default_retval ? ($self->default_retval, undef) : (); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |