File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Scheme.pm
Criterion Covered Total %
statement 126 141 89.3
branch 78 92 84.7
condition 1 3 33.3
subroutine 16 17 94.1
pod 0 14 0.0
total 221 267 82.7


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 'scheme.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.11
9             #kate version 2.4
10             #kate author Dominik Haumann (dhdev@gmx.de)
11             #generated: Sun Feb 3 22:02:06 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::Scheme;
14              
15             our $VERSION = '0.16';
16              
17 1     1   648 use strict;
  1         2  
  1         31  
18 1     1   4 use warnings;
  1         1  
  1         41  
19 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1611  
20              
21             sub new {
22 2     2 0 654 my $proto = shift;
23 2   33     11 my $class = ref($proto) || $proto;
24 2         13 my $self = $class->SUPER::new(@_);
25 2         28 $self->attributes({
26             'BaseN' => 'BaseN',
27             'Brackets1' => 'Others',
28             'Brackets2' => 'Others',
29             'Brackets3' => 'Others',
30             'Brackets4' => 'Others',
31             'Brackets5' => 'Others',
32             'Brackets6' => 'Others',
33             'Char' => 'Char',
34             'Comment' => 'Comment',
35             'Data' => 'DataType',
36             'Decimal' => 'DecVal',
37             'Definition' => 'Reserved',
38             'Float' => 'Float',
39             'Function' => 'Function',
40             'Keyword' => 'Keyword',
41             'Normal' => 'Normal',
42             'Operator' => 'Operator',
43             'Region Marker' => 'RegionMarker',
44             'String' => 'String',
45             });
46 2         9 $self->listAdd('characters',
47             '#\\\\ack',
48             '#\\\\backspace',
49             '#\\\\bel',
50             '#\\\\bs',
51             '#\\\\bs',
52             '#\\\\can',
53             '#\\\\cr',
54             '#\\\\cr',
55             '#\\\\dc1',
56             '#\\\\dc2',
57             '#\\\\dc3',
58             '#\\\\dc4',
59             '#\\\\dle',
60             '#\\\\em',
61             '#\\\\enq',
62             '#\\\\eot',
63             '#\\\\esc',
64             '#\\\\etb',
65             '#\\\\etx',
66             '#\\\\fs',
67             '#\\\\gs',
68             '#\\\\ht',
69             '#\\\\ht',
70             '#\\\\nak',
71             '#\\\\newline',
72             '#\\\\nl',
73             '#\\\\nl',
74             '#\\\\np',
75             '#\\\\np',
76             '#\\\\nul',
77             '#\\\\nul',
78             '#\\\\null',
79             '#\\\\page',
80             '#\\\\return',
81             '#\\\\rs',
82             '#\\\\si',
83             '#\\\\so',
84             '#\\\\soh',
85             '#\\\\sp',
86             '#\\\\space',
87             '#\\\\stx',
88             '#\\\\sub',
89             '#\\\\syn',
90             '#\\\\tab',
91             '#\\\\us',
92             '#\\\\vt',
93             );
94 2         7 $self->listAdd('defines',
95             'define',
96             'define*',
97             'define*-public',
98             'define-accessor',
99             'define-class',
100             'define-generic',
101             'define-macro',
102             'define-method',
103             'define-module',
104             'define-private',
105             'define-public',
106             'define-reader-ctor',
107             'define-syntax',
108             'define-syntax-macro',
109             'defined?',
110             'defmacro',
111             'defmacro*',
112             'defmacro*-public',
113             );
114 2         11 $self->listAdd('keywords',
115             'abs',
116             'acos',
117             'and',
118             'angle',
119             'append',
120             'applymap',
121             'asin',
122             'assoc',
123             'assq',
124             'assv',
125             'atan',
126             'begin',
127             'boolean?',
128             'break',
129             'caaaar',
130             'caaadr',
131             'caaar',
132             'caadar',
133             'caaddr',
134             'caadr',
135             'caar',
136             'cadaar',
137             'cadadr',
138             'cadar',
139             'caddar',
140             'cadddr',
141             'caddr',
142             'cadr',
143             'call-with-current-continuation',
144             'call-with-input-file',
145             'call-with-output-file',
146             'call-with-values',
147             'call/cc',
148             'car',
149             'case',
150             'catch',
151             'cdaaar',
152             'cdaadr',
153             'cdaar',
154             'cdadar',
155             'cdaddr',
156             'cdadr',
157             'cdar',
158             'cddaar',
159             'cddadr',
160             'cddar',
161             'cdddar',
162             'cddddr',
163             'cdddr',
164             'cddr',
165             'cdr',
166             'ceiling',
167             'char->integer',
168             'char-alphabetic?',
169             'char-ci<=?',
170             'char-ci=?',
171             'char-ci>=?',
172             'char-ci>?',
173             'char-downcase',
174             'char-lower-case?',
175             'char-numeric?',
176             'char-ready?',
177             'char-upcase',
178             'char-upper-case?',
179             'char-whitespace?',
180             'char<=?',
181             'char
182             'char=?',
183             'char>=?',
184             'char>?',
185             'char?',
186             'close-input-port',
187             'close-output-port',
188             'complex?',
189             'cond',
190             'cons',
191             'continue',
192             'cos',
193             'current-input-port',
194             'current-output-port',
195             'denominator',
196             'display',
197             'do',
198             'dynamic-wind',
199             'else',
200             'eof-object?',
201             'eq?',
202             'equal?',
203             'eqv?',
204             'eval',
205             'even?',
206             'exact->inexact',
207             'exact?',
208             'exp',
209             'expt',
210             'floor',
211             'for-each',
212             'force',
213             'gcd',
214             'har-ci
215             'if',
216             'imag-part',
217             'inexact->exact',
218             'inexact?',
219             'input-port?',
220             'integer->char',
221             'integer?',
222             'interaction-environment',
223             'lambda',
224             'lcm',
225             'length',
226             'let',
227             'let*',
228             'let-syntax',
229             'letrec',
230             'letrec-syntax',
231             'list',
232             'list->string',
233             'list-ref',
234             'list-tail',
235             'list?',
236             'load',
237             'log',
238             'magnitude',
239             'make-polar',
240             'make-rectangular',
241             'make-string',
242             'make-vector',
243             'max',
244             'member',
245             'memq',
246             'memv',
247             'min',
248             'modulo',
249             'negative?',
250             'newline',
251             'not',
252             'null-environment',
253             'null?',
254             'number->string',
255             'number?',
256             'numerator',
257             'odd?',
258             'open-input-file',
259             'open-output-file',
260             'or',
261             'output-port?',
262             'pair?',
263             'peek-char',
264             'port?',
265             'positive?',
266             'procedure?',
267             'quotient',
268             'rational?',
269             'rationalize',
270             'read',
271             'read-char',
272             'real-part',
273             'real?',
274             'remainder',
275             'reverse',
276             'round',
277             'scheme-report-environment',
278             'set-car!',
279             'set-cdr!',
280             'sin',
281             'sqrt',
282             'string',
283             'string->list',
284             'string->number',
285             'string->symbol',
286             'string-append',
287             'string-ci<=?',
288             'string-ci
289             'string-ci=?',
290             'string-ci>=?',
291             'string-ci>?',
292             'string-copy',
293             'string-fill!',
294             'string-length',
295             'string-ref',
296             'string-set!',
297             'string<=?',
298             'string
299             'string=?',
300             'string>=?',
301             'string>?',
302             'string?',
303             'substring',
304             'symbol->string',
305             'symbol?',
306             'syntax-rules',
307             'tan',
308             'transcript-off',
309             'transcript-on',
310             'truncate',
311             'values',
312             'vector',
313             'vector->listlist->vector',
314             'vector-fill!',
315             'vector-length',
316             'vector-ref',
317             'vector-set!',
318             'vector?',
319             'while',
320             'with-input-from-file',
321             'with-output-to-file',
322             'write',
323             'write-char',
324             'zero?',
325             );
326 2         7 $self->listAdd('operators',
327             '*)',
328             '*,*',
329             '+',
330             '-',
331             '/',
332             '<',
333             '<=',
334             '=',
335             '=>',
336             '>',
337             '>=',
338             );
339 2         42 $self->contextdata({
340             'Default' => {
341             callback => \&parseDefault,
342             attribute => 'Normal',
343             },
344             'Level0' => {
345             callback => \&parseLevel0,
346             attribute => 'Normal',
347             },
348             'Level1' => {
349             callback => \&parseLevel1,
350             attribute => 'Normal',
351             },
352             'Level2' => {
353             callback => \&parseLevel2,
354             attribute => 'Normal',
355             },
356             'Level3' => {
357             callback => \&parseLevel3,
358             attribute => 'Normal',
359             },
360             'Level4' => {
361             callback => \&parseLevel4,
362             attribute => 'Normal',
363             },
364             'Level5' => {
365             callback => \&parseLevel5,
366             attribute => 'Normal',
367             },
368             'Level6' => {
369             callback => \&parseLevel6,
370             attribute => 'Normal',
371             },
372             'MultiLineComment' => {
373             callback => \&parseMultiLineComment,
374             attribute => 'Comment',
375             },
376             'SpecialNumber' => {
377             callback => \&parseSpecialNumber,
378             attribute => 'Normal',
379             lineending => '#pop',
380             },
381             'String' => {
382             callback => \&parseString,
383             attribute => 'String',
384             },
385             'function_decl' => {
386             callback => \&parsefunction_decl,
387             attribute => 'Function',
388             },
389             });
390 2         7 $self->deliminators('\\s||\\.|\\(|\\)|,|\\%|\\&|;|\\[|\\]|\\^|\\{|\\||\\}|\\~|-|\\+|\\*|\\?|\\!|<|>|=|\\/|:|#|\\\\');
391 2         6 $self->basecontext('Level0');
392 2         7 $self->keywordscase(0);
393 2         5 $self->initialize;
394 2         4 bless ($self, $class);
395 2         10 return $self;
396             }
397              
398             sub language {
399 0     0 0 0 return 'Scheme';
400             }
401              
402             sub parseDefault {
403 5740     5740 0 13503 my ($self, $text) = @_;
404             # String => ';+\s*BEGIN.*$'
405             # attribute => 'Region Marker'
406             # beginRegion => 'region'
407             # context => '#stay'
408             # type => 'RegExpr'
409 5740 50       21649 if ($self->testRegExpr($text, ';+\\s*BEGIN.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
410 0         0 return 1
411             }
412             # String => ';+\s*END.*$'
413             # attribute => 'Region Marker'
414             # context => '#stay'
415             # endRegion => 'region'
416             # type => 'RegExpr'
417 5740 50       21295 if ($self->testRegExpr($text, ';+\\s*END.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
418 0         0 return 1
419             }
420             # String => ';.*$'
421             # attribute => 'Comment'
422             # context => '#stay'
423             # type => 'RegExpr'
424 5740 50       22103 if ($self->testRegExpr($text, ';.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
425 0         0 return 1
426             }
427             # attribute => 'Comment'
428             # beginRegion => 'region'
429             # char => '#'
430             # char1 => '!'
431             # context => 'MultiLineComment'
432             # type => 'Detect2Chars'
433 5740 100       26039 if ($self->testDetect2Chars($text, '#', '!', 0, 0, 0, undef, 0, 'MultiLineComment', 'Comment')) {
434 2         9 return 1
435             }
436             # String => 'keywords'
437             # attribute => 'Keyword'
438             # context => '#stay'
439             # type => 'keyword'
440 5738 100       22602 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
441 114         745 return 1
442             }
443             # String => 'operators'
444             # attribute => 'Operator'
445             # context => '#stay'
446             # type => 'keyword'
447 5624 100       20590 if ($self->testKeyword($text, 'operators', 0, undef, 0, '#stay', 'Operator')) {
448 2         10 return 1
449             }
450             # String => 'defines'
451             # attribute => 'Definition'
452             # context => 'function_decl'
453             # type => 'keyword'
454 5622 100       19635 if ($self->testKeyword($text, 'defines', 0, undef, 0, 'function_decl', 'Definition')) {
455 36         284 return 1
456             }
457             # String => 'characters'
458             # attribute => 'Char'
459             # context => '#stay'
460             # type => 'keyword'
461 5586 50       17907 if ($self->testKeyword($text, 'characters', 0, undef, 0, '#stay', 'Char')) {
462 0         0 return 1
463             }
464             # String => '#\\.'
465             # attribute => 'Char'
466             # context => '#stay'
467             # type => 'RegExpr'
468 5586 100       21389 if ($self->testRegExpr($text, '#\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
469 30         135 return 1
470             }
471             # attribute => 'String'
472             # char => '"'
473             # context => 'String'
474             # type => 'DetectChar'
475 5556 100       22374 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
476 10         84 return 1
477             }
478             # String => '#[bodxei]'
479             # attribute => 'Char'
480             # context => 'SpecialNumber'
481             # type => 'RegExpr'
482 5546 100       20516 if ($self->testRegExpr($text, '#[bodxei]', 0, 0, 0, undef, 0, 'SpecialNumber', 'Char')) {
483 6         33 return 1
484             }
485             # String => '#[tf]'
486             # attribute => 'Decimal'
487             # context => '#stay'
488             # type => 'RegExpr'
489 5540 100       19985 if ($self->testRegExpr($text, '#[tf]', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
490 12         115 return 1
491             }
492             # attribute => 'Float'
493             # context => '#stay'
494             # type => 'Float'
495 5528 100       21507 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
496 80         446 return 1
497             }
498             # attribute => 'Decimal'
499             # context => '#stay'
500             # type => 'Int'
501 5448 50       19813 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
502 0         0 return 1
503             }
504             # attribute => 'Brackets1'
505             # char => '('
506             # context => 'Level1'
507             # type => 'DetectChar'
508 5448 50       20258 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
509 0         0 return 1
510             }
511 5448         24439 return 0;
512             };
513              
514             sub parseLevel0 {
515 2260     2260 0 5138 my ($self, $text) = @_;
516             # attribute => 'Brackets1'
517             # char => '('
518             # context => 'Level1'
519             # type => 'DetectChar'
520 2260 100       7420 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
521 72         271 return 1
522             }
523             # context => 'Default'
524             # type => 'IncludeRules'
525 2188 100       7965 if ($self->includeRules('Default', $text)) {
526 58         205 return 1
527             }
528 2130         5776 return 0;
529             };
530              
531             sub parseLevel1 {
532 1152     1152 0 2913 my ($self, $text) = @_;
533             # attribute => 'Brackets2'
534             # char => '('
535             # context => 'Level2'
536             # type => 'DetectChar'
537 1152 100       4400 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level2', 'Brackets2')) {
538 82         331 return 1
539             }
540             # attribute => 'Brackets1'
541             # char => ')'
542             # context => '#pop'
543             # type => 'DetectChar'
544 1070 100       3437 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets1')) {
545 76         259 return 1
546             }
547             # context => 'Default'
548             # type => 'IncludeRules'
549 994 100       3761 if ($self->includeRules('Default', $text)) {
550 82         284 return 1
551             }
552 912         2714 return 0;
553             };
554              
555             sub parseLevel2 {
556 1012     1012 0 2532 my ($self, $text) = @_;
557             # attribute => 'Brackets3'
558             # char => '('
559             # context => 'Level3'
560             # type => 'DetectChar'
561 1012 100       3470 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level3', 'Brackets3')) {
562 94         338 return 1
563             }
564             # attribute => 'Brackets2'
565             # char => ')'
566             # context => '#pop'
567             # type => 'DetectChar'
568 918 100       4258 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets2')) {
569 82         316 return 1
570             }
571             # context => 'Default'
572             # type => 'IncludeRules'
573 836 100       3141 if ($self->includeRules('Default', $text)) {
574 44         174 return 1
575             }
576 792         2145 return 0;
577             };
578              
579             sub parseLevel3 {
580 796     796 0 1978 my ($self, $text) = @_;
581             # attribute => 'Brackets4'
582             # char => '('
583             # context => 'Level4'
584             # type => 'DetectChar'
585 796 100       3522 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level4', 'Brackets4')) {
586 42         166 return 1
587             }
588             # attribute => 'Brackets3'
589             # char => ')'
590             # context => '#pop'
591             # type => 'DetectChar'
592 754 100       2517 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets3')) {
593 94         322 return 1
594             }
595             # context => 'Default'
596             # type => 'IncludeRules'
597 660 100       2756 if ($self->includeRules('Default', $text)) {
598 50         178 return 1
599             }
600 610         1926 return 0;
601             };
602              
603             sub parseLevel4 {
604 456     456 0 1136 my ($self, $text) = @_;
605             # attribute => 'Brackets5'
606             # char => '('
607             # context => 'Level5'
608             # type => 'DetectChar'
609 456 100       1889 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level5', 'Brackets5')) {
610 24         96 return 1
611             }
612             # attribute => 'Brackets4'
613             # char => ')'
614             # context => '#pop'
615             # type => 'DetectChar'
616 432 100       1776 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets4')) {
617 42         170 return 1
618             }
619             # context => 'Default'
620             # type => 'IncludeRules'
621 390 100       1747 if ($self->includeRules('Default', $text)) {
622 42         227 return 1
623             }
624 348         1121 return 0;
625             };
626              
627             sub parseLevel5 {
628 484     484 0 1161 my ($self, $text) = @_;
629             # attribute => 'Brackets6'
630             # char => '('
631             # context => 'Level6'
632             # type => 'DetectChar'
633 484 100       1828 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level6', 'Brackets6')) {
634 10         43 return 1
635             }
636             # attribute => 'Brackets5'
637             # char => ')'
638             # context => '#pop'
639             # type => 'DetectChar'
640 474 100       1559 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets5')) {
641 24         83 return 1
642             }
643             # context => 'Default'
644             # type => 'IncludeRules'
645 450 100       2001 if ($self->includeRules('Default', $text)) {
646 10         37 return 1
647             }
648 440         1581 return 0;
649             };
650              
651             sub parseLevel6 {
652 236     236 0 591 my ($self, $text) = @_;
653             # attribute => 'Brackets1'
654             # char => '('
655             # context => 'Level1'
656             # type => 'DetectChar'
657 236 100       803 if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
658 4         19 return 1
659             }
660             # attribute => 'Brackets6'
661             # char => ')'
662             # context => '#pop'
663             # type => 'DetectChar'
664 232 100       766 if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets6')) {
665 10         36 return 1
666             }
667             # context => 'Default'
668             # type => 'IncludeRules'
669 222 100       988 if ($self->includeRules('Default', $text)) {
670 6         22 return 1
671             }
672 216         655 return 0;
673             };
674              
675             sub parseMultiLineComment {
676 894     894 0 1597 my ($self, $text) = @_;
677             # String => '!#\s*$'
678             # attribute => 'Comment'
679             # column => '0'
680             # context => '#pop'
681             # endRegion => 'region'
682             # type => 'RegExpr'
683 894 50       2271 if ($self->testRegExpr($text, '!#\\s*$', 0, 0, 0, 0, 0, '#pop', 'Comment')) {
684 0         0 return 1
685             }
686 894         1786 return 0;
687             };
688              
689             sub parseSpecialNumber {
690 244     244 0 560 my ($self, $text) = @_;
691             # attribute => 'Float'
692             # context => '#pop'
693             # type => 'Float'
694 244 50       852 if ($self->testFloat($text, 0, undef, 0, '#pop', 'Float')) {
695 0         0 return 1
696             }
697             # attribute => 'Decimal'
698             # context => '#pop'
699             # type => 'Int'
700 244 50       984 if ($self->testInt($text, 0, undef, 0, '#pop', 'Decimal')) {
701 0         0 return 1
702             }
703             # attribute => 'BaseN'
704             # context => '#pop'
705             # type => 'HlCOct'
706 244 50       874 if ($self->testHlCOct($text, 0, undef, 0, '#pop', 'BaseN')) {
707 0         0 return 1
708             }
709             # attribute => 'Float'
710             # context => '#pop'
711             # type => 'HlCHex'
712 244 50       860 if ($self->testHlCHex($text, 0, undef, 0, '#pop', 'Float')) {
713 0         0 return 1
714             }
715 244         628 return 0;
716             };
717              
718             sub parseString {
719 272     272 0 580 my ($self, $text) = @_;
720             # String => 'characters'
721             # attribute => 'Char'
722             # context => '#stay'
723             # type => 'keyword'
724 272 50       1101 if ($self->testKeyword($text, 'characters', 0, undef, 0, '#stay', 'Char')) {
725 0         0 return 1
726             }
727             # String => '#\\.'
728             # attribute => 'Char'
729             # context => '#stay'
730             # type => 'RegExpr'
731 272 50       1077 if ($self->testRegExpr($text, '#\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
732 0         0 return 1
733             }
734             # attribute => 'Char'
735             # char => '\'
736             # char1 => '"'
737             # context => '#stay'
738             # type => 'Detect2Chars'
739 272 100       946 if ($self->testDetect2Chars($text, '\\', '"', 0, 0, 0, undef, 0, '#stay', 'Char')) {
740 4         12 return 1
741             }
742             # attribute => 'Char'
743             # char => '\'
744             # char1 => '\'
745             # context => '#stay'
746             # type => 'Detect2Chars'
747 268 100       841 if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'Char')) {
748 2         6 return 1
749             }
750             # attribute => 'String'
751             # char => '"'
752             # context => '#pop'
753             # type => 'DetectChar'
754 266 100       874 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
755 10         32 return 1
756             }
757 256         645 return 0;
758             };
759              
760             sub parsefunction_decl {
761 36     36 0 108 my ($self, $text) = @_;
762             # String => '\s*[A-Za-z0-9-+\<\>//\*]*\s*'
763             # attribute => 'Function'
764             # context => '#pop'
765             # type => 'RegExpr'
766 36 50       165 if ($self->testRegExpr($text, '\\s*[A-Za-z0-9-+\\<\\>//\\*]*\\s*', 0, 0, 0, undef, 0, '#pop', 'Function')) {
767 36         134 return 1
768             }
769 0           return 0;
770             };
771              
772              
773             1;
774              
775             __END__