line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::if; |
2
|
|
|
|
|
|
|
$Tangerine::hook::if::VERSION = '0.23'; |
3
|
16
|
|
|
16
|
|
1211
|
use 5.010; |
|
16
|
|
|
|
|
36
|
|
4
|
16
|
|
|
16
|
|
54
|
use strict; |
|
16
|
|
|
|
|
20
|
|
|
16
|
|
|
|
|
247
|
|
5
|
16
|
|
|
16
|
|
46
|
use warnings; |
|
16
|
|
|
|
|
24
|
|
|
16
|
|
|
|
|
358
|
|
6
|
16
|
|
|
16
|
|
422
|
use parent 'Tangerine::Hook'; |
|
16
|
|
|
|
|
229
|
|
|
16
|
|
|
|
|
66
|
|
7
|
16
|
|
|
16
|
|
676
|
use Tangerine::HookData; |
|
16
|
|
|
|
|
18
|
|
|
16
|
|
|
|
|
280
|
|
8
|
16
|
|
|
16
|
|
41
|
use Tangerine::Utils qw(any stripquotelike $vre); |
|
16
|
|
|
|
|
18
|
|
|
16
|
|
|
|
|
4217
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
142
|
|
|
142
|
1
|
119
|
my ($self, $s) = @_; |
13
|
142
|
100
|
100
|
199
|
|
363
|
if ((any { $s->[0] eq $_ } qw(use no)) && |
|
199
|
|
100
|
|
|
626
|
|
14
|
|
|
|
|
|
|
scalar(@$s) > 3 && $s->[1] eq 'if') { |
15
|
5
|
|
|
|
|
96
|
my ($version) = $s->[2] =~ $vre; |
16
|
5
|
|
100
|
|
|
39
|
$version //= ''; |
17
|
5
|
100
|
|
|
|
7
|
my $voffset = $version ? 3 : 2; |
18
|
5
|
|
|
|
|
5
|
my ($depth, $index) = (0, 0); |
19
|
5
|
|
|
|
|
8
|
for ($index = $voffset; $index < $#$s; $index++) { |
20
|
11
|
|
|
|
|
133
|
my $token = $s->[$index]; |
21
|
11
|
50
|
33
|
|
|
14
|
$depth++ if ($token eq '[' || $token eq '{' || $token eq '('); |
|
|
|
33
|
|
|
|
|
22
|
11
|
50
|
33
|
|
|
233
|
$depth-- if ($token eq ']' || $token eq '}' || $token eq ')'); |
|
|
|
33
|
|
|
|
|
23
|
11
|
100
|
66
|
|
|
212
|
last if ($token eq ';' || !$depth && |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
24
|
|
|
|
|
|
|
($token eq ',' || $token eq '=>')); |
25
|
|
|
|
|
|
|
} |
26
|
5
|
|
|
|
|
75
|
$index++; |
27
|
5
|
100
|
|
|
|
11
|
if ($s->[$index]) { |
28
|
4
|
|
|
|
|
7
|
$s->[$index] = stripquotelike($s->[$index]); |
29
|
4
|
|
|
|
|
16
|
return Tangerine::HookData->new( |
30
|
|
|
|
|
|
|
children => [ $s->[0], @$s[$index..$#$s] ], |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
138
|
|
|
|
|
1595
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |