| 1 | package Tangerine::hook::inline; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 16 | $Tangerine::hook::inline::VERSION = '0.23'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use parent 'Tangerine::Hook'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 16 | ▶ | use Tangerine::HookData; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 16 | ▶ | use Tangerine::Occurence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 16 | ▶ | use Tangerine::Utils qw(any stripquotelike $vre); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | my %langmap = ( | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 112 | (map { $_ => 'ASM' } qw/nasm NASM gasp GASP as AS asm/), | |||||||||||||||||||||||||||||||||||||||||
| 13 | 32 | (map { $_ => 'Awk' } qw/AWK awk/), | |||||||||||||||||||||||||||||||||||||||||
| 14 | basic => 'Basic', | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 32 | (map { $_ => 'BC' } qw/bc Bc/), | |||||||||||||||||||||||||||||||||||||||||
| 16 | 64 | (map { $_ => 'Befunge' } qw/befunge BEFUNGE bef BEF/), | |||||||||||||||||||||||||||||||||||||||||
| 17 | c => 'C', | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 112 | (map { $_ => 'CPP' } qw/cpp C++ c++ Cplusplus cplusplus CXX cxx/), | |||||||||||||||||||||||||||||||||||||||||
| 19 | GUILE => 'Guile', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 32 | (map { $_ => 'Java' } qw/JAVA java/), | |||||||||||||||||||||||||||||||||||||||||
| 21 | lua => 'Lua', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | MZSCHEME => 'MzScheme', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | nouse => 'Nouse', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | octave => 'Octave', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 32 | (map { $_ => 'Pdlpp' } qw/pdlpp PDLPP/), | |||||||||||||||||||||||||||||||||||||||||
| 26 | perl => 'Perl', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 48 | (map { $_ => 'Python' } qw/py python PYTHON/), | |||||||||||||||||||||||||||||||||||||||||
| 28 | 48 | (map { $_ => 'Ruby' } qw/rb ruby RUBY/), | |||||||||||||||||||||||||||||||||||||||||
| 29 | 32 | (map { $_ => 'SLang' } qw/sl slang/), | |||||||||||||||||||||||||||||||||||||||||
| 30 | 32 | (map { $_ => 'SMITH' } qw/Smith smith/), | |||||||||||||||||||||||||||||||||||||||||
| 31 | 32 | (map { $_ => 'Tcl' } qw/tcl tk/), | |||||||||||||||||||||||||||||||||||||||||
| 32 | 16 | (map { $_ => 'TT' } qw/tt template/), | |||||||||||||||||||||||||||||||||||||||||
| 33 | webchat => 'WebChat', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 138 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=12 SCAR=25.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 138 | my ($self, $s) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 138 | ▶ | if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%6/6
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and $s->[1] eq "Inline"
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2
MC/DC100%3/3
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and $s->[1] eq "Inline"
&any(sub {
$s->[0] eq $_;
}
, "use", "no")
scalar @$s > 2
$s->[1] eq "Inline"
Truth table100%4/4
A and B and C
A= &any(sub {
$s->[0] eq $_;
}
, "use", "no")B= scalar @$s > 2C= $s->[1] eq "Inline"
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | $s->[1] eq 'Inline') { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 10 | my ($version) = $s->[2] =~ $vre; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 10 | ▶ | $version //= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$version //= ""
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 10 | ▶ | my $voffset = $version ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 10 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 10 | ▶ | if (scalar(@$s) > $voffset) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | ▶ | return if $s->[$voffset] eq ';'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | @args = @$s; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 9 | @args = @args[($voffset) .. $#args]; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 9 | @args = stripquotelike(@args); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | my @modules; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 9 | ▶ | if ($args[0] =~ /config/io) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | return | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | } elsif ($args[0] =~ /with/io) { | |||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | push @modules, @args; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 5 | ▶ | push @modules, 'Inline::'.($langmap{$args[0]} // $args[0]) | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$langmap{$args[0]} // $args[0]
MC/DC0%0/2
$langmap{$args[0]} // $args[0]
$langmap{$args[0]}
$args[0]
Truth table66%2/3
A // B
A= $langmap{$args[0]}B= $args[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 8 | ▶ | if (any { $_ eq 'FILTERS' } @args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | push @modules, 'Inline::Filters' | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | return Tangerine::HookData->new( | ||||||||||||||||||||||||||||||||||||||||||
| 63 | modules => { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 8 | ( $_ => Tangerine::Occurence->new() ) | |||||||||||||||||||||||||||||||||||||||||
| 66 | } @modules, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 128 | return; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 16 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||||||||||||||||