TextHighlight/Xresources.pm

filter: Statementstmt 28.9% 11 / 38 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 33.3% 1 / 3 totaltotal 25.0% 15 / 60 CC 6 SCAR 24.0
CC
6
Cov
22%
highlight
20.0
new
12.0
syntax
2.0
CRAP 11.0
« TextHighlight/Bash.pm ↑ Summary TextHighlight/Template.pm »
1 package Tk::TextHighlight::Xresources;
2  
3 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 $VERSION = '0.2';
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base('Tk::TextHighlight::Template');
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
10 0 my ($proto, $rules) = @_;
11 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
12 0 ▶ if (not defined($rules)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rules) 0 0 0
13 0 $rules = [
14 ['Comment', -foreground => 'lightblue'],
15 ['Path', -foreground => 'brown'],
16 ['Command', -foreground => 'blue'],
17 ['Separator', -foreground => 'darkblue'],
18 ['Value', -foreground => 'orange'],
19 ['False', -foreground => 'red'],
20 ];
21 };
22 0 my $self = $class->SUPER::new($rules);
23 0 bless ($self, $class);
24 0 return $self;
25 }
26  
27 0 ▶sub highlight {
Subroutine highlight: not called CC=4 SCAR=30.0
Pod documented
28 0 my ($hlt, $in) = @_;
29 0 $hlt->snippet('');
30 0 my $out = $hlt->out;
31 0 @$out = ();
32 0 ▶ if ($in =~ /^(\s+!|!)/go) {
Branch: 3 branches
BranchTrueFalseTotal
if ($in =~ /^(\s+!|!)/go) { } 0 0 0
elsif ($in =~ /^(\s+#|#)/go) { } 0 0 0
elsif ($in =~ /([^:]+)(:)([^:]+)/go) { } 0 0 0
33 0 $hlt->snippet($in);
34 0 $hlt->tokenParse('Comment');
35 } elsif ($in =~ /^(\s+#|#)/go) {
36 0 $hlt->snippet($in);
37 0 $hlt->tokenParse('Command');
38 } elsif ($in =~ /([^:]+)(:)([^:]+)/go) {
39 0 $hlt->snippet($1);
40 0 $hlt->tokenParse('Path');
41 0 $hlt->snippet($2);
42 0 $hlt->tokenParse('Separator');
43 0 $hlt->snippet($3);
44 0 $hlt->tokenParse('Value');
45 } else {
46 0 $hlt->snippet($in);
47 0 $hlt->tokenParse('False');
48 }
49 0 return @$out;
50 }
51  
52 0 ▶sub syntax {
Subroutine syntax: not called CC=1 SCAR=6.9
Pod undocumented
53 0 my $hlt = shift;
54 0 return 'Xresources';
55 }
56  
57 1 1;
58  
59 __END__
« TextHighlight/Bash.pm ↑ Summary TextHighlight/Template.pm »