line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::ObjectPad; |
2
|
|
|
|
|
|
|
|
3
|
82
|
|
|
82
|
|
1141
|
use strict; |
|
82
|
|
|
|
|
156
|
|
|
82
|
|
|
|
|
1911
|
|
4
|
82
|
|
|
82
|
|
368
|
use warnings; |
|
82
|
|
|
|
|
151
|
|
|
82
|
|
|
|
|
1623
|
|
5
|
82
|
|
|
82
|
|
370
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
82
|
|
|
|
|
163
|
|
|
82
|
|
|
|
|
37902
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register { return { |
8
|
81
|
|
|
81
|
0
|
571
|
use => { |
9
|
|
|
|
|
|
|
'Object::Pad' => 'parse_object_pad_args', |
10
|
|
|
|
|
|
|
}, |
11
|
|
|
|
|
|
|
}} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse_object_pad_args { |
14
|
42
|
|
|
42
|
0
|
89
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
15
|
|
|
|
|
|
|
|
16
|
42
|
|
|
|
|
157
|
$c->register_sub_parser( |
17
|
|
|
|
|
|
|
'class', |
18
|
|
|
|
|
|
|
[$class, 'parse_class_args', $used_module], |
19
|
|
|
|
|
|
|
); |
20
|
42
|
|
|
|
|
113
|
$c->register_sub_parser( |
21
|
|
|
|
|
|
|
'role', |
22
|
|
|
|
|
|
|
[$class, 'parse_role_args', $used_module], |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
42
|
|
|
|
|
147
|
$c->register_keyword_parser( |
26
|
|
|
|
|
|
|
'class', |
27
|
|
|
|
|
|
|
[$class, 'parse_class_args', $used_module], |
28
|
|
|
|
|
|
|
); |
29
|
42
|
|
|
|
|
112
|
$c->register_keyword_parser( |
30
|
|
|
|
|
|
|
'role', |
31
|
|
|
|
|
|
|
[$class, 'parse_role_args', $used_module], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
42
|
|
|
|
|
129
|
$c->register_sub_keywords(qw/ |
35
|
|
|
|
|
|
|
class method role |
36
|
|
|
|
|
|
|
/); |
37
|
|
|
|
|
|
|
|
38
|
42
|
|
|
|
|
166
|
$c->prototype_re(qr{\G(\((?:[^\\\(\)]*(?:\\.[^\\\(\)]*)*)\))}); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub parse_class_args { |
42
|
39
|
|
|
39
|
0
|
79
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
43
|
|
|
|
|
|
|
|
44
|
39
|
|
|
|
|
96
|
my $tokens = convert_string_tokens($raw_tokens); |
45
|
39
|
|
|
|
|
57
|
shift @$tokens; # discard class |
46
|
|
|
|
|
|
|
|
47
|
39
|
|
|
|
|
69
|
my $isa = my $does = 0; |
48
|
39
|
|
|
|
|
87
|
while(my $token = shift @$tokens) { |
49
|
185
|
|
|
|
|
2772
|
my ($name, $version) = ('', 0); |
50
|
185
|
100
|
33
|
|
|
915
|
if (ref $token && $token->[1] && $token->[1] eq 'WORD') { |
|
|
|
66
|
|
|
|
|
51
|
133
|
100
|
66
|
|
|
334
|
if ($token->[0] eq 'isa' or $token->[0] eq 'extends') { |
52
|
17
|
|
|
|
|
24
|
$isa = 1; |
53
|
17
|
|
|
|
|
24
|
$does = 0; |
54
|
17
|
|
|
|
|
64
|
next; |
55
|
|
|
|
|
|
|
} |
56
|
116
|
100
|
66
|
|
|
262
|
if ($token->[0] eq 'does' or $token->[0] eq 'implements') { |
57
|
21
|
|
|
|
|
31
|
$isa = 0; |
58
|
21
|
|
|
|
|
24
|
$does = 1; |
59
|
21
|
|
|
|
|
47
|
next; |
60
|
|
|
|
|
|
|
} |
61
|
95
|
50
|
|
|
|
172
|
if (is_module_name($token->[0])) { |
62
|
95
|
|
|
|
|
140
|
$name = $token->[0]; |
63
|
95
|
100
|
100
|
|
|
251
|
if (@$tokens && is_version($tokens->[0])) { |
64
|
57
|
|
|
|
|
104
|
$version = shift @$tokens; |
65
|
|
|
|
|
|
|
} |
66
|
95
|
100
|
100
|
|
|
235
|
if ($isa or $does) { |
67
|
56
|
|
|
|
|
139
|
$c->add($name => $version); |
68
|
|
|
|
|
|
|
} else { |
69
|
39
|
|
|
|
|
95
|
$c->add_package($name => $version); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub parse_role_args { |
77
|
9
|
|
|
9
|
0
|
27
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
78
|
|
|
|
|
|
|
|
79
|
9
|
|
|
|
|
22
|
my $tokens = convert_string_tokens($raw_tokens); |
80
|
9
|
|
|
|
|
16
|
shift @$tokens; # discard role |
81
|
|
|
|
|
|
|
|
82
|
9
|
|
|
|
|
104
|
while(my $token = shift @$tokens) { |
83
|
18
|
|
|
|
|
57
|
my ($name, $version) = ('', 0); |
84
|
18
|
100
|
|
|
|
42
|
if (is_module_name($token->[0])) { |
85
|
9
|
|
|
|
|
17
|
$name = $token->[0]; |
86
|
9
|
100
|
100
|
|
|
29
|
if (@$tokens && is_version($tokens->[0])) { |
87
|
3
|
|
|
|
|
7
|
$version = shift @$tokens; |
88
|
|
|
|
|
|
|
} |
89
|
9
|
|
|
|
|
24
|
$c->add_package($name => $version); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |