line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tk::TextHighlight::Xresources; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22244
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.2'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
4
|
use base('Tk::TextHighlight::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
613
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my ($proto, $rules) = @_; |
11
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
12
|
0
|
0
|
|
|
|
|
if (not defined($rules)) { |
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
|
|
|
|
|
|
|
sub highlight { |
28
|
0
|
|
|
0
|
1
|
|
my ($hlt, $in) = @_; |
29
|
0
|
|
|
|
|
|
$hlt->snippet(''); |
30
|
0
|
|
|
|
|
|
my $out = $hlt->out; |
31
|
0
|
|
|
|
|
|
@$out = (); |
32
|
0
|
0
|
|
|
|
|
if ($in =~ /^(\s+!|!)/g) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$hlt->snippet($in); |
34
|
0
|
|
|
|
|
|
$hlt->tokenParse('Comment'); |
35
|
|
|
|
|
|
|
} elsif ($in =~ /^(\s+#|#)/g) { |
36
|
0
|
|
|
|
|
|
$hlt->snippet($in); |
37
|
0
|
|
|
|
|
|
$hlt->tokenParse('Command'); |
38
|
|
|
|
|
|
|
} elsif ($in =~ /([^:]+)(:)([^:]+)/g) { |
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
|
|
|
|
|
|
|
sub syntax { |
53
|
0
|
|
|
0
|
0
|
|
my $hlt = shift; |
54
|
0
|
|
|
|
|
|
return 'Xresources'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |