Kate/Literate_Haskell.pm

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