| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::Core; |
|
2
|
|
|
|
|
|
|
|
|
3
|
84
|
|
|
84
|
|
1470
|
use strict; |
|
|
84
|
|
|
|
|
179
|
|
|
|
84
|
|
|
|
|
2373
|
|
|
4
|
84
|
|
|
84
|
|
414
|
use warnings; |
|
|
84
|
|
|
|
|
178
|
|
|
|
84
|
|
|
|
|
2131
|
|
|
5
|
84
|
|
|
84
|
|
428
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
|
84
|
|
|
|
|
189
|
|
|
|
84
|
|
|
|
|
97862
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my %feature_since = ( |
|
8
|
|
|
|
|
|
|
say => '5.010', |
|
9
|
|
|
|
|
|
|
state => '5.010', |
|
10
|
|
|
|
|
|
|
switch => '5.010', |
|
11
|
|
|
|
|
|
|
unicode_strings => '5.012', |
|
12
|
|
|
|
|
|
|
current_sub => '5.016', |
|
13
|
|
|
|
|
|
|
evalbytes => '5.016', |
|
14
|
|
|
|
|
|
|
fc => '5.016', |
|
15
|
|
|
|
|
|
|
arybase => '5.016', |
|
16
|
|
|
|
|
|
|
unicode_eval => '5.016', |
|
17
|
|
|
|
|
|
|
lexical_subs => '5.018', |
|
18
|
|
|
|
|
|
|
postderef => '5.020', |
|
19
|
|
|
|
|
|
|
postderef_qq => '5.020', |
|
20
|
|
|
|
|
|
|
signatures => '5.020', |
|
21
|
|
|
|
|
|
|
bitwise => '5.022', |
|
22
|
|
|
|
|
|
|
refaliasing => '5.022', |
|
23
|
|
|
|
|
|
|
declared_refs => '5.026', |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub register { return { |
|
27
|
83
|
|
|
83
|
0
|
812
|
use => { |
|
28
|
|
|
|
|
|
|
if => 'parse_if_args', |
|
29
|
|
|
|
|
|
|
base => 'parse_base_args', |
|
30
|
|
|
|
|
|
|
parent => 'parse_parent_args', |
|
31
|
|
|
|
|
|
|
feature => 'parse_feature_args', |
|
32
|
|
|
|
|
|
|
}, |
|
33
|
|
|
|
|
|
|
keyword => { |
|
34
|
|
|
|
|
|
|
package => 'parse_package', |
|
35
|
|
|
|
|
|
|
exit => 'parse_begin_exit', |
|
36
|
|
|
|
|
|
|
}, |
|
37
|
|
|
|
|
|
|
}} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub parse_if_args { |
|
40
|
9
|
|
|
9
|
0
|
50
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
9
|
|
|
|
|
37
|
while(my $token = shift @$raw_tokens) { |
|
43
|
20
|
100
|
|
|
|
79
|
last if $token->[1] eq 'COMMA'; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
37
|
my $tokens = convert_string_tokens($raw_tokens); |
|
47
|
9
|
|
|
|
|
28
|
my $module = shift @$tokens; |
|
48
|
9
|
50
|
66
|
|
|
43
|
if (ref $module and ($module->[1] eq 'WORD' or $module->[1] eq 'KEYWORD')) { |
|
|
|
|
66
|
|
|
|
|
|
49
|
4
|
|
|
|
|
15
|
$module = $module->[0]; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
9
|
50
|
|
|
|
39
|
if (is_module_name($module)) { |
|
52
|
9
|
50
|
|
|
|
28
|
if (is_version($tokens->[0])) { |
|
53
|
0
|
|
|
|
|
0
|
my $version = shift @$tokens; |
|
54
|
0
|
|
|
|
|
0
|
$c->add_recommendation($module => $version); |
|
55
|
|
|
|
|
|
|
} else { |
|
56
|
9
|
|
|
|
|
35
|
$c->add_recommendation($module => 0); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} else { |
|
59
|
0
|
|
|
|
|
0
|
push @{$c->{errors}}, "use if module not found"; |
|
|
0
|
|
|
|
|
0
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub parse_base_args { |
|
64
|
21
|
|
|
21
|
0
|
58
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
|
65
|
|
|
|
|
|
|
|
|
66
|
21
|
|
|
|
|
71
|
my $tokens = convert_string_tokens($raw_tokens); |
|
67
|
21
|
50
|
|
|
|
83
|
if (is_version($tokens->[0])) { |
|
68
|
0
|
|
|
|
|
0
|
$c->add($used_module => shift @$tokens); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
21
|
|
|
|
|
79
|
while(my $token = shift @$tokens) { |
|
71
|
51
|
|
|
|
|
911
|
my $module = $token; |
|
72
|
51
|
100
|
100
|
|
|
243
|
if (ref $module and ($module->[1] || '') eq 'WORD') { |
|
|
|
|
100
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# allow bareword, but disallow function() |
|
74
|
2
|
|
|
|
|
4
|
$module = $module->[0]; |
|
75
|
2
|
100
|
33
|
|
|
22
|
next if @$tokens and ref $tokens->[0] and ($tokens->[0][1] || '') eq '()'; |
|
|
|
|
50
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
# bareword in parentheses |
|
78
|
50
|
100
|
100
|
|
|
180
|
if (ref $module and ref $module->[0]) { |
|
79
|
3
|
|
|
|
|
7
|
$module = $module->[0][0]; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
50
|
100
|
|
|
|
128
|
if (is_module_name($module)) { |
|
82
|
25
|
|
|
|
|
87
|
$c->add($module => 0); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub parse_parent_args { |
|
88
|
28
|
|
|
28
|
0
|
79
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
28
|
|
|
|
|
91
|
my $tokens = convert_string_tokens($raw_tokens); |
|
91
|
28
|
50
|
|
|
|
95
|
if (is_version($tokens->[0])) { |
|
92
|
0
|
|
|
|
|
0
|
$c->add($used_module => shift @$tokens); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
28
|
|
|
|
|
92
|
while(my $token = shift @$tokens) { |
|
95
|
54
|
100
|
|
|
|
843
|
last if $token eq '-norequire'; |
|
96
|
52
|
|
|
|
|
100
|
my $module = $token; |
|
97
|
52
|
100
|
|
|
|
129
|
if (ref $token) { |
|
98
|
31
|
100
|
|
|
|
103
|
last if $token->[0] eq '-norequire'; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
47
|
100
|
100
|
|
|
207
|
if (ref $module and ($module->[1] || '') eq 'WORD') { |
|
|
|
|
100
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# allow bareword, but disallow function() |
|
102
|
2
|
|
|
|
|
5
|
$module = $module->[0]; |
|
103
|
2
|
100
|
33
|
|
|
31
|
next if @$tokens and ref $tokens->[0] and ($tokens->[0][1] || '') eq '()'; |
|
|
|
|
50
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
# bareword in parentheses |
|
106
|
46
|
100
|
100
|
|
|
152
|
if (ref $module and ref $module->[0]) { |
|
107
|
3
|
|
|
|
|
7
|
$module = $module->[0][0]; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
46
|
100
|
|
|
|
122
|
$c->add($module => 0) if is_module_name($module); |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub parse_feature_args { |
|
114
|
10
|
|
|
10
|
0
|
36
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
|
115
|
|
|
|
|
|
|
|
|
116
|
10
|
|
|
|
|
43
|
$c->add_perl('5.010', 'feature'); |
|
117
|
10
|
|
|
|
|
40
|
my $tokens = convert_string_tokens($raw_tokens); |
|
118
|
10
|
50
|
|
|
|
37
|
if (is_version($tokens->[0])) { |
|
119
|
0
|
|
|
|
|
0
|
$c->add($used_module => shift @$tokens); |
|
120
|
|
|
|
|
|
|
} |
|
121
|
10
|
|
|
|
|
51
|
while(my $token = shift @$tokens) { |
|
122
|
19
|
100
|
|
|
|
104
|
next if ref $token; |
|
123
|
9
|
100
|
|
|
|
33
|
if (exists $feature_since{$token}) { |
|
124
|
5
|
|
|
|
|
26
|
$c->add_perl($feature_since{$token} => "feature $token"); |
|
125
|
5
|
|
|
|
|
21
|
next; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
4
|
50
|
|
|
|
37
|
if ($token =~ /^:5\.([0-9]+)(\.\[0-9]+)?/) { |
|
128
|
4
|
|
|
|
|
32
|
my $version = sprintf '5.%03d', $1; |
|
129
|
4
|
|
|
|
|
22
|
$c->add_perl($version, $token); |
|
130
|
4
|
|
|
|
|
21
|
next; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub parse_begin_exit { |
|
136
|
8
|
|
|
8
|
0
|
30
|
my ($class, $c, $raw_tokens) = @_; |
|
137
|
|
|
|
|
|
|
|
|
138
|
8
|
50
|
|
|
|
18
|
my @stack = @{$c->{stack} || []}; |
|
|
8
|
|
|
|
|
33
|
|
|
139
|
8
|
50
|
|
|
|
26
|
if (grep {$_->[0] eq '{' and $_->[2] eq 'BEGIN'} @stack) { |
|
|
7
|
100
|
|
|
|
67
|
|
|
140
|
4
|
100
|
|
|
|
12
|
if (grep {$c->token_is_conditional($_->[0])} @$raw_tokens) { |
|
|
12
|
100
|
|
|
|
39
|
|
|
141
|
1
|
|
|
|
|
5
|
$c->{force_cond} = 1; |
|
142
|
4
|
50
|
|
|
|
25
|
} elsif (grep {$_->[0] eq '{' and $c->token_is_conditional($_->[2])} @stack) { |
|
143
|
1
|
|
|
|
|
6
|
$c->{force_cond} = 1; |
|
144
|
|
|
|
|
|
|
} else { |
|
145
|
2
|
|
|
|
|
6
|
$c->{ended} = 1; |
|
146
|
2
|
|
|
|
|
5
|
@{$c->{stack}} = (); |
|
|
2
|
|
|
|
|
9
|
|
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub parse_package { |
|
152
|
32
|
|
|
32
|
0
|
91
|
my ($class, $c, $raw_tokens) = @_; |
|
153
|
|
|
|
|
|
|
|
|
154
|
32
|
|
|
|
|
145
|
my $tokens = convert_string_tokens($raw_tokens); |
|
155
|
32
|
|
|
|
|
69
|
shift @$tokens; # drop "package" |
|
156
|
32
|
|
|
|
|
67
|
my $token = shift @$tokens; |
|
157
|
32
|
100
|
33
|
|
|
244
|
if (ref $token && $token->[1] && $token->[1] eq 'WORD') { |
|
|
|
|
66
|
|
|
|
|
|
158
|
31
|
|
|
|
|
124
|
$c->add_package($token->[0]); |
|
159
|
|
|
|
|
|
|
} |
|
160
|
32
|
50
|
|
|
|
123
|
if (@$tokens) { |
|
161
|
32
|
|
|
|
|
70
|
$token = shift @$tokens; |
|
162
|
32
|
100
|
|
|
|
130
|
if (is_version($token)) { |
|
163
|
5
|
|
|
|
|
19
|
$c->add_perl("5.012", "package PACKAGE VERSION"); |
|
164
|
5
|
|
|
|
|
15
|
$token = shift @$tokens; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
32
|
100
|
33
|
|
|
348
|
if (ref $token && $token->[1] && $token->[1] =~ /^\{/) { |
|
|
|
|
66
|
|
|
|
|
|
167
|
6
|
|
|
|
|
20
|
$c->add_perl("5.014", "package PACKAGE (VERSION) {}"); |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
1; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
__END__ |