line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tangerine::hook::inline; |
2
|
|
|
|
|
|
|
$Tangerine::hook::inline::VERSION = '0.20'; |
3
|
15
|
|
|
15
|
|
1308
|
use 5.010; |
|
15
|
|
|
|
|
48
|
|
4
|
15
|
|
|
15
|
|
69
|
use strict; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
325
|
|
5
|
15
|
|
|
15
|
|
72
|
use warnings; |
|
15
|
|
|
|
|
21
|
|
|
15
|
|
|
|
|
370
|
|
6
|
15
|
|
|
15
|
|
69
|
use parent 'Tangerine::Hook'; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
70
|
|
7
|
15
|
|
|
15
|
|
915
|
use List::Util 1.33 qw(any); |
|
15
|
|
|
|
|
275
|
|
|
15
|
|
|
|
|
897
|
|
8
|
15
|
|
|
15
|
|
76
|
use Tangerine::HookData; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
401
|
|
9
|
15
|
|
|
15
|
|
70
|
use Tangerine::Occurence; |
|
15
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
358
|
|
10
|
15
|
|
|
15
|
|
79
|
use Tangerine::Utils qw(stripquotelike $vre); |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
9701
|
|
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
|
132
|
|
|
132
|
1
|
206
|
my ($self, $s) = @_; |
39
|
132
|
100
|
100
|
187
|
|
498
|
if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && |
|
187
|
|
100
|
|
|
1063
|
|
40
|
|
|
|
|
|
|
$s->[1] eq 'Inline') { |
41
|
10
|
|
|
|
|
331
|
my ($version) = $s->[2] =~ $vre; |
42
|
10
|
|
50
|
|
|
148
|
$version //= ''; |
43
|
10
|
50
|
|
|
|
18
|
my $voffset = $version ? 3 : 2; |
44
|
10
|
|
|
|
|
11
|
my @args; |
45
|
10
|
50
|
|
|
|
23
|
if (scalar(@$s) > $voffset) { |
46
|
10
|
100
|
|
|
|
25
|
return if $s->[$voffset] eq ';'; |
47
|
9
|
|
|
|
|
190
|
@args = @$s; |
48
|
9
|
|
|
|
|
25
|
@args = @args[($voffset) .. $#args]; |
49
|
9
|
|
|
|
|
27
|
@args = stripquotelike(@args); |
50
|
|
|
|
|
|
|
} |
51
|
9
|
|
|
|
|
15
|
my @modules; |
52
|
9
|
100
|
|
|
|
28
|
if ($args[0] =~ /config/io) { |
|
|
100
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return |
54
|
1
|
|
|
|
|
8
|
} elsif ($args[0] =~ /with/io) { |
55
|
3
|
|
|
|
|
5
|
shift @args; |
56
|
3
|
|
|
|
|
7
|
push @modules, @args; |
57
|
|
|
|
|
|
|
} else { |
58
|
5
|
|
66
|
|
|
38
|
push @modules, 'Inline::'.($langmap{$args[0]} // $args[0]) |
59
|
|
|
|
|
|
|
} |
60
|
8
|
50
|
|
12
|
|
56
|
if (any { $_ eq 'FILTERS' } @args) { |
|
12
|
|
|
|
|
26
|
|
61
|
0
|
|
|
|
|
0
|
push @modules, 'Inline::Filters' |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
return Tangerine::HookData->new( |
64
|
|
|
|
|
|
|
modules => { |
65
|
|
|
|
|
|
|
map { |
66
|
8
|
|
|
|
|
61
|
( $_ => Tangerine::Occurence->new() ) |
|
9
|
|
|
|
|
27
|
|
67
|
|
|
|
|
|
|
} @modules, |
68
|
|
|
|
|
|
|
}, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
122
|
|
|
|
|
2638
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |