line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::PackageVariant; |
2
|
|
|
|
|
|
|
|
3
|
82
|
|
|
82
|
|
1090
|
use strict; |
|
82
|
|
|
|
|
228
|
|
|
82
|
|
|
|
|
1829
|
|
4
|
82
|
|
|
82
|
|
313
|
use warnings; |
|
82
|
|
|
|
|
143
|
|
|
82
|
|
|
|
|
1416
|
|
5
|
82
|
|
|
82
|
|
323
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
82
|
|
|
|
|
138
|
|
|
82
|
|
|
|
|
33404
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register {{ |
8
|
81
|
|
|
81
|
0
|
380
|
use => { |
9
|
|
|
|
|
|
|
'Package::Variant' => 'parse_package_variant_args', |
10
|
|
|
|
|
|
|
}, |
11
|
|
|
|
|
|
|
}} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse_package_variant_args { |
14
|
7
|
|
|
7
|
0
|
14
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
15
|
|
|
|
|
|
|
|
16
|
7
|
|
|
|
|
19
|
my $tokens = convert_string_tokens($raw_tokens); |
17
|
|
|
|
|
|
|
|
18
|
7
|
|
|
|
|
19
|
while(my $token = shift @$tokens) { |
19
|
21
|
100
|
100
|
|
|
89
|
if (ref $token and $token->[0] eq 'importing') { |
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
20
|
5
|
50
|
33
|
|
|
93
|
shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA'; |
21
|
5
|
50
|
|
|
|
12
|
my $next_token = shift @$tokens or last; |
22
|
5
|
100
|
|
|
|
15
|
if (!ref $next_token) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
my $module = $next_token; |
24
|
1
|
50
|
|
|
|
4
|
if (is_module_name($module)) { |
25
|
1
|
|
|
|
|
3
|
$c->add($module); |
26
|
1
|
50
|
|
|
|
71
|
if ($c->has_callback_for(use => $module)) { |
27
|
0
|
|
|
|
|
0
|
$c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
elsif ($next_token->[1] eq '[]') { |
32
|
3
|
|
|
|
|
8
|
my $modules = convert_string_token_list($next_token->[0]); |
33
|
3
|
|
|
|
|
8
|
while(my $module = shift @$modules) { |
34
|
5
|
100
|
|
|
|
10
|
next unless is_module_name($module); |
35
|
4
|
|
|
|
|
12
|
$c->add($module); |
36
|
4
|
100
|
|
|
|
97
|
if ($c->has_callback_for(use => $module)) { |
37
|
2
|
|
|
|
|
19
|
$c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} elsif ($next_token->[1] eq '{}') { |
41
|
1
|
|
|
|
|
4
|
my $hash_tokens = convert_string_token_list($next_token->[0]); |
42
|
1
|
|
|
|
|
3
|
while(my $module = shift @$hash_tokens) { |
43
|
1
|
|
|
|
|
2
|
my $arg = shift @$hash_tokens; |
44
|
1
|
50
|
|
|
|
3
|
my @args = $arg->[1] eq '[]' ? @{$arg->[0]} : $arg; |
|
0
|
|
|
|
|
0
|
|
45
|
1
|
|
|
|
|
4
|
$c->add($module); |
46
|
1
|
50
|
|
|
|
26
|
if ($c->has_callback_for(use => $module)) { |
47
|
1
|
|
|
|
|
12
|
$c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], @args, [";", ";"]]); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif (ref $token && !ref $token->[0] && $token->[1] eq 'WORD') { |
53
|
4
|
50
|
33
|
|
|
13
|
shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA'; |
54
|
4
|
50
|
|
|
|
8
|
shift @$tokens if @$tokens; |
55
|
|
|
|
|
|
|
} |
56
|
21
|
100
|
66
|
|
|
95
|
shift @$tokens if @$tokens && ref $tokens->[0] && $tokens->[0][1] eq 'COMMA'; |
|
|
|
100
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |