line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::inline; |
2
|
|
|
|
|
|
|
$Tangerine::hook::inline::VERSION = '0.19'; |
3
|
15
|
|
|
15
|
|
982
|
use 5.010; |
|
15
|
|
|
|
|
42
|
|
4
|
15
|
|
|
15
|
|
63
|
use strict; |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
304
|
|
5
|
15
|
|
|
15
|
|
57
|
use warnings; |
|
15
|
|
|
|
|
19
|
|
|
15
|
|
|
|
|
457
|
|
6
|
15
|
|
|
15
|
|
63
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
67
|
|
7
|
15
|
|
|
15
|
|
919
|
use List::MoreUtils qw(any); |
|
15
|
|
|
|
|
18
|
|
|
15
|
|
|
|
|
105
|
|
8
|
15
|
|
|
15
|
|
5082
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
395
|
|
9
|
15
|
|
|
15
|
|
64
|
use Tangerine::Occurence; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
397
|
|
10
|
15
|
|
|
15
|
|
64
|
use Tangerine::Utils qw(stripquotelike); |
|
15
|
|
|
|
|
20
|
|
|
15
|
|
|
|
|
8735
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my %langmap = ( |
13
|
|
|
|
|
|
|
(map { $_ => 'ASM' } qw/nasm NASM gasp GASP as AS asm/), |
14
|
|
|
|
|
|
|
(map { $_ => 'Awk' } qw/AWK awk/), |
15
|
|
|
|
|
|
|
basic => 'Basic', |
16
|
|
|
|
|
|
|
(map { $_ => 'BC' } qw/bc Bc/), |
17
|
|
|
|
|
|
|
(map { $_ => 'Befunge' } qw/befunge BEFUNGE bef BEF/), |
18
|
|
|
|
|
|
|
c => 'C', |
19
|
|
|
|
|
|
|
(map { $_ => 'CPP' } qw/cpp C++ c++ Cplusplus cplusplus CXX cxx/), |
20
|
|
|
|
|
|
|
GUILE => 'Guile', |
21
|
|
|
|
|
|
|
(map { $_ => 'Java' } qw/JAVA java/), |
22
|
|
|
|
|
|
|
lua => 'Lua', |
23
|
|
|
|
|
|
|
MZSCHEME => 'MzScheme', |
24
|
|
|
|
|
|
|
nouse => 'Nouse', |
25
|
|
|
|
|
|
|
octave => 'Octave', |
26
|
|
|
|
|
|
|
(map { $_ => 'Pdlpp' } qw/pdlpp PDLPP/), |
27
|
|
|
|
|
|
|
perl => 'Perl', |
28
|
|
|
|
|
|
|
(map { $_ => 'Python' } qw/py python PYTHON/), |
29
|
|
|
|
|
|
|
(map { $_ => 'Ruby' } qw/rb ruby RUBY/), |
30
|
|
|
|
|
|
|
(map { $_ => 'SLang' } qw/sl slang/), |
31
|
|
|
|
|
|
|
(map { $_ => 'SMITH' } qw/Smith smith/), |
32
|
|
|
|
|
|
|
(map { $_ => 'Tcl' } qw/tcl tk/), |
33
|
|
|
|
|
|
|
(map { $_ => 'TT' } qw/tt template/), |
34
|
|
|
|
|
|
|
webchat => 'WebChat', |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub run { |
38
|
128
|
|
|
128
|
1
|
161
|
my ($self, $s) = @_; |
39
|
128
|
100
|
100
|
181
|
|
412
|
if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && |
|
181
|
|
100
|
|
|
697
|
|
40
|
|
|
|
|
|
|
$s->[1] eq 'Inline') { |
41
|
10
|
|
|
|
|
242
|
my ($version) = $s->[2] =~ /^(\d.*)$/o; |
42
|
10
|
|
50
|
|
|
105
|
$version //= ''; |
43
|
10
|
50
|
|
|
|
19
|
my $voffset = $version ? 3 : 2; |
44
|
10
|
|
|
|
|
8
|
my @args; |
45
|
10
|
50
|
|
|
|
17
|
if (scalar(@$s) > $voffset) { |
46
|
10
|
100
|
|
|
|
18
|
return if $s->[$voffset] eq ';'; |
47
|
9
|
|
|
|
|
143
|
@args = @$s; |
48
|
9
|
|
|
|
|
25
|
@args = @args[($voffset) .. $#args]; |
49
|
9
|
|
|
|
|
26
|
@args = stripquotelike(@args); |
50
|
|
|
|
|
|
|
} |
51
|
9
|
|
|
|
|
11
|
my @modules; |
52
|
9
|
100
|
|
|
|
27
|
if ($args[0] =~ /config/io) { |
|
|
100
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return |
54
|
1
|
|
|
|
|
6
|
} elsif ($args[0] =~ /with/io) { |
55
|
3
|
|
|
|
|
6
|
shift @args; |
56
|
3
|
|
|
|
|
6
|
push @modules, @args; |
57
|
|
|
|
|
|
|
} else { |
58
|
5
|
|
66
|
|
|
34
|
push @modules, 'Inline::'.($langmap{$args[0]} // $args[0]) |
59
|
|
|
|
|
|
|
} |
60
|
8
|
50
|
|
12
|
|
51
|
if (any { $_ eq 'FILTERS' } @args) { |
|
12
|
|
|
|
|
19
|
|
61
|
0
|
|
|
|
|
0
|
push @modules, 'Inline::Filters' |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
return Tangerine::HookData->new( |
64
|
|
|
|
|
|
|
modules => { |
65
|
|
|
|
|
|
|
map { |
66
|
8
|
|
|
|
|
57
|
( $_ => Tangerine::Occurence->new() ) |
|
9
|
|
|
|
|
26
|
|
67
|
|
|
|
|
|
|
} @modules, |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
118
|
|
|
|
|
1815
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |