line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. |
2
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
3
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This file was generated from the 'velocity.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.04 |
9
|
|
|
|
|
|
|
#kate version 2.1 |
10
|
|
|
|
|
|
|
#kate author John Christopher (John@animalsinneed.net) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Velocity; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
636
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
19
|
1
|
|
|
1
|
|
4
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
514
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
612
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
6
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
9
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
10
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
27
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
28
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
29
|
|
|
|
|
|
|
'Other' => 'Others', |
30
|
|
|
|
|
|
|
'Properties' => 'Normal', |
31
|
|
|
|
|
|
|
'Variable' => 'Keyword', |
32
|
|
|
|
|
|
|
}); |
33
|
1
|
|
|
|
|
6
|
$self->listAdd('keywords', |
34
|
|
|
|
|
|
|
'#else', |
35
|
|
|
|
|
|
|
'#elseif', |
36
|
|
|
|
|
|
|
'#end', |
37
|
|
|
|
|
|
|
'#foreach', |
38
|
|
|
|
|
|
|
'#if', |
39
|
|
|
|
|
|
|
'#include', |
40
|
|
|
|
|
|
|
'#macro', |
41
|
|
|
|
|
|
|
'#parse', |
42
|
|
|
|
|
|
|
'#set', |
43
|
|
|
|
|
|
|
'#stop', |
44
|
|
|
|
|
|
|
); |
45
|
1
|
|
|
|
|
12
|
$self->contextdata({ |
46
|
|
|
|
|
|
|
'Keyword' => { |
47
|
|
|
|
|
|
|
callback => \&parseKeyword, |
48
|
|
|
|
|
|
|
attribute => 'Normal Text', |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
'multilinecomment' => { |
51
|
|
|
|
|
|
|
callback => \&parsemultilinecomment, |
52
|
|
|
|
|
|
|
attribute => 'Comment', |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
'singleline comment' => { |
55
|
|
|
|
|
|
|
callback => \&parsesinglelinecomment, |
56
|
|
|
|
|
|
|
attribute => 'Comment', |
57
|
|
|
|
|
|
|
lineending => '#pop', |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
}); |
60
|
1
|
|
|
|
|
5
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|\\+'); |
61
|
1
|
|
|
|
|
5
|
$self->basecontext('Keyword'); |
62
|
1
|
|
|
|
|
6
|
$self->keywordscase(0); |
63
|
1
|
|
|
|
|
3
|
$self->initialize; |
64
|
1
|
|
|
|
|
2
|
bless ($self, $class); |
65
|
1
|
|
|
|
|
3
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub language { |
69
|
0
|
|
|
0
|
0
|
|
return 'Velocity'; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub parseKeyword { |
73
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
74
|
|
|
|
|
|
|
# String => 'keywords' |
75
|
|
|
|
|
|
|
# attribute => 'Keyword' |
76
|
|
|
|
|
|
|
# context => '#stay' |
77
|
|
|
|
|
|
|
# type => 'keyword' |
78
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
79
|
0
|
|
|
|
|
|
return 1 |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
# String => '\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\.\-]*(\[[a-zA-Z0-9_]*\])*' |
82
|
|
|
|
|
|
|
# attribute => 'Variable' |
83
|
|
|
|
|
|
|
# context => '#stay' |
84
|
|
|
|
|
|
|
# type => 'RegExpr' |
85
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\.\\-]*(\\[[a-zA-Z0-9_]*\\])*', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
86
|
0
|
|
|
|
|
|
return 1 |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
# String => '\$\{[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\.\-]*(\[[a-zA-Z0-9_]*\])*\}' |
89
|
|
|
|
|
|
|
# attribute => 'Variable' |
90
|
|
|
|
|
|
|
# context => '#stay' |
91
|
|
|
|
|
|
|
# type => 'RegExpr' |
92
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\$\\{[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\.\\-]*(\\[[a-zA-Z0-9_]*\\])*\\}', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
93
|
0
|
|
|
|
|
|
return 1 |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
# String => '\$!\{[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\.\-]*(\[[a-zA-Z0-9_]*\])*\}.' |
96
|
|
|
|
|
|
|
# attribute => 'Variable' |
97
|
|
|
|
|
|
|
# context => '#stay' |
98
|
|
|
|
|
|
|
# type => 'RegExpr' |
99
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\$!\\{[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\.\\-]*(\\[[a-zA-Z0-9_]*\\])*\\}.', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
100
|
0
|
|
|
|
|
|
return 1 |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
# String => '\{\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\.\-]*(\[([0-9]*|"[a-zA-Z_]*")|'[a-zA-Z_]*'|\])*(->[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(\[[a-zA-Z0-9_]*\])*(\[([0-9]*|"[a-zA-Z_]*")|'[a-zA-Z_]*'|\])*)*\}' |
103
|
|
|
|
|
|
|
# attribute => 'Variable' |
104
|
|
|
|
|
|
|
# context => '#stay' |
105
|
|
|
|
|
|
|
# type => 'RegExpr' |
106
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\{\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\.\\-]*(\\[([0-9]*|"[a-zA-Z_]*")|\'[a-zA-Z_]*\'|\\])*(->[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*(\\[[a-zA-Z0-9_]*\\])*(\\[([0-9]*|"[a-zA-Z_]*")|\'[a-zA-Z_]*\'|\\])*)*\\}', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
107
|
0
|
|
|
|
|
|
return 1 |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
# String => '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\-]*(\[[a-zA-Z0-9_]*\])*\.[a-zA-Z0-9_\x7f-\xff\-]*' |
110
|
|
|
|
|
|
|
# attribute => 'Properties' |
111
|
|
|
|
|
|
|
# context => '#stay' |
112
|
|
|
|
|
|
|
# type => 'RegExpr' |
113
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\-]*(\\[[a-zA-Z0-9_]*\\])*\\.[a-zA-Z0-9_\\x7f-\\xff\\-]*', 0, 0, 0, undef, 0, '#stay', 'Properties')) { |
114
|
0
|
|
|
|
|
|
return 1 |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
# String => '(),[]' |
117
|
|
|
|
|
|
|
# attribute => 'Other' |
118
|
|
|
|
|
|
|
# context => '#stay' |
119
|
|
|
|
|
|
|
# type => 'AnyChar' |
120
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, '(),[]', 0, 0, undef, 0, '#stay', 'Other')) { |
121
|
0
|
|
|
|
|
|
return 1 |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
# attribute => 'Comment' |
124
|
|
|
|
|
|
|
# char => '#' |
125
|
|
|
|
|
|
|
# char1 => '#' |
126
|
|
|
|
|
|
|
# context => 'singleline comment' |
127
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
128
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '#', '#', 0, 0, 0, undef, 0, 'singleline comment', 'Comment')) { |
129
|
0
|
|
|
|
|
|
return 1 |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
# attribute => 'Comment' |
132
|
|
|
|
|
|
|
# char => '#' |
133
|
|
|
|
|
|
|
# char1 => '*' |
134
|
|
|
|
|
|
|
# context => 'multilinecomment' |
135
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
136
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '#', '*', 0, 0, 0, undef, 0, 'multilinecomment', 'Comment')) { |
137
|
0
|
|
|
|
|
|
return 1 |
138
|
|
|
|
|
|
|
} |
139
|
0
|
|
|
|
|
|
return 0; |
140
|
|
|
|
|
|
|
}; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub parsemultilinecomment { |
143
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
144
|
|
|
|
|
|
|
# attribute => 'Comment' |
145
|
|
|
|
|
|
|
# char => '*' |
146
|
|
|
|
|
|
|
# char1 => '#' |
147
|
|
|
|
|
|
|
# context => '#pop' |
148
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
149
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '*', '#', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
150
|
0
|
|
|
|
|
|
return 1 |
151
|
|
|
|
|
|
|
} |
152
|
0
|
|
|
|
|
|
return 0; |
153
|
|
|
|
|
|
|
}; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub parsesinglelinecomment { |
156
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
157
|
0
|
|
|
|
|
|
return 0; |
158
|
|
|
|
|
|
|
}; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
1; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
__END__ |