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 'sieve.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.05 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Petter E. Stokke |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Sieve; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1056
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
18
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
19
|
1
|
|
|
1
|
|
6
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
942
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
734
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
9
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
12
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
17
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
27
|
|
|
|
|
|
|
'Decimal' => 'DecVal', |
28
|
|
|
|
|
|
|
'Function' => 'Function', |
29
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
30
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
31
|
|
|
|
|
|
|
'String' => 'String', |
32
|
|
|
|
|
|
|
'String Char' => 'Char', |
33
|
|
|
|
|
|
|
'Symbol' => 'Normal', |
34
|
|
|
|
|
|
|
'Tagged Argument' => 'Others', |
35
|
|
|
|
|
|
|
}); |
36
|
1
|
|
|
|
|
11
|
$self->listAdd('keywords', |
37
|
|
|
|
|
|
|
'discard', |
38
|
|
|
|
|
|
|
'else', |
39
|
|
|
|
|
|
|
'elsif', |
40
|
|
|
|
|
|
|
'fileinto', |
41
|
|
|
|
|
|
|
'if', |
42
|
|
|
|
|
|
|
'keep', |
43
|
|
|
|
|
|
|
'redirect', |
44
|
|
|
|
|
|
|
'reject', |
45
|
|
|
|
|
|
|
'require', |
46
|
|
|
|
|
|
|
'stop', |
47
|
|
|
|
|
|
|
); |
48
|
1
|
|
|
|
|
28
|
$self->contextdata({ |
49
|
|
|
|
|
|
|
'Comment' => { |
50
|
|
|
|
|
|
|
callback => \&parseComment, |
51
|
|
|
|
|
|
|
attribute => 'Comment', |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
'Member' => { |
54
|
|
|
|
|
|
|
callback => \&parseMember, |
55
|
|
|
|
|
|
|
attribute => 'Normal Text', |
56
|
|
|
|
|
|
|
lineending => '#pop', |
57
|
|
|
|
|
|
|
fallthrough => '#pop', |
58
|
|
|
|
|
|
|
}, |
59
|
|
|
|
|
|
|
'MultilineString' => { |
60
|
|
|
|
|
|
|
callback => \&parseMultilineString, |
61
|
|
|
|
|
|
|
attribute => 'String', |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
'Normal' => { |
64
|
|
|
|
|
|
|
callback => \&parseNormal, |
65
|
|
|
|
|
|
|
attribute => 'Normal Text', |
66
|
|
|
|
|
|
|
}, |
67
|
|
|
|
|
|
|
'String' => { |
68
|
|
|
|
|
|
|
callback => \&parseString, |
69
|
|
|
|
|
|
|
attribute => 'String', |
70
|
|
|
|
|
|
|
lineending => '#pop', |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
}); |
73
|
1
|
|
|
|
|
9
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
74
|
1
|
|
|
|
|
5
|
$self->basecontext('Normal'); |
75
|
1
|
|
|
|
|
10
|
$self->keywordscase(0); |
76
|
1
|
|
|
|
|
36
|
$self->initialize; |
77
|
1
|
|
|
|
|
3
|
bless ($self, $class); |
78
|
1
|
|
|
|
|
5
|
return $self; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub language { |
82
|
0
|
|
|
0
|
0
|
|
return 'Sieve'; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub parseComment { |
86
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
87
|
|
|
|
|
|
|
# attribute => 'Comment' |
88
|
|
|
|
|
|
|
# char => '*' |
89
|
|
|
|
|
|
|
# char1 => '/' |
90
|
|
|
|
|
|
|
# context => '#pop' |
91
|
|
|
|
|
|
|
# endRegion => 'Comment' |
92
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
93
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
94
|
0
|
|
|
|
|
|
return 1 |
95
|
|
|
|
|
|
|
} |
96
|
0
|
|
|
|
|
|
return 0; |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub parseMember { |
100
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
101
|
|
|
|
|
|
|
# String => '\b[_a-zA-Z]\w*(?=[\s]*)' |
102
|
|
|
|
|
|
|
# attribute => 'Function' |
103
|
|
|
|
|
|
|
# context => '#pop' |
104
|
|
|
|
|
|
|
# type => 'RegExpr' |
105
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\b[_a-zA-Z]\\w*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) { |
106
|
0
|
|
|
|
|
|
return 1 |
107
|
|
|
|
|
|
|
} |
108
|
0
|
|
|
|
|
|
return 0; |
109
|
|
|
|
|
|
|
}; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub parseMultilineString { |
112
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
113
|
|
|
|
|
|
|
# String => '\.$' |
114
|
|
|
|
|
|
|
# attribute => 'String' |
115
|
|
|
|
|
|
|
# column => '0' |
116
|
|
|
|
|
|
|
# context => '#pop' |
117
|
|
|
|
|
|
|
# type => 'RegExpr' |
118
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\.$', 0, 0, 0, 0, 0, '#pop', 'String')) { |
119
|
0
|
|
|
|
|
|
return 1 |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
# attribute => 'String Char' |
122
|
|
|
|
|
|
|
# context => '#stay' |
123
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
124
|
0
|
0
|
|
|
|
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
125
|
0
|
|
|
|
|
|
return 1 |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
|
|
|
return 0; |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub parseNormal { |
131
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
132
|
|
|
|
|
|
|
# String => 'keywords' |
133
|
|
|
|
|
|
|
# attribute => 'Keyword' |
134
|
|
|
|
|
|
|
# context => '#stay' |
135
|
|
|
|
|
|
|
# type => 'keyword' |
136
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
137
|
0
|
|
|
|
|
|
return 1 |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
# attribute => 'Symbol' |
140
|
|
|
|
|
|
|
# beginRegion => 'Brace1' |
141
|
|
|
|
|
|
|
# char => '{' |
142
|
|
|
|
|
|
|
# context => '#stay' |
143
|
|
|
|
|
|
|
# type => 'DetectChar' |
144
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
145
|
0
|
|
|
|
|
|
return 1 |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
# attribute => 'Symbol' |
148
|
|
|
|
|
|
|
# char => '}' |
149
|
|
|
|
|
|
|
# context => '#stay' |
150
|
|
|
|
|
|
|
# endRegion => 'Brace1' |
151
|
|
|
|
|
|
|
# type => 'DetectChar' |
152
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
153
|
0
|
|
|
|
|
|
return 1 |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
# String => '\d+[KMG]?' |
156
|
|
|
|
|
|
|
# attribute => 'Decimal' |
157
|
|
|
|
|
|
|
# context => '#stay' |
158
|
|
|
|
|
|
|
# type => 'RegExpr' |
159
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\d+[KMG]?', 0, 0, 0, undef, 0, '#stay', 'Decimal')) { |
160
|
0
|
|
|
|
|
|
return 1 |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
# attribute => 'String' |
163
|
|
|
|
|
|
|
# char => '"' |
164
|
|
|
|
|
|
|
# context => 'String' |
165
|
|
|
|
|
|
|
# type => 'DetectChar' |
166
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
167
|
0
|
|
|
|
|
|
return 1 |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
# String => 'text:$' |
170
|
|
|
|
|
|
|
# attribute => 'String' |
171
|
|
|
|
|
|
|
# beginRegion => 'String' |
172
|
|
|
|
|
|
|
# context => 'MultilineString' |
173
|
|
|
|
|
|
|
# type => 'RegExpr' |
174
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, 'text:$', 0, 0, 0, undef, 0, 'MultilineString', 'String')) { |
175
|
0
|
|
|
|
|
|
return 1 |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
# attribute => 'Comment' |
178
|
|
|
|
|
|
|
# beginRegion => 'Comment' |
179
|
|
|
|
|
|
|
# char => '/' |
180
|
|
|
|
|
|
|
# char1 => '*' |
181
|
|
|
|
|
|
|
# context => 'Comment' |
182
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
183
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
184
|
0
|
|
|
|
|
|
return 1 |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
# String => '#.*$' |
187
|
|
|
|
|
|
|
# attribute => 'Comment' |
188
|
|
|
|
|
|
|
# context => '#stay' |
189
|
|
|
|
|
|
|
# type => 'RegExpr' |
190
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { |
191
|
0
|
|
|
|
|
|
return 1 |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
# String => ':\w+' |
194
|
|
|
|
|
|
|
# attribute => 'Tagged Argument' |
195
|
|
|
|
|
|
|
# context => '#stay' |
196
|
|
|
|
|
|
|
# type => 'RegExpr' |
197
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ':\\w+', 0, 0, 0, undef, 0, '#stay', 'Tagged Argument')) { |
198
|
0
|
|
|
|
|
|
return 1 |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
# String => '[.]{1,1}' |
201
|
|
|
|
|
|
|
# attribute => 'Symbol' |
202
|
|
|
|
|
|
|
# context => 'Member' |
203
|
|
|
|
|
|
|
# type => 'RegExpr' |
204
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) { |
205
|
0
|
|
|
|
|
|
return 1 |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
# String => ':!%&()+,-/.*<=>?[]|~^;' |
208
|
|
|
|
|
|
|
# attribute => 'Symbol' |
209
|
|
|
|
|
|
|
# context => '#stay' |
210
|
|
|
|
|
|
|
# type => 'AnyChar' |
211
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) { |
212
|
0
|
|
|
|
|
|
return 1 |
213
|
|
|
|
|
|
|
} |
214
|
0
|
|
|
|
|
|
return 0; |
215
|
|
|
|
|
|
|
}; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub parseString { |
218
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
219
|
|
|
|
|
|
|
# attribute => 'String' |
220
|
|
|
|
|
|
|
# context => '#stay' |
221
|
|
|
|
|
|
|
# type => 'LineContinue' |
222
|
0
|
0
|
|
|
|
|
if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) { |
223
|
0
|
|
|
|
|
|
return 1 |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
# attribute => 'String Char' |
226
|
|
|
|
|
|
|
# context => '#stay' |
227
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
228
|
0
|
0
|
|
|
|
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
229
|
0
|
|
|
|
|
|
return 1 |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
# attribute => 'String' |
232
|
|
|
|
|
|
|
# char => '"' |
233
|
|
|
|
|
|
|
# context => '#pop' |
234
|
|
|
|
|
|
|
# type => 'DetectChar' |
235
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
236
|
0
|
|
|
|
|
|
return 1 |
237
|
|
|
|
|
|
|
} |
238
|
0
|
|
|
|
|
|
return 0; |
239
|
|
|
|
|
|
|
}; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
1; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
__END__ |