line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::if; |
2
|
|
|
|
|
|
|
$Tangerine::hook::if::VERSION = '0.19'; |
3
|
15
|
|
|
15
|
|
1608
|
use 5.010; |
|
15
|
|
|
|
|
41
|
|
4
|
15
|
|
|
15
|
|
65
|
use strict; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
321
|
|
5
|
15
|
|
|
15
|
|
59
|
use warnings; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
446
|
|
6
|
15
|
|
|
15
|
|
545
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
285
|
|
|
15
|
|
|
|
|
76
|
|
7
|
15
|
|
|
15
|
|
950
|
use List::MoreUtils qw(any); |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
96
|
|
8
|
15
|
|
|
15
|
|
5179
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
400
|
|
9
|
15
|
|
|
15
|
|
96
|
use Tangerine::Utils qw(stripquotelike); |
|
15
|
|
|
|
|
19
|
|
|
15
|
|
|
|
|
4259
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
132
|
|
|
132
|
1
|
155
|
my ($self, $s) = @_; |
14
|
132
|
100
|
100
|
185
|
|
427
|
if ((any { $s->[0] eq $_ } qw(use no)) && |
|
185
|
|
100
|
|
|
711
|
|
15
|
|
|
|
|
|
|
scalar(@$s) > 3 && $s->[1] eq 'if') { |
16
|
5
|
|
|
|
|
99
|
my ($version) = $s->[2] =~ /^(\d.*)$/o; |
17
|
5
|
|
100
|
|
|
31
|
$version //= ''; |
18
|
5
|
100
|
|
|
|
7
|
my $voffset = $version ? 3 : 2; |
19
|
5
|
|
|
|
|
6
|
my ($depth, $index) = (0, 0); |
20
|
5
|
|
|
|
|
14
|
for ($index = $voffset; $index < $#$s; $index++) { |
21
|
11
|
|
|
|
|
151
|
my $token = $s->[$index]; |
22
|
11
|
50
|
33
|
|
|
13
|
$depth++ if ($token eq '[' || $token eq '{' || $token eq '('); |
|
|
|
33
|
|
|
|
|
23
|
11
|
50
|
33
|
|
|
242
|
$depth-- if ($token eq ']' || $token eq '}' || $token eq ')'); |
|
|
|
33
|
|
|
|
|
24
|
11
|
100
|
66
|
|
|
230
|
last if ($token eq ';' || !$depth && |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
25
|
|
|
|
|
|
|
($token eq ',' || $token eq '=>')); |
26
|
|
|
|
|
|
|
} |
27
|
5
|
|
|
|
|
90
|
$index++; |
28
|
5
|
100
|
|
|
|
11
|
if ($s->[$index]) { |
29
|
4
|
|
|
|
|
9
|
$s->[$index] = stripquotelike($s->[$index]); |
30
|
4
|
|
|
|
|
21
|
return Tangerine::HookData->new( |
31
|
|
|
|
|
|
|
children => [ $s->[0], @$s[$index..$#$s] ], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
128
|
|
|
|
|
1880
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |