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 'katetemplate.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.00 |
9
|
|
|
|
|
|
|
#kate version 2.3 |
10
|
|
|
|
|
|
|
#kate author Anders Lund |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Kate_File_Template; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1006
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
48
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
19
|
1
|
|
|
1
|
|
7
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
882
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
765
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
11
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
13
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
20
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
27
|
|
|
|
|
|
|
'Error' => 'Error', |
28
|
|
|
|
|
|
|
'Escape' => 'Others', |
29
|
|
|
|
|
|
|
'Header Keyword' => 'Operator', |
30
|
|
|
|
|
|
|
'Header Text' => 'Normal', |
31
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
32
|
|
|
|
|
|
|
'Macro' => 'DataType', |
33
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
34
|
|
|
|
|
|
|
'Property' => 'DecVal', |
35
|
|
|
|
|
|
|
'Property Value' => 'String', |
36
|
|
|
|
|
|
|
}); |
37
|
1
|
|
|
|
|
12
|
$self->listAdd('macros', |
38
|
|
|
|
|
|
|
'date', |
39
|
|
|
|
|
|
|
'datetime', |
40
|
|
|
|
|
|
|
'email', |
41
|
|
|
|
|
|
|
'month', |
42
|
|
|
|
|
|
|
'organisation', |
43
|
|
|
|
|
|
|
'realname', |
44
|
|
|
|
|
|
|
'time', |
45
|
|
|
|
|
|
|
'username', |
46
|
|
|
|
|
|
|
'year', |
47
|
|
|
|
|
|
|
); |
48
|
1
|
|
|
|
|
7
|
$self->listAdd('properties', |
49
|
|
|
|
|
|
|
'author', |
50
|
|
|
|
|
|
|
'description', |
51
|
|
|
|
|
|
|
'documentname', |
52
|
|
|
|
|
|
|
'group', |
53
|
|
|
|
|
|
|
'highlight', |
54
|
|
|
|
|
|
|
'icon', |
55
|
|
|
|
|
|
|
'template', |
56
|
|
|
|
|
|
|
); |
57
|
1
|
|
|
|
|
25
|
$self->contextdata({ |
58
|
|
|
|
|
|
|
'Normal Text' => { |
59
|
|
|
|
|
|
|
callback => \&parseNormalText, |
60
|
|
|
|
|
|
|
attribute => 'Normal Text', |
61
|
|
|
|
|
|
|
lineending => '#pop', |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
'escape' => { |
64
|
|
|
|
|
|
|
callback => \&parseescape, |
65
|
|
|
|
|
|
|
attribute => 'Escape', |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
'header' => { |
68
|
|
|
|
|
|
|
callback => \&parseheader, |
69
|
|
|
|
|
|
|
attribute => 'Comment', |
70
|
|
|
|
|
|
|
lineending => '#pop', |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
'headervalue' => { |
73
|
|
|
|
|
|
|
callback => \&parseheadervalue, |
74
|
|
|
|
|
|
|
attribute => 'Property Value', |
75
|
|
|
|
|
|
|
lineending => '#pop#pop', |
76
|
|
|
|
|
|
|
}, |
77
|
|
|
|
|
|
|
'macros' => { |
78
|
|
|
|
|
|
|
callback => \&parsemacros, |
79
|
|
|
|
|
|
|
attribute => 'Error', |
80
|
|
|
|
|
|
|
lineending => '#pop', |
81
|
|
|
|
|
|
|
}, |
82
|
|
|
|
|
|
|
}); |
83
|
1
|
|
|
|
|
9
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
84
|
1
|
|
|
|
|
5
|
$self->basecontext('Normal Text'); |
85
|
1
|
|
|
|
|
9
|
$self->keywordscase(0); |
86
|
1
|
|
|
|
|
3
|
$self->initialize; |
87
|
1
|
|
|
|
|
5
|
bless ($self, $class); |
88
|
1
|
|
|
|
|
5
|
return $self; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub language { |
92
|
0
|
|
|
0
|
0
|
|
return 'Kate File Template'; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub parseNormalText { |
96
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
97
|
|
|
|
|
|
|
# String => '^katetemplate:' |
98
|
|
|
|
|
|
|
# attribute => 'Header Keyword' |
99
|
|
|
|
|
|
|
# context => 'header' |
100
|
|
|
|
|
|
|
# type => 'RegExpr' |
101
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '^katetemplate:', 0, 0, 0, undef, 0, 'header', 'Header Keyword')) { |
102
|
0
|
|
|
|
|
|
return 1 |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
# String => '\\[$%]\{[^}\s]+\}' |
105
|
|
|
|
|
|
|
# attribute => 'Normal' |
106
|
|
|
|
|
|
|
# context => 'escape' |
107
|
|
|
|
|
|
|
# lookAhead => 'true' |
108
|
|
|
|
|
|
|
# type => 'RegExpr' |
109
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\\\[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'escape', 'Normal')) { |
110
|
0
|
|
|
|
|
|
return 1 |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
# String => '[$%]\{[^}\s]+\}' |
113
|
|
|
|
|
|
|
# attribute => 'Macro' |
114
|
|
|
|
|
|
|
# context => 'macros' |
115
|
|
|
|
|
|
|
# lookAhead => 'true' |
116
|
|
|
|
|
|
|
# type => 'RegExpr' |
117
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'macros', 'Macro')) { |
118
|
0
|
|
|
|
|
|
return 1 |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
# attribute => 'Escape' |
121
|
|
|
|
|
|
|
# char => '\' |
122
|
|
|
|
|
|
|
# char1 => '^' |
123
|
|
|
|
|
|
|
# context => '#stay' |
124
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
125
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '\\', '^', 0, 0, 0, undef, 0, '#stay', 'Escape')) { |
126
|
0
|
|
|
|
|
|
return 1 |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
# attribute => 'Keyword' |
129
|
|
|
|
|
|
|
# char => '^' |
130
|
|
|
|
|
|
|
# context => '#stay' |
131
|
|
|
|
|
|
|
# type => 'DetectChar' |
132
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
133
|
0
|
|
|
|
|
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
0
|
|
|
|
|
|
return 0; |
136
|
|
|
|
|
|
|
}; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub parseescape { |
139
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
140
|
|
|
|
|
|
|
# attribute => 'Escape' |
141
|
|
|
|
|
|
|
# char => '\' |
142
|
|
|
|
|
|
|
# char1 => '$' |
143
|
|
|
|
|
|
|
# context => '#pop' |
144
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
145
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '\\', '$', 0, 0, 0, undef, 0, '#pop', 'Escape')) { |
146
|
0
|
|
|
|
|
|
return 1 |
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
|
return 0; |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub parseheader { |
152
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
153
|
|
|
|
|
|
|
# String => 'properties' |
154
|
|
|
|
|
|
|
# attribute => 'Property' |
155
|
|
|
|
|
|
|
# context => 'headervalue' |
156
|
|
|
|
|
|
|
# type => 'keyword' |
157
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'properties', 0, undef, 0, 'headervalue', 'Property')) { |
158
|
0
|
|
|
|
|
|
return 1 |
159
|
|
|
|
|
|
|
} |
160
|
0
|
|
|
|
|
|
return 0; |
161
|
|
|
|
|
|
|
}; |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub parseheadervalue { |
164
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
165
|
|
|
|
|
|
|
# attribute => 'Header Text' |
166
|
|
|
|
|
|
|
# char => '=' |
167
|
|
|
|
|
|
|
# context => '#stay' |
168
|
|
|
|
|
|
|
# type => 'DetectChar' |
169
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#stay', 'Header Text')) { |
170
|
0
|
|
|
|
|
|
return 1 |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
# String => ' \w+\s*=' |
173
|
|
|
|
|
|
|
# context => '#pop' |
174
|
|
|
|
|
|
|
# lookAhead => 'true' |
175
|
|
|
|
|
|
|
# type => 'RegExpr' |
176
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' \\w+\\s*=', 0, 0, 1, undef, 0, '#pop', undef)) { |
177
|
0
|
|
|
|
|
|
return 1 |
178
|
|
|
|
|
|
|
} |
179
|
0
|
|
|
|
|
|
return 0; |
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub parsemacros { |
183
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
184
|
|
|
|
|
|
|
# attribute => 'Keyword' |
185
|
|
|
|
|
|
|
# char => '$' |
186
|
|
|
|
|
|
|
# char1 => '{' |
187
|
|
|
|
|
|
|
# context => '#stay' |
188
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
189
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
190
|
0
|
|
|
|
|
|
return 1 |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
# attribute => 'Keyword' |
193
|
|
|
|
|
|
|
# char => '%' |
194
|
|
|
|
|
|
|
# char1 => '{' |
195
|
|
|
|
|
|
|
# context => '#stay' |
196
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
197
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
198
|
0
|
|
|
|
|
|
return 1 |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
# attribute => 'Keyword' |
201
|
|
|
|
|
|
|
# char => '}' |
202
|
|
|
|
|
|
|
# context => '#pop' |
203
|
|
|
|
|
|
|
# type => 'DetectChar' |
204
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
205
|
0
|
|
|
|
|
|
return 1 |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
# String => '[^}\s]+' |
208
|
|
|
|
|
|
|
# attribute => 'Macro' |
209
|
|
|
|
|
|
|
# context => '#stay' |
210
|
|
|
|
|
|
|
# type => 'RegExpr' |
211
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[^}\\s]+', 0, 0, 0, undef, 0, '#stay', 'Macro')) { |
212
|
0
|
|
|
|
|
|
return 1 |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
# String => 'macros' |
215
|
|
|
|
|
|
|
# attribute => 'Keyword' |
216
|
|
|
|
|
|
|
# context => '#stay' |
217
|
|
|
|
|
|
|
# type => 'keyword' |
218
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'macros', 0, undef, 0, '#stay', 'Keyword')) { |
219
|
0
|
|
|
|
|
|
return 1 |
220
|
|
|
|
|
|
|
} |
221
|
0
|
|
|
|
|
|
return 0; |
222
|
|
|
|
|
|
|
}; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
1; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
__END__ |