File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Email.pm
Criterion Covered Total %
statement 91 139 65.4
branch 69 116 59.4
condition 1 3 33.3
subroutine 5 6 83.3
pod 0 3 0.0
total 166 267 62.1


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 'email.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.4
10             #kate author Carl A Joslin (carl.joslin@joslin.dyndns.org)
11             #generated: Sun Feb 3 22:02:04 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::Email;
14              
15             our $VERSION = '0.14';
16              
17 1     1   501 use strict;
  1         3  
  1         23  
18 1     1   4 use warnings;
  1         2  
  1         21  
19 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1002  
20              
21             sub new {
22 2     2 0 540 my $proto = shift;
23 2   33     10 my $class = ref($proto) || $proto;
24 2         10 my $self = $class->SUPER::new(@_);
25 2         26 $self->attributes({
26             'Normal Text' => 'Normal',
27             'base64' => 'RegionMarker',
28             'common' => 'Keyword',
29             'email' => 'Function',
30             'indent1' => 'DataType',
31             'indent2' => 'DecVal',
32             'indent3' => 'Float',
33             'indent4' => 'BaseN',
34             'indent5' => 'BString',
35             'indent6' => 'Reserved',
36             'marker' => 'Alert',
37             'other' => 'Others',
38             'rfc' => 'Operator',
39             'rfc-main' => 'Alert',
40             'sign' => 'Comment',
41             'string' => 'String',
42             });
43 2         12 $self->contextdata({
44             'headder' => {
45             callback => \&parseheadder,
46             attribute => 'Normal Text',
47             },
48             });
49 2         7 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
50 2         6 $self->basecontext('headder');
51 2         8 $self->keywordscase(0);
52 2         5 $self->initialize;
53 2         3 bless ($self, $class);
54 2         10 return $self;
55             }
56              
57             sub language {
58 0     0 0 0 return 'Email';
59             }
60              
61             sub parseheadder {
62 4928     4928 0 7580 my ($self, $text) = @_;
63             # String => '^[Tt]o:.*$'
64             # attribute => 'rfc-main'
65             # context => '#stay'
66             # type => 'RegExpr'
67 4928 50       10557 if ($self->testRegExpr($text, '^[Tt]o:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
68 0         0 return 1
69             }
70             # String => '^[Ff]rom:.*$'
71             # attribute => 'rfc-main'
72             # context => '#stay'
73             # type => 'RegExpr'
74 4928 50       10416 if ($self->testRegExpr($text, '^[Ff]rom:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
75 0         0 return 1
76             }
77             # String => '^[Cc][Cc]:.*$'
78             # attribute => 'rfc-main'
79             # context => '#stay'
80             # type => 'RegExpr'
81 4928 50       10186 if ($self->testRegExpr($text, '^[Cc][Cc]:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
82 0         0 return 1
83             }
84             # String => '^[Bb][Cc][Cc]:.*$'
85             # attribute => 'rfc-main'
86             # context => '#stay'
87             # type => 'RegExpr'
88 4928 50       10591 if ($self->testRegExpr($text, '^[Bb][Cc][Cc]:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
89 0         0 return 1
90             }
91             # String => '^[Ss]ubject:.*$'
92             # attribute => 'rfc-main'
93             # context => '#stay'
94             # type => 'RegExpr'
95 4928 50       10949 if ($self->testRegExpr($text, '^[Ss]ubject:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
96 0         0 return 1
97             }
98             # String => '^[Dd]ate:.*$'
99             # attribute => 'rfc-main'
100             # context => '#stay'
101             # type => 'RegExpr'
102 4928 50       9960 if ($self->testRegExpr($text, '^[Dd]ate:.*$', 0, 0, 0, undef, 0, '#stay', 'rfc-main')) {
103 0         0 return 1
104             }
105             # String => '^[Ss]ender:'
106             # attribute => 'rfc'
107             # context => '#stay'
108             # type => 'RegExpr'
109 4928 50       10028 if ($self->testRegExpr($text, '^[Ss]ender:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
110 0         0 return 1
111             }
112             # String => '^[Rr]eply-[Tt]o:'
113             # attribute => 'rfc'
114             # context => '#stay'
115             # type => 'RegExpr'
116 4928 50       10648 if ($self->testRegExpr($text, '^[Rr]eply-[Tt]o:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
117 0         0 return 1
118             }
119             # String => '^[Mm]essage-[Ii][Dd]:'
120             # attribute => 'rfc'
121             # context => '#stay'
122             # type => 'RegExpr'
123 4928 100       10275 if ($self->testRegExpr($text, '^[Mm]essage-[Ii][Dd]:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
124 2         5 return 1
125             }
126             # String => '^[Ii]n-[Rr]eply-[Tt]o:'
127             # attribute => 'rfc'
128             # context => '#stay'
129             # type => 'RegExpr'
130 4926 50       10550 if ($self->testRegExpr($text, '^[Ii]n-[Rr]eply-[Tt]o:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
131 0         0 return 1
132             }
133             # String => '^[Rr]eferences:'
134             # attribute => 'rfc'
135             # context => '#stay'
136             # type => 'RegExpr'
137 4926 50       10395 if ($self->testRegExpr($text, '^[Rr]eferences:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
138 0         0 return 1
139             }
140             # String => '^[Cc]omments:'
141             # attribute => 'rfc'
142             # context => '#stay'
143             # type => 'RegExpr'
144 4926 50       10158 if ($self->testRegExpr($text, '^[Cc]omments:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
145 0         0 return 1
146             }
147             # String => '^[Kk]eywors:'
148             # attribute => 'rfc'
149             # context => '#stay'
150             # type => 'RegExpr'
151 4926 50       9443 if ($self->testRegExpr($text, '^[Kk]eywors:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
152 0         0 return 1
153             }
154             # String => '^[Rr]esent-[Dd]ate:'
155             # attribute => 'rfc'
156             # context => '#stay'
157             # type => 'RegExpr'
158 4926 50       9360 if ($self->testRegExpr($text, '^[Rr]esent-[Dd]ate:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
159 0         0 return 1
160             }
161             # String => '^[Rr]esent-[Ff]rom:'
162             # attribute => 'rfc'
163             # context => '#stay'
164             # type => 'RegExpr'
165 4926 50       10059 if ($self->testRegExpr($text, '^[Rr]esent-[Ff]rom:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
166 0         0 return 1
167             }
168             # String => '^[Rr]esent-[Ss]ender:'
169             # attribute => 'rfc'
170             # context => '#stay'
171             # type => 'RegExpr'
172 4926 50       10409 if ($self->testRegExpr($text, '^[Rr]esent-[Ss]ender:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
173 0         0 return 1
174             }
175             # String => '^[Rr]esent-[Tt]o:'
176             # attribute => 'rfc'
177             # context => '#stay'
178             # type => 'RegExpr'
179 4926 50       9664 if ($self->testRegExpr($text, '^[Rr]esent-[Tt]o:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
180 0         0 return 1
181             }
182             # String => '^[Rr]esent-[Cc][Cc]:'
183             # attribute => 'rfc'
184             # context => '#stay'
185             # type => 'RegExpr'
186 4926 50       10061 if ($self->testRegExpr($text, '^[Rr]esent-[Cc][Cc]:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
187 0         0 return 1
188             }
189             # String => '^[Rr]esent-[Bb][Cc][Cc]:'
190             # attribute => 'rfc'
191             # context => '#stay'
192             # type => 'RegExpr'
193 4926 50       10188 if ($self->testRegExpr($text, '^[Rr]esent-[Bb][Cc][Cc]:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
194 0         0 return 1
195             }
196             # String => '^[Rr]esent-[Mm]essage-[Ii][Dd]:'
197             # attribute => 'rfc'
198             # context => '#stay'
199             # type => 'RegExpr'
200 4926 50       9673 if ($self->testRegExpr($text, '^[Rr]esent-[Mm]essage-[Ii][Dd]:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
201 0         0 return 1
202             }
203             # String => '^[Rr]esent-[Rr]eply-[Tt]o:'
204             # attribute => 'rfc'
205             # context => '#stay'
206             # type => 'RegExpr'
207 4926 50       9467 if ($self->testRegExpr($text, '^[Rr]esent-[Rr]eply-[Tt]o:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
208 0         0 return 1
209             }
210             # String => '^[Rr]eturn-[Pp]ath:'
211             # attribute => 'rfc'
212             # context => '#stay'
213             # type => 'RegExpr'
214 4926 100       9995 if ($self->testRegExpr($text, '^[Rr]eturn-[Pp]ath:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
215 2         6 return 1
216             }
217             # String => '^[Rr]eceived:'
218             # attribute => 'rfc'
219             # context => '#stay'
220             # type => 'RegExpr'
221 4924 100       9858 if ($self->testRegExpr($text, '^[Rr]eceived:', 0, 0, 0, undef, 0, '#stay', 'rfc')) {
222 10         28 return 1
223             }
224             # String => '^[Xx]-[Mm]ozilla-[Ss]tatus:'
225             # attribute => 'common'
226             # context => '#stay'
227             # type => 'RegExpr'
228 4914 50       9934 if ($self->testRegExpr($text, '^[Xx]-[Mm]ozilla-[Ss]tatus:', 0, 0, 0, undef, 0, '#stay', 'common')) {
229 0         0 return 1
230             }
231             # String => '^[Xx]-[Mm]ozilla-[Ss]tatus2:'
232             # attribute => 'common'
233             # context => '#stay'
234             # type => 'RegExpr'
235 4914 50       10142 if ($self->testRegExpr($text, '^[Xx]-[Mm]ozilla-[Ss]tatus2:', 0, 0, 0, undef, 0, '#stay', 'common')) {
236 0         0 return 1
237             }
238             # String => '^[Ee]nverlope-[Tt]o:'
239             # attribute => 'common'
240             # context => '#stay'
241             # type => 'RegExpr'
242 4914 50       9933 if ($self->testRegExpr($text, '^[Ee]nverlope-[Tt]o:', 0, 0, 0, undef, 0, '#stay', 'common')) {
243 0         0 return 1
244             }
245             # String => '^[Dd]elivery-[Dd]ate:'
246             # attribute => 'common'
247             # context => '#stay'
248             # type => 'RegExpr'
249 4914 50       9824 if ($self->testRegExpr($text, '^[Dd]elivery-[Dd]ate:', 0, 0, 0, undef, 0, '#stay', 'common')) {
250 0         0 return 1
251             }
252             # String => '^[Xx]-[Oo]riginating-[Ii][Pp]:'
253             # attribute => 'common'
254             # context => '#stay'
255             # type => 'RegExpr'
256 4914 50       9654 if ($self->testRegExpr($text, '^[Xx]-[Oo]riginating-[Ii][Pp]:', 0, 0, 0, undef, 0, '#stay', 'common')) {
257 0         0 return 1
258             }
259             # String => '^[Xx]-[Oo]riginating-[Ee]mail:'
260             # attribute => 'common'
261             # context => '#stay'
262             # type => 'RegExpr'
263 4914 50       10063 if ($self->testRegExpr($text, '^[Xx]-[Oo]riginating-[Ee]mail:', 0, 0, 0, undef, 0, '#stay', 'common')) {
264 0         0 return 1
265             }
266             # String => '^[Xx]-[Ss]ender:'
267             # attribute => 'common'
268             # context => '#stay'
269             # type => 'RegExpr'
270 4914 50       10019 if ($self->testRegExpr($text, '^[Xx]-[Ss]ender:', 0, 0, 0, undef, 0, '#stay', 'common')) {
271 0         0 return 1
272             }
273             # String => '^[Mm]ime-[Vv]ersion:'
274             # attribute => 'common'
275             # context => '#stay'
276             # type => 'RegExpr'
277 4914 50       9499 if ($self->testRegExpr($text, '^[Mm]ime-[Vv]ersion:', 0, 0, 0, undef, 0, '#stay', 'common')) {
278 0         0 return 1
279             }
280             # String => '^[Cc]ontent-[Tt]ype:'
281             # attribute => 'common'
282             # context => '#stay'
283             # type => 'RegExpr'
284 4914 100       9512 if ($self->testRegExpr($text, '^[Cc]ontent-[Tt]ype:', 0, 0, 0, undef, 0, '#stay', 'common')) {
285 10         28 return 1
286             }
287             # String => '^[Xx]-[Mm]ailing-[Ll]ist:'
288             # attribute => 'common'
289             # context => '#stay'
290             # type => 'RegExpr'
291 4904 50       9505 if ($self->testRegExpr($text, '^[Xx]-[Mm]ailing-[Ll]ist:', 0, 0, 0, undef, 0, '#stay', 'common')) {
292 0         0 return 1
293             }
294             # String => '^[Xx]-[Ll]oop:'
295             # attribute => 'common'
296             # context => '#stay'
297             # type => 'RegExpr'
298 4904 50       9543 if ($self->testRegExpr($text, '^[Xx]-[Ll]oop:', 0, 0, 0, undef, 0, '#stay', 'common')) {
299 0         0 return 1
300             }
301             # String => '^[Ll]ist-[Pp]ost:'
302             # attribute => 'common'
303             # context => '#stay'
304             # type => 'RegExpr'
305 4904 50       10402 if ($self->testRegExpr($text, '^[Ll]ist-[Pp]ost:', 0, 0, 0, undef, 0, '#stay', 'common')) {
306 0         0 return 1
307             }
308             # String => '^[Ll]ist-[Hh]elp:'
309             # attribute => 'common'
310             # context => '#stay'
311             # type => 'RegExpr'
312 4904 50       9449 if ($self->testRegExpr($text, '^[Ll]ist-[Hh]elp:', 0, 0, 0, undef, 0, '#stay', 'common')) {
313 0         0 return 1
314             }
315             # String => '^[Ll]ist-[Uu]nsubscribe:'
316             # attribute => 'common'
317             # context => '#stay'
318             # type => 'RegExpr'
319 4904 50       10069 if ($self->testRegExpr($text, '^[Ll]ist-[Uu]nsubscribe:', 0, 0, 0, undef, 0, '#stay', 'common')) {
320 0         0 return 1
321             }
322             # String => '^[Pp]recedence:'
323             # attribute => 'common'
324             # context => '#stay'
325             # type => 'RegExpr'
326 4904 50       9443 if ($self->testRegExpr($text, '^[Pp]recedence:', 0, 0, 0, undef, 0, '#stay', 'common')) {
327 0         0 return 1
328             }
329             # String => '^[Cc]ontent-[Tt]ransfer-[Ee]ncoding:'
330             # attribute => 'common'
331             # context => '#stay'
332             # type => 'RegExpr'
333 4904 100       9402 if ($self->testRegExpr($text, '^[Cc]ontent-[Tt]ransfer-[Ee]ncoding:', 0, 0, 0, undef, 0, '#stay', 'common')) {
334 6         16 return 1
335             }
336             # String => '^[Cc]ontent-[Tt]ype:'
337             # attribute => 'common'
338             # context => '#stay'
339             # type => 'RegExpr'
340 4898 50       9901 if ($self->testRegExpr($text, '^[Cc]ontent-[Tt]ype:', 0, 0, 0, undef, 0, '#stay', 'common')) {
341 0         0 return 1
342             }
343             # String => '^[Xx]-[Bb]ulkmail:'
344             # attribute => 'common'
345             # context => '#stay'
346             # type => 'RegExpr'
347 4898 50       9944 if ($self->testRegExpr($text, '^[Xx]-[Bb]ulkmail:', 0, 0, 0, undef, 0, '#stay', 'common')) {
348 0         0 return 1
349             }
350             # String => '^[Pp]recedence:'
351             # attribute => 'common'
352             # context => '#stay'
353             # type => 'RegExpr'
354 4898 50       9544 if ($self->testRegExpr($text, '^[Pp]recedence:', 0, 0, 0, undef, 0, '#stay', 'common')) {
355 0         0 return 1
356             }
357             # String => '^[Cc]ontent-[Dd]isposition:'
358             # attribute => 'common'
359             # context => '#stay'
360             # type => 'RegExpr'
361 4898 50       9616 if ($self->testRegExpr($text, '^[Cc]ontent-[Dd]isposition:', 0, 0, 0, undef, 0, '#stay', 'common')) {
362 0         0 return 1
363             }
364             # String => '^[0-9a-zA-Z-.]+:'
365             # attribute => 'other'
366             # context => '#stay'
367             # type => 'RegExpr'
368 4898 100       9366 if ($self->testRegExpr($text, '^[0-9a-zA-Z-.]+:', 0, 0, 0, undef, 0, '#stay', 'other')) {
369 34         90 return 1
370             }
371             # String => '[a-zA-Z0-9.\-]+\@[a-zA-Z0-9.\-]+'
372             # attribute => 'email'
373             # context => '#stay'
374             # type => 'RegExpr'
375 4864 100       10536 if ($self->testRegExpr($text, '[a-zA-Z0-9.\\-]+\\@[a-zA-Z0-9.\\-]+', 0, 0, 0, undef, 0, '#stay', 'email')) {
376 20         54 return 1
377             }
378             # String => '[a-zA-Z0-9.\-]*\s*<[a-zA-Z0-9.\-]+\@[a-zA-Z0-9.\-]+>'
379             # attribute => 'email'
380             # context => '#stay'
381             # type => 'RegExpr'
382 4844 100       10942 if ($self->testRegExpr($text, '[a-zA-Z0-9.\\-]*\\s*<[a-zA-Z0-9.\\-]+\\@[a-zA-Z0-9.\\-]+>', 0, 0, 0, undef, 0, '#stay', 'email')) {
383 6         14 return 1
384             }
385             # String => '"[a-zA-Z0-9. \-]+"\s*<[a-zA-Z0-9.\-]+\@[a-zA-Z0-9.\-]+>'
386             # attribute => 'email'
387             # context => '#stay'
388             # type => 'RegExpr'
389 4838 100       11412 if ($self->testRegExpr($text, '"[a-zA-Z0-9. \\-]+"\\s*<[a-zA-Z0-9.\\-]+\\@[a-zA-Z0-9.\\-]+>', 0, 0, 0, undef, 0, '#stay', 'email')) {
390 2         7 return 1
391             }
392             # String => '".*"'
393             # attribute => 'string'
394             # context => '#stay'
395             # type => 'RegExpr'
396 4836 100       11073 if ($self->testRegExpr($text, '".*"', 0, 0, 0, undef, 0, '#stay', 'string')) {
397 20         51 return 1
398             }
399             # String => ''.*''
400             # attribute => 'string'
401             # context => '#stay'
402             # type => 'RegExpr'
403 4816 50       10457 if ($self->testRegExpr($text, '\'.*\'', 0, 0, 0, undef, 0, '#stay', 'string')) {
404 0         0 return 1
405             }
406             # String => '^[|>]\s*[|>]\s*[|>]\s*[|>]\s*[|>]\s*[|>].*'
407             # attribute => 'indent6'
408             # context => '#stay'
409             # type => 'RegExpr'
410 4816 50       10669 if ($self->testRegExpr($text, '^[|>]\\s*[|>]\\s*[|>]\\s*[|>]\\s*[|>]\\s*[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent6')) {
411 0         0 return 1
412             }
413             # String => '^[|>]\s*[|>]\s*[|>]\s*[|>]\s*[|>].*'
414             # attribute => 'indent5'
415             # context => '#stay'
416             # type => 'RegExpr'
417 4816 50       10293 if ($self->testRegExpr($text, '^[|>]\\s*[|>]\\s*[|>]\\s*[|>]\\s*[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent5')) {
418 0         0 return 1
419             }
420             # String => '^[|>]\s*[|>]\s*[|>]\s*[|>].*'
421             # attribute => 'indent4'
422             # context => '#stay'
423             # type => 'RegExpr'
424 4816 50       9765 if ($self->testRegExpr($text, '^[|>]\\s*[|>]\\s*[|>]\\s*[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent4')) {
425 0         0 return 1
426             }
427             # String => '^[|>]\s*[|>]\s*[|>].*'
428             # attribute => 'indent3'
429             # context => '#stay'
430             # type => 'RegExpr'
431 4816 50       9557 if ($self->testRegExpr($text, '^[|>]\\s*[|>]\\s*[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent3')) {
432 0         0 return 1
433             }
434             # String => '^[|>]\s*[|>].*'
435             # attribute => 'indent2'
436             # context => '#stay'
437             # type => 'RegExpr'
438 4816 50       9538 if ($self->testRegExpr($text, '^[|>]\\s*[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent2')) {
439 0         0 return 1
440             }
441             # String => '^[|>].*'
442             # attribute => 'indent1'
443             # context => '#stay'
444             # type => 'RegExpr'
445 4816 50       9734 if ($self->testRegExpr($text, '^[|>].*', 0, 0, 0, undef, 0, '#stay', 'indent1')) {
446 0         0 return 1
447             }
448             # String => '^([A-Za-z0-9+/][A-Za-z0-9+/][A-Za-z0-9+/][A-Za-z0-9+/]){10,20}$'
449             # attribute => 'base64'
450             # context => '#stay'
451             # type => 'RegExpr'
452 4816 50       9226 if ($self->testRegExpr($text, '^([A-Za-z0-9+/][A-Za-z0-9+/][A-Za-z0-9+/][A-Za-z0-9+/]){10,20}$', 0, 0, 0, undef, 0, '#stay', 'base64')) {
453 0         0 return 1
454             }
455             # String => '^[A-Za-z0-9+=/]+=$'
456             # attribute => 'base64'
457             # context => '#stay'
458             # type => 'RegExpr'
459 4816 50       9227 if ($self->testRegExpr($text, '^[A-Za-z0-9+=/]+=$', 0, 0, 0, undef, 0, '#stay', 'base64')) {
460 0         0 return 1
461             }
462             # String => '^(- )?--(--.*)?'
463             # attribute => 'marker'
464             # context => '#stay'
465             # type => 'RegExpr'
466 4816 100       9553 if ($self->testRegExpr($text, '^(- )?--(--.*)?', 0, 0, 0, undef, 0, '#stay', 'marker')) {
467 12         41 return 1
468             }
469 4804         8955 return 0;
470             };
471              
472              
473             1;
474              
475             __END__