line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::ClassAccessor; |
2
|
|
|
|
|
|
|
|
3
|
82
|
|
|
82
|
|
1558
|
use strict; |
|
82
|
|
|
|
|
161
|
|
|
82
|
|
|
|
|
1985
|
|
4
|
82
|
|
|
82
|
|
317
|
use warnings; |
|
82
|
|
|
|
|
134
|
|
|
82
|
|
|
|
|
1490
|
|
5
|
82
|
|
|
82
|
|
383
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
82
|
|
|
|
|
150
|
|
|
82
|
|
|
|
|
33094
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register {{ |
8
|
81
|
|
|
81
|
0
|
504
|
use => { |
9
|
|
|
|
|
|
|
'Class::Accessor' => 'parse_class_accessor_args', |
10
|
|
|
|
|
|
|
'Class::Accessor::Fast' => 'parse_class_accessor_args', |
11
|
|
|
|
|
|
|
'Class::Accessor::Faster' => 'parse_class_accessor_args', |
12
|
|
|
|
|
|
|
'Class::XSAccessor::Compat' => 'parse_class_accessor_args', |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
}} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub parse_class_accessor_args { |
17
|
2
|
|
|
2
|
0
|
5
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
6
|
my $tokens = convert_string_tokens($raw_tokens); |
20
|
2
|
50
|
|
|
|
7
|
if (is_version($tokens->[0])) { |
21
|
0
|
|
|
|
|
0
|
$c->add($used_module => shift @$tokens); |
22
|
|
|
|
|
|
|
} |
23
|
2
|
|
|
|
|
7
|
while(my $token = shift @$tokens) { |
24
|
2
|
50
|
|
|
|
11
|
if ($token =~ /^(?:antlers|moose-?like)$/i) { |
25
|
2
|
|
|
|
|
11
|
$c->register_keyword_parser( |
26
|
|
|
|
|
|
|
'extends', |
27
|
|
|
|
|
|
|
[$class, 'parse_extends_args', $used_module], |
28
|
|
|
|
|
|
|
); |
29
|
2
|
|
|
|
|
8
|
last; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub parse_extends_args { |
35
|
2
|
|
|
2
|
0
|
5
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
5
|
my $tokens = convert_string_tokens($raw_tokens); |
38
|
2
|
|
|
|
|
3
|
shift @$tokens; # discard extends, with; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
2
|
my $prev; |
41
|
2
|
|
|
|
|
34
|
for my $token (@$tokens) { |
42
|
4
|
100
|
|
|
|
9
|
if (!ref $token) { |
43
|
2
|
|
|
|
|
7
|
$c->add($token => 0); |
44
|
2
|
|
|
|
|
82
|
$prev = $token; |
45
|
2
|
|
|
|
|
4
|
next; |
46
|
|
|
|
|
|
|
} |
47
|
2
|
|
50
|
|
|
5
|
my $desc = $token->[1] || ''; |
48
|
2
|
50
|
|
|
|
10
|
if ($desc eq '{}') { |
49
|
0
|
0
|
|
|
|
|
my @hash_tokens = @{$token->[0] || []}; |
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
for(my $i = 0, my $len = @hash_tokens; $i < $len; $i++) { |
51
|
0
|
0
|
0
|
|
|
|
if ($hash_tokens[$i][0] eq '-version' and $i < $len - 2) { |
52
|
0
|
|
|
|
|
|
my $maybe_version_token = $hash_tokens[$i + 2]; |
53
|
0
|
|
|
|
|
|
my $maybe_version = $maybe_version_token->[0]; |
54
|
0
|
0
|
|
|
|
|
if (ref $maybe_version) { |
55
|
0
|
|
|
|
|
|
$maybe_version = $maybe_version->[0]; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
0
|
|
|
|
if ($prev and is_version($maybe_version)) { |
58
|
0
|
|
|
|
|
|
$c->add($prev => $maybe_version); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |