Kate/Haskell.pm

filter: Statementstmt 91.7% 78 / 85 Branchbran 90.4% 38 / 42 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 9 totaltotal 83.0% 127 / 153 CC 23 SCAR 20.8
CC
23
Cov
90%
parsenormal
15.0
parsefunction_definition
6.0
parsestring
3.1
CRAP 8.0
« Kate/AWK.pm ↑ Summary Kate/Literate_Haskell.pm »
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 'haskell.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.3
10 #kate author Marcel Martin (mmar@freenet.de)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
12  
13 package Syntax::Highlight::Engine::Kate::Haskell;
14  
15 1 our $VERSION = '0.16';
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use base('Syntax::Highlight::Engine::Kate::Template');
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
22 2 my $proto = shift;
23 2 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
24 2 my $self = $class->SUPER::new(@_);
25 2 $self->attributes({
26 'Char' => 'Char',
27 'Class' => 'Keyword',
28 'Comment' => 'Comment',
29 'Constructor' => 'Others',
30 'Data Constructor' => 'Keyword',
31 'Decimal' => 'DecVal',
32 'Float' => 'Float',
33 'Function' => 'Function',
34 'Function Definition' => 'Function',
35 'Infix Operator' => 'Others',
36 'Keyword' => 'Keyword',
37 'Normal Text' => 'Normal',
38 'String' => 'String',
39 'Type Constructor' => 'DataType',
40 });
41 2 $self->listAdd('classes',
42 'Bounded',
43 'Enum',
44 'Eq',
45 'Floating',
46 'Fractional',
47 'Functor',
48 'Integral',
49 'Ix',
50 'Monad',
51 'Num',
52 'Ord',
53 'Read',
54 'Real',
55 'RealFloat',
56 'RealFrac',
57 'Show',
58 );
59 2 $self->listAdd('data constructors',
60 'EQ',
61 'False',
62 'GT',
63 'Just',
64 'LT',
65 'Left',
66 'Nothing',
67 'Right',
68 'True',
69 );
70 2 $self->listAdd('functions',
71 'FilePath',
72 'IOError',
73 'abs',
74 'acos',
75 'acosh',
76 'all',
77 'and',
78 'any',
79 'appendFile',
80 'approxRational',
81 'asTypeOf',
82 'asin',
83 'asinh',
84 'atan',
85 'atan2',
86 'atanh',
87 'basicIORun',
88 'break',
89 'catch',
90 'ceiling',
91 'chr',
92 'compare',
93 'concat',
94 'concatMap',
95 'const',
96 'cos',
97 'cosh',
98 'curry',
99 'cycle',
100 'decodeFloat',
101 'denominator',
102 'digitToInt',
103 'div',
104 'divMod',
105 'drop',
106 'dropWhile',
107 'either',
108 'elem',
109 'encodeFloat',
110 'enumFrom',
111 'enumFromThen',
112 'enumFromThenTo',
113 'enumFromTo',
114 'error',
115 'even',
116 'exp',
117 'exponent',
118 'fail',
119 'filter',
120 'flip',
121 'floatDigits',
122 'floatRadix',
123 'floatRange',
124 'floor',
125 'fmap',
126 'foldl',
127 'foldl1',
128 'foldr',
129 'foldr1',
130 'fromDouble',
131 'fromEnum',
132 'fromInt',
133 'fromInteger',
134 'fromIntegral',
135 'fromRational',
136 'fst',
137 'gcd',
138 'getChar',
139 'getContents',
140 'getLine',
141 'head',
142 'id',
143 'inRange',
144 'index',
145 'init',
146 'intToDigit',
147 'interact',
148 'ioError',
149 'isAlpha',
150 'isAlphaNum',
151 'isAscii',
152 'isControl',
153 'isDenormalized',
154 'isDigit',
155 'isHexDigit',
156 'isIEEE',
157 'isInfinite',
158 'isLower',
159 'isNaN',
160 'isNegativeZero',
161 'isOctDigit',
162 'isPrint',
163 'isSpace',
164 'isUpper',
165 'iterate',
166 'last',
167 'lcm',
168 'length',
169 'lex',
170 'lexDigits',
171 'lexLitChar',
172 'lines',
173 'log',
174 'logBase',
175 'lookup',
176 'map',
177 'mapM',
178 'mapM_',
179 'max',
180 'maxBound',
181 'maximum',
182 'maybe',
183 'min',
184 'minBound',
185 'minimum',
186 'mod',
187 'negate',
188 'not',
189 'notElem',
190 'null',
191 'numerator',
192 'odd',
193 'or',
194 'ord',
195 'otherwise',
196 'pi',
197 'pred',
198 'primExitWith',
199 'print',
200 'product',
201 'properFraction',
202 'putChar',
203 'putStr',
204 'putStrLn',
205 'quot',
206 'quotRem',
207 'range',
208 'rangeSize',
209 'read',
210 'readDec',
211 'readFile',
212 'readFloat',
213 'readHex',
214 'readIO',
215 'readInt',
216 'readList',
217 'readLitChar',
218 'readLn',
219 'readOct',
220 'readParen',
221 'readSigned',
222 'reads',
223 'readsPrec',
224 'realToFrac',
225 'recip',
226 'rem',
227 'repeat',
228 'replicate',
229 'return',
230 'reverse',
231 'round',
232 'scaleFloat',
233 'scanl',
234 'scanl1',
235 'scanr',
236 'scanr1',
237 'seq',
238 'sequence',
239 'sequence_',
240 'show',
241 'showChar',
242 'showInt',
243 'showList',
244 'showLitChar',
245 'showParen',
246 'showSigned',
247 'showString',
248 'shows',
249 'showsPrec',
250 'significand',
251 'signum',
252 'sin',
253 'sinh',
254 'snd',
255 'span',
256 'splitAt',
257 'sqrt',
258 'subtract',
259 'succ',
260 'sum',
261 'tail',
262 'take',
263 'takeWhile',
264 'tan',
265 'tanh',
266 'threadToIOResult',
267 'toEnum',
268 'toInt',
269 'toInteger',
270 'toLower',
271 'toRational',
272 'toUpper',
273 'truncate',
274 'uncurry',
275 'undefined',
276 'unlines',
277 'until',
278 'unwords',
279 'unzip',
280 'unzip3',
281 'userError',
282 'words',
283 'writeFile',
284 'zip',
285 'zip3',
286 'zipWith',
287 'zipWith3',
288 );
289 2 $self->listAdd('infix operators',
290 'div',
291 'elem',
292 'mod',
293 'notElem',
294 'quot',
295 'rem',
296 'seq',
297 );
298 2 $self->listAdd('keywords',
299 'case',
300 'class',
301 'data',
302 'deriving',
303 'do',
304 'else',
305 'if',
306 'in',
307 'infixl',
308 'infixr',
309 'instance',
310 'let',
311 'module',
312 'of',
313 'primitive',
314 'then',
315 'type',
316 'where',
317 );
318 2 $self->listAdd('type constructors',
319 'Bool',
320 'Char',
321 'Double',
322 'Either',
323 'Float',
324 'IO',
325 'Int',
326 'Integer',
327 'Maybe',
328 'Ordering',
329 'Ratio',
330 'Rational',
331 'ReadS',
332 'ShowS',
333 'String',
334 );
335 2 $self->contextdata({
336 'comment_multi_line' => {
337 callback => \&parsecomment_multi_line,
338 attribute => 'Comment',
339 },
340 'comment_single_line' => {
341 callback => \&parsecomment_single_line,
342 attribute => 'Comment',
343 lineending => '#pop',
344 },
345 'function_definition' => {
346 callback => \&parsefunction_definition,
347 attribute => 'Function Definition',
348 lineending => '#pop',
349 },
350 'infix' => {
351 callback => \&parseinfix,
352 attribute => 'Infix Operator',
353 },
354 'normal' => {
355 callback => \&parsenormal,
356 attribute => 'Normal Text',
357 },
358 'single_char' => {
359 callback => \&parsesingle_char,
360 attribute => 'Char',
361 lineending => '#pop',
362 },
363 'string' => {
364 callback => \&parsestring,
365 attribute => 'String',
366 },
367 });
368 2 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
369 2 $self->basecontext('normal');
370 2 $self->keywordscase(0);
371 2 $self->initialize;
372 2 bless ($self, $class);
373 2 return $self;
374 }
375  
376 0 ▶sub language {
Subroutine language: not called CC=1 SCAR=6.9
Pod undocumented
377 0 return 'Haskell';
378 }
379  
380 292 ▶sub parsecomment_multi_line {
Subroutine parsecomment_multi_line: called CC=2 SCAR=6.9
Pod undocumented
381 292 my ($self, $text) = @_;
382 # attribute => 'Comment'
383 # char => '-'
384 # char1 => '}'
385 # context => '#pop'
386 # type => 'Detect2Chars'
387 292 ▶ if ($self->testDetect2Chars($text, '-', '}', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "-", "}", 0, 0, 0, undef, 0, "#pop", "Comment")) 2 290 292
388 2 return 1
389 }
390 290 return 0;
391 };
392  
393 36 ▶sub parsecomment_single_line {
Subroutine parsecomment_single_line: called CC=1 SCAR=0.0
Pod undocumented
394 36 my ($self, $text) = @_;
395 36 return 0;
396 };
397  
398 0 ▶sub parsefunction_definition {
Subroutine parsefunction_definition: not called CC=2 SCAR=17.9
Pod undocumented
399 0 my ($self, $text) = @_;
400 # attribute => 'Function Definition'
401 # char => ';'
402 # context => '#pop'
403 # type => 'DetectChar'
404 0 ▶ if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Function Definition')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, ";", 0, 0, 0, undef, 0, "#pop", "Function Definition")) 0 0 0
405 0 return 1
406 }
407 0 return 0;
408 };
409  
410 50 ▶sub parseinfix {
Subroutine parseinfix: called CC=2 SCAR=6.9
Pod undocumented
411 50 my ($self, $text) = @_;
412 # attribute => 'Infix Operator'
413 # char => '`'
414 # context => '#pop'
415 # type => 'DetectChar'
416 50 ▶ if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'Infix Operator')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "`", 0, 0, 0, undef, 0, "#pop", "Infix Operator")) 12 38 50
417 12 return 1
418 }
419 38 return 0;
420 };
421  
422 4596 ▶sub parsenormal {
Subroutine parsenormal: called CC=15 SCAR=27.1
Pod undocumented
423 4596 my ($self, $text) = @_;
424 # attribute => 'Comment'
425 # char => '{'
426 # char1 => '-'
427 # context => 'comment_multi_line'
428 # type => 'Detect2Chars'
429 4596 ▶ if ($self->testDetect2Chars($text, '{', '-', 0, 0, 0, undef, 0, 'comment_multi_line', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "{", "-", 0, 0, 0, undef, 0, "comment_multi_line", "Comment")) 2 4594 4596
430 2 return 1
431 }
432 # attribute => 'Comment'
433 # char => '-'
434 # char1 => '-'
435 # context => 'comment_single_line'
436 # type => 'Detect2Chars'
437 4594 ▶ if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, 'comment_single_line', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "-", "-", 0, 0, 0, undef, 0, "comment_single_line", "Comment")) 2 4592 4594
438 2 return 1
439 }
440 # String => 'keywords'
441 # attribute => 'Keyword'
442 # context => '#stay'
443 # type => 'keyword'
444 4592 ▶ if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "keywords", 0, undef, 0, "#stay", "Keyword")) 64 4528 4592
445 64 return 1
446 }
447 # String => 'classes'
448 # attribute => 'Class'
449 # context => '#stay'
450 # type => 'keyword'
451 4528 ▶ if ($self->testKeyword($text, 'classes', 0, undef, 0, '#stay', 'Class')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "classes", 0, undef, 0, "#stay", "Class")) 52 4476 4528
452 52 return 1
453 }
454 # String => 'type constructors'
455 # attribute => 'Type Constructor'
456 # context => '#stay'
457 # type => 'keyword'
458 4476 ▶ if ($self->testKeyword($text, 'type constructors', 0, undef, 0, '#stay', 'Type Constructor')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "type constructors", 0, undef, 0, "#stay", "Type Constructor")) 52 4424 4476
459 52 return 1
460 }
461 # String => 'functions'
462 # attribute => 'Function'
463 # context => '#stay'
464 # type => 'keyword'
465 4424 ▶ if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "functions", 0, undef, 0, "#stay", "Function")) 486 3938 4424
466 486 return 1
467 }
468 # String => 'data constructors'
469 # attribute => 'Data Constructor'
470 # context => '#stay'
471 # type => 'keyword'
472 3938 ▶ if ($self->testKeyword($text, 'data constructors', 0, undef, 0, '#stay', 'Data Constructor')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "data constructors", 0, undef, 0, "#stay", "Data Constructor")) 16 3922 3938
473 16 return 1
474 }
475 # attribute => 'String'
476 # char => '"'
477 # context => 'string'
478 # type => 'DetectChar'
479 3922 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "string", "String")) 24 3898 3922
480 24 return 1
481 }
482 # attribute => 'Infix Operator'
483 # char => '`'
484 # context => 'infix'
485 # type => 'DetectChar'
486 3898 ▶ if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'infix', 'Infix Operator')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "`", 0, 0, 0, undef, 0, "infix", "Infix Operator")) 12 3886 3898
487 12 return 1
488 }
489 # String => '\w[']+'
490 # attribute => 'Normal Text'
491 # context => '#stay'
492 # type => 'RegExpr'
493 3886 ▶ if ($self->testRegExpr($text, '\\w[\']+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\w[']+", 0, 0, 0, undef, 0, "#stay", "Normal Text")) 12 3874 3886
494 12 return 1
495 }
496 # attribute => 'Char'
497 # char => '''
498 # context => 'single_char'
499 # type => 'DetectChar'
500 3874 ▶ if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'single_char', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "'", 0, 0, 0, undef, 0, "single_char", "Char")) 12 3862 3874
501 12 return 1
502 }
503 # String => '[a-z_]+\w*'*\s*::'
504 # attribute => 'Function Definition'
505 # context => '#stay'
506 # type => 'RegExpr'
507 3862 ▶ if ($self->testRegExpr($text, '[a-z_]+\\w*\'*\\s*::', 0, 0, 0, undef, 0, '#stay', 'Function Definition')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "[a-z_]+\\w*'*\\s*::", 0, 0, 0, undef, 0, "#stay", "Function Definition")) 8 3854 3862
508 8 return 1
509 }
510 # attribute => 'Float'
511 # context => '#stay'
512 # type => 'Float'
513 3854 ▶ if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testFloat($text, 0, undef, 0, "#stay", "Float")) 42 3812 3854
514 42 return 1
515 }
516 # attribute => 'Decimal'
517 # context => '#stay'
518 # type => 'Int'
519 3812 ▶ if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testInt($text, 0, undef, 0, "#stay", "Decimal")) 0 3812 3812
520 0 return 1
521 }
522 3812 return 0;
523 };
524  
525 50 ▶sub parsesingle_char {
Subroutine parsesingle_char: called CC=3 SCAR=11.0
Pod undocumented
526 50 my ($self, $text) = @_;
527 # String => '\\.'
528 # attribute => 'Char'
529 # context => '#stay'
530 # type => 'RegExpr'
531 50 ▶ if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\.", 0, 0, 0, undef, 0, "#stay", "Char")) 4 46 50
532 4 return 1
533 }
534 # attribute => 'Char'
535 # char => '''
536 # context => '#pop'
537 # type => 'DetectChar'
538 46 ▶ if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "'", 0, 0, 0, undef, 0, "#pop", "Char")) 12 34 46
539 12 return 1
540 }
541 34 return 0;
542 };
543  
544 184 ▶sub parsestring {
Subroutine parsestring: called CC=3 SCAR=11.2
Pod undocumented
545 184 my ($self, $text) = @_;
546 # String => '\\.'
547 # attribute => 'String'
548 # context => '#stay'
549 # type => 'RegExpr'
550 184 ▶ if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\.", 0, 0, 0, undef, 0, "#stay", "String")) 0 184 184
551 0 return 1
552 }
553 # attribute => 'String'
554 # char => '"'
555 # context => '#pop'
556 # type => 'DetectChar'
557 184 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "#pop", "String")) 24 160 184
558 24 return 1
559 }
560 160 return 0;
561 };
562  
563  
564 1 1;
565  
566 __END__
« Kate/AWK.pm ↑ Summary Kate/Literate_Haskell.pm »