line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::if; |
2
|
|
|
|
|
|
|
$Tangerine::hook::if::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
3670
|
use 5.010; |
|
15
|
|
|
|
|
50
|
|
4
|
15
|
|
|
15
|
|
79
|
use strict; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
373
|
|
5
|
15
|
|
|
15
|
|
79
|
use warnings; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
426
|
|
6
|
15
|
|
|
15
|
|
1320
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
515
|
|
|
15
|
|
|
|
|
85
|
|
7
|
15
|
|
|
15
|
|
963
|
use List::Util 1.33 qw(any); |
|
15
|
|
|
|
|
269
|
|
|
15
|
|
|
|
|
991
|
|
8
|
15
|
|
|
15
|
|
79
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
404
|
|
9
|
15
|
|
|
15
|
|
76
|
use Tangerine::Utils qw(stripquotelike $vre); |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
5589
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
136
|
|
|
136
|
1
|
226
|
my ($self, $s) = @_; |
14
|
136
|
100
|
100
|
191
|
|
516
|
if ((any { $s->[0] eq $_ } qw(use no)) && |
|
191
|
|
100
|
|
|
1080
|
|
15
|
|
|
|
|
|
|
scalar(@$s) > 3 && $s->[1] eq 'if') { |
16
|
5
|
|
|
|
|
153
|
my ($version) = $s->[2] =~ $vre; |
17
|
5
|
|
100
|
|
|
42
|
$version //= ''; |
18
|
5
|
100
|
|
|
|
12
|
my $voffset = $version ? 3 : 2; |
19
|
5
|
|
|
|
|
5
|
my ($depth, $index) = (0, 0); |
20
|
5
|
|
|
|
|
16
|
for ($index = $voffset; $index < $#$s; $index++) { |
21
|
11
|
|
|
|
|
244
|
my $token = $s->[$index]; |
22
|
11
|
50
|
33
|
|
|
30
|
$depth++ if ($token eq '[' || $token eq '{' || $token eq '('); |
|
|
|
33
|
|
|
|
|
23
|
11
|
50
|
33
|
|
|
459
|
$depth-- if ($token eq ']' || $token eq '}' || $token eq ')'); |
|
|
|
33
|
|
|
|
|
24
|
11
|
100
|
66
|
|
|
410
|
last if ($token eq ';' || !$depth && |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
25
|
|
|
|
|
|
|
($token eq ',' || $token eq '=>')); |
26
|
|
|
|
|
|
|
} |
27
|
5
|
|
|
|
|
142
|
$index++; |
28
|
5
|
100
|
|
|
|
17
|
if ($s->[$index]) { |
29
|
4
|
|
|
|
|
12
|
$s->[$index] = stripquotelike($s->[$index]); |
30
|
4
|
|
|
|
|
27
|
return Tangerine::HookData->new( |
31
|
|
|
|
|
|
|
children => [ $s->[0], @$s[$index..$#$s] ], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
132
|
|
|
|
|
2725
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |