line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::ObjectPad; |
2
|
|
|
|
|
|
|
|
3
|
83
|
|
|
83
|
|
1417
|
use strict; |
|
83
|
|
|
|
|
186
|
|
|
83
|
|
|
|
|
2370
|
|
4
|
83
|
|
|
83
|
|
428
|
use warnings; |
|
83
|
|
|
|
|
191
|
|
|
83
|
|
|
|
|
1995
|
|
5
|
83
|
|
|
83
|
|
442
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
83
|
|
|
|
|
190
|
|
|
83
|
|
|
|
|
56726
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register { return { |
8
|
82
|
|
|
82
|
0
|
533
|
use => { |
9
|
|
|
|
|
|
|
'Object::Pad' => 'parse_object_pad_args', |
10
|
|
|
|
|
|
|
}, |
11
|
|
|
|
|
|
|
}} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse_object_pad_args { |
14
|
84
|
|
|
84
|
0
|
255
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
15
|
|
|
|
|
|
|
|
16
|
84
|
|
|
|
|
419
|
$c->register_sub_parser( |
17
|
|
|
|
|
|
|
'class', |
18
|
|
|
|
|
|
|
[$class, 'parse_class_args', $used_module], |
19
|
|
|
|
|
|
|
); |
20
|
84
|
|
|
|
|
339
|
$c->register_sub_parser( |
21
|
|
|
|
|
|
|
'role', |
22
|
|
|
|
|
|
|
[$class, 'parse_role_args', $used_module], |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
84
|
|
|
|
|
362
|
$c->register_keyword_parser( |
26
|
|
|
|
|
|
|
'class', |
27
|
|
|
|
|
|
|
[$class, 'parse_class_args', $used_module], |
28
|
|
|
|
|
|
|
); |
29
|
84
|
|
|
|
|
295
|
$c->register_keyword_parser( |
30
|
|
|
|
|
|
|
'role', |
31
|
|
|
|
|
|
|
[$class, 'parse_role_args', $used_module], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
84
|
|
|
|
|
297
|
$c->register_sub_keywords(qw/ |
35
|
|
|
|
|
|
|
class method role |
36
|
|
|
|
|
|
|
/); |
37
|
|
|
|
|
|
|
|
38
|
84
|
|
|
|
|
462
|
$c->prototype_re(qr{\G(\((?:[^\\\(\)]*(?:\\.[^\\\(\)]*)*)\))}); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub parse_class_args { |
42
|
78
|
|
|
78
|
0
|
192
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
43
|
|
|
|
|
|
|
|
44
|
78
|
|
|
|
|
241
|
my $tokens = convert_string_tokens($raw_tokens); |
45
|
78
|
|
|
|
|
146
|
shift @$tokens; # discard class |
46
|
|
|
|
|
|
|
|
47
|
78
|
|
|
|
|
145
|
my $isa = my $does = 0; |
48
|
78
|
|
|
|
|
254
|
while(my $token = shift @$tokens) { |
49
|
290
|
|
|
|
|
1943
|
my ($name, $version) = ('', 0); |
50
|
290
|
100
|
33
|
|
|
1304
|
if (ref $token && $token->[1] && $token->[1] eq 'WORD') { |
|
|
|
66
|
|
|
|
|
51
|
172
|
100
|
66
|
|
|
572
|
if ($token->[0] eq 'isa' or $token->[0] eq 'extends') { |
52
|
17
|
|
|
|
|
35
|
$isa = 1; |
53
|
17
|
|
|
|
|
58
|
$does = 0; |
54
|
17
|
|
|
|
|
57
|
next; |
55
|
|
|
|
|
|
|
} |
56
|
155
|
100
|
66
|
|
|
502
|
if ($token->[0] eq 'does' or $token->[0] eq 'implements') { |
57
|
21
|
|
|
|
|
45
|
$isa = 0; |
58
|
21
|
|
|
|
|
42
|
$does = 1; |
59
|
21
|
|
|
|
|
63
|
next; |
60
|
|
|
|
|
|
|
} |
61
|
134
|
50
|
|
|
|
350
|
if (is_module_name($token->[0])) { |
62
|
134
|
|
|
|
|
274
|
$name = $token->[0]; |
63
|
134
|
100
|
100
|
|
|
487
|
if (@$tokens && is_version($tokens->[0])) { |
64
|
76
|
|
|
|
|
169
|
$version = shift @$tokens; |
65
|
|
|
|
|
|
|
} |
66
|
134
|
100
|
100
|
|
|
462
|
if ($isa or $does) { |
67
|
56
|
|
|
|
|
153
|
$c->add($name => $version); |
68
|
|
|
|
|
|
|
} else { |
69
|
78
|
|
|
|
|
248
|
$c->add_package($name => $version); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
252
|
100
|
33
|
|
|
5413
|
if (ref $token && $token->[1] && $token->[1] eq 'ATTRIBUTE') { |
|
|
|
66
|
|
|
|
|
74
|
42
|
|
|
|
|
274
|
while($token->[0] =~ s/:(?:isa|does)\(([^)]+)\)//) { |
75
|
56
|
|
|
|
|
1802
|
my ($name, $version) = split /\s+/, $1; |
76
|
56
|
|
100
|
|
|
163
|
$version ||= 0; |
77
|
56
|
50
|
33
|
|
|
131
|
if (is_module_name($name) && is_version($version)) { |
78
|
56
|
|
|
|
|
158
|
$c->add($name => $version); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub parse_role_args { |
86
|
18
|
|
|
18
|
0
|
52
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
87
|
|
|
|
|
|
|
|
88
|
18
|
|
|
|
|
55
|
my $tokens = convert_string_tokens($raw_tokens); |
89
|
18
|
|
|
|
|
238
|
shift @$tokens; # discard role |
90
|
|
|
|
|
|
|
|
91
|
18
|
|
|
|
|
63
|
while(my $token = shift @$tokens) { |
92
|
36
|
|
|
|
|
78
|
my ($name, $version) = ('', 0); |
93
|
36
|
100
|
|
|
|
113
|
if (is_module_name($token->[0])) { |
94
|
18
|
|
|
|
|
42
|
$name = $token->[0]; |
95
|
18
|
100
|
100
|
|
|
81
|
if (@$tokens && is_version($tokens->[0])) { |
96
|
6
|
|
|
|
|
15
|
$version = shift @$tokens; |
97
|
|
|
|
|
|
|
} |
98
|
18
|
|
|
|
|
175
|
$c->add_package($name => $version); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |