line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pistachio::Css::Github::Perl5; |
2
|
|
|
|
|
|
|
# ABSTRACT: provides type_to_style(), which turns Pistachio::Token types into CSS definitions |
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
27468
|
use strict; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
129
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
243
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.10'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
21
|
use Exporter 'import'; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
739
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = 'type_to_style'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# map Pistachio::Token type => css style |
12
|
|
|
|
|
|
|
my %type_to_style = ( |
13
|
|
|
|
|
|
|
'ArrayIndex' => 'color:#008080', |
14
|
|
|
|
|
|
|
'Cast' => 'color:#008080', |
15
|
|
|
|
|
|
|
'Cast::Reference' => 'color:#333;font-weight:bold', |
16
|
|
|
|
|
|
|
'Comment' => 'color:#999988;font-style:italic', |
17
|
|
|
|
|
|
|
'Label' => 'color:#333', |
18
|
|
|
|
|
|
|
'Magic' => 'color:#008080', |
19
|
|
|
|
|
|
|
'Magic::These' => 'color:#008080', |
20
|
|
|
|
|
|
|
'Magic::This' => 'color:#008080', |
21
|
|
|
|
|
|
|
'Number' => 'color:#008080', |
22
|
|
|
|
|
|
|
'Number::Float' => 'color:#008080', |
23
|
|
|
|
|
|
|
'Operator' => 'color:#333', |
24
|
|
|
|
|
|
|
'Operator::Dereference' => 'color:#333;font-weight:bold', |
25
|
|
|
|
|
|
|
'Operator::Wordish' => 'color:#333;font-weight:bold', |
26
|
|
|
|
|
|
|
'Prototype' => 'color:#333', |
27
|
|
|
|
|
|
|
'Quote::Double' => 'color:#D14', |
28
|
|
|
|
|
|
|
'Quote::Interpolate' => 'color:#D14', |
29
|
|
|
|
|
|
|
'Quote::Single' => 'color:#D14', |
30
|
|
|
|
|
|
|
'QuoteLike::Words' => 'color:#D14', |
31
|
|
|
|
|
|
|
'Regexp' => 'color:#009926', |
32
|
|
|
|
|
|
|
'Regexp::Match' => 'color:#009926', |
33
|
|
|
|
|
|
|
'Regexp::Substitute' => 'color:#009926', |
34
|
|
|
|
|
|
|
'Structure' => 'color:#333', |
35
|
|
|
|
|
|
|
'Symbol' => 'color:#008080', |
36
|
|
|
|
|
|
|
'Symbol::Sub' => 'color:#333', |
37
|
|
|
|
|
|
|
'Word::Coderef::Invoke' => 'color:#333', |
38
|
|
|
|
|
|
|
'Word::Constant' => 'color:#D14', |
39
|
|
|
|
|
|
|
'Word::Defined' => 'color:#333', |
40
|
|
|
|
|
|
|
'Word::Hashkey' => 'color:#333', |
41
|
|
|
|
|
|
|
'Word::Package' => 'color:#333', |
42
|
|
|
|
|
|
|
'Word::Require' => 'color:#333', |
43
|
|
|
|
|
|
|
'Word::Reserved' => 'color:#0086B3', |
44
|
|
|
|
|
|
|
'Word::Reserved::Keyword' => 'color:#333;font-weight:bold', |
45
|
|
|
|
|
|
|
'Word::Special::Literal' => 'color:#333', |
46
|
|
|
|
|
|
|
'Word::Sub::Define' => 'color:#990000;font-weight:bold', |
47
|
|
|
|
|
|
|
'Word::Sub::Invoke' => 'color:#333', |
48
|
|
|
|
|
|
|
'Word::Use' => 'color:#333', |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# @param string $type a Pistachio::Token type |
52
|
|
|
|
|
|
|
# @return string the type's css, or an empty string |
53
|
29
|
100
|
50
|
29
|
0
|
971
|
sub type_to_style { $type_to_style{$_[0] || ''} || '' } |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |