b6061ec20397bb8ad1edd2acd48a25e710a9e48a
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / 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 '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.06';
16
17 use strict;
18 use warnings;
19 use base('Syntax::Highlight::Engine::Kate::Template');
20
21 sub new {
22    my $proto = shift;
23    my $class = ref($proto) || $proto;
24    my $self = $class->SUPER::new(@_);
25    $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    $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    $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    $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<?c',
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    $self->listAdd('operators',
327       '*)',
328       '*,*',
329       '+',
330       '-',
331       '/',
332       '<',
333       '<=',
334       '=',
335       '=>',
336       '>',
337       '>=',
338    );
339    $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    $self->deliminators('\\s||\\.|\\(|\\)|,|\\%|\\&|;|\\[|\\]|\\^|\\{|\\||\\}|\\~|-|\\+|\\*|\\?|\\!|<|>|=|\\/|:|#|\\\\');
391    $self->basecontext('Level0');
392    $self->keywordscase(0);
393    $self->initialize;
394    bless ($self, $class);
395    return $self;
396 }
397
398 sub language {
399    return 'Scheme';
400 }
401
402 sub parseDefault {
403    my ($self, $text) = @_;
404    # String => ';+\s*BEGIN.*$'
405    # attribute => 'Region Marker'
406    # beginRegion => 'region'
407    # context => '#stay'
408    # type => 'RegExpr'
409    if ($self->testRegExpr($text, ';+\\s*BEGIN.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
410       return 1
411    }
412    # String => ';+\s*END.*$'
413    # attribute => 'Region Marker'
414    # context => '#stay'
415    # endRegion => 'region'
416    # type => 'RegExpr'
417    if ($self->testRegExpr($text, ';+\\s*END.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
418       return 1
419    }
420    # String => ';.*$'
421    # attribute => 'Comment'
422    # context => '#stay'
423    # type => 'RegExpr'
424    if ($self->testRegExpr($text, ';.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
425       return 1
426    }
427    # attribute => 'Comment'
428    # beginRegion => 'region'
429    # char => '#'
430    # char1 => '!'
431    # context => 'MultiLineComment'
432    # type => 'Detect2Chars'
433    if ($self->testDetect2Chars($text, '#', '!', 0, 0, 0, undef, 0, 'MultiLineComment', 'Comment')) {
434       return 1
435    }
436    # String => 'keywords'
437    # attribute => 'Keyword'
438    # context => '#stay'
439    # type => 'keyword'
440    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
441       return 1
442    }
443    # String => 'operators'
444    # attribute => 'Operator'
445    # context => '#stay'
446    # type => 'keyword'
447    if ($self->testKeyword($text, 'operators', 0, undef, 0, '#stay', 'Operator')) {
448       return 1
449    }
450    # String => 'defines'
451    # attribute => 'Definition'
452    # context => 'function_decl'
453    # type => 'keyword'
454    if ($self->testKeyword($text, 'defines', 0, undef, 0, 'function_decl', 'Definition')) {
455       return 1
456    }
457    # String => 'characters'
458    # attribute => 'Char'
459    # context => '#stay'
460    # type => 'keyword'
461    if ($self->testKeyword($text, 'characters', 0, undef, 0, '#stay', 'Char')) {
462       return 1
463    }
464    # String => '#\\.'
465    # attribute => 'Char'
466    # context => '#stay'
467    # type => 'RegExpr'
468    if ($self->testRegExpr($text, '#\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
469       return 1
470    }
471    # attribute => 'String'
472    # char => '"'
473    # context => 'String'
474    # type => 'DetectChar'
475    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
476       return 1
477    }
478    # String => '#[bodxei]'
479    # attribute => 'Char'
480    # context => 'SpecialNumber'
481    # type => 'RegExpr'
482    if ($self->testRegExpr($text, '#[bodxei]', 0, 0, 0, undef, 0, 'SpecialNumber', 'Char')) {
483       return 1
484    }
485    # String => '#[tf]'
486    # attribute => 'Decimal'
487    # context => '#stay'
488    # type => 'RegExpr'
489    if ($self->testRegExpr($text, '#[tf]', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
490       return 1
491    }
492    # attribute => 'Float'
493    # context => '#stay'
494    # type => 'Float'
495    if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
496       return 1
497    }
498    # attribute => 'Decimal'
499    # context => '#stay'
500    # type => 'Int'
501    if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
502       return 1
503    }
504    # attribute => 'Brackets1'
505    # char => '('
506    # context => 'Level1'
507    # type => 'DetectChar'
508    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
509       return 1
510    }
511    return 0;
512 };
513
514 sub parseLevel0 {
515    my ($self, $text) = @_;
516    # attribute => 'Brackets1'
517    # char => '('
518    # context => 'Level1'
519    # type => 'DetectChar'
520    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
521       return 1
522    }
523    # context => 'Default'
524    # type => 'IncludeRules'
525    if ($self->includeRules('Default', $text)) {
526       return 1
527    }
528    return 0;
529 };
530
531 sub parseLevel1 {
532    my ($self, $text) = @_;
533    # attribute => 'Brackets2'
534    # char => '('
535    # context => 'Level2'
536    # type => 'DetectChar'
537    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level2', 'Brackets2')) {
538       return 1
539    }
540    # attribute => 'Brackets1'
541    # char => ')'
542    # context => '#pop'
543    # type => 'DetectChar'
544    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets1')) {
545       return 1
546    }
547    # context => 'Default'
548    # type => 'IncludeRules'
549    if ($self->includeRules('Default', $text)) {
550       return 1
551    }
552    return 0;
553 };
554
555 sub parseLevel2 {
556    my ($self, $text) = @_;
557    # attribute => 'Brackets3'
558    # char => '('
559    # context => 'Level3'
560    # type => 'DetectChar'
561    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level3', 'Brackets3')) {
562       return 1
563    }
564    # attribute => 'Brackets2'
565    # char => ')'
566    # context => '#pop'
567    # type => 'DetectChar'
568    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets2')) {
569       return 1
570    }
571    # context => 'Default'
572    # type => 'IncludeRules'
573    if ($self->includeRules('Default', $text)) {
574       return 1
575    }
576    return 0;
577 };
578
579 sub parseLevel3 {
580    my ($self, $text) = @_;
581    # attribute => 'Brackets4'
582    # char => '('
583    # context => 'Level4'
584    # type => 'DetectChar'
585    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level4', 'Brackets4')) {
586       return 1
587    }
588    # attribute => 'Brackets3'
589    # char => ')'
590    # context => '#pop'
591    # type => 'DetectChar'
592    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets3')) {
593       return 1
594    }
595    # context => 'Default'
596    # type => 'IncludeRules'
597    if ($self->includeRules('Default', $text)) {
598       return 1
599    }
600    return 0;
601 };
602
603 sub parseLevel4 {
604    my ($self, $text) = @_;
605    # attribute => 'Brackets5'
606    # char => '('
607    # context => 'Level5'
608    # type => 'DetectChar'
609    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level5', 'Brackets5')) {
610       return 1
611    }
612    # attribute => 'Brackets4'
613    # char => ')'
614    # context => '#pop'
615    # type => 'DetectChar'
616    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets4')) {
617       return 1
618    }
619    # context => 'Default'
620    # type => 'IncludeRules'
621    if ($self->includeRules('Default', $text)) {
622       return 1
623    }
624    return 0;
625 };
626
627 sub parseLevel5 {
628    my ($self, $text) = @_;
629    # attribute => 'Brackets6'
630    # char => '('
631    # context => 'Level6'
632    # type => 'DetectChar'
633    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level6', 'Brackets6')) {
634       return 1
635    }
636    # attribute => 'Brackets5'
637    # char => ')'
638    # context => '#pop'
639    # type => 'DetectChar'
640    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets5')) {
641       return 1
642    }
643    # context => 'Default'
644    # type => 'IncludeRules'
645    if ($self->includeRules('Default', $text)) {
646       return 1
647    }
648    return 0;
649 };
650
651 sub parseLevel6 {
652    my ($self, $text) = @_;
653    # attribute => 'Brackets1'
654    # char => '('
655    # context => 'Level1'
656    # type => 'DetectChar'
657    if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Level1', 'Brackets1')) {
658       return 1
659    }
660    # attribute => 'Brackets6'
661    # char => ')'
662    # context => '#pop'
663    # type => 'DetectChar'
664    if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Brackets6')) {
665       return 1
666    }
667    # context => 'Default'
668    # type => 'IncludeRules'
669    if ($self->includeRules('Default', $text)) {
670       return 1
671    }
672    return 0;
673 };
674
675 sub parseMultiLineComment {
676    my ($self, $text) = @_;
677    # String => '!#\s*$'
678    # attribute => 'Comment'
679    # column => '0'
680    # context => '#pop'
681    # endRegion => 'region'
682    # type => 'RegExpr'
683    if ($self->testRegExpr($text, '!#\\s*$', 0, 0, 0, 0, 0, '#pop', 'Comment')) {
684       return 1
685    }
686    return 0;
687 };
688
689 sub parseSpecialNumber {
690    my ($self, $text) = @_;
691    # attribute => 'Float'
692    # context => '#pop'
693    # type => 'Float'
694    if ($self->testFloat($text, 0, undef, 0, '#pop', 'Float')) {
695       return 1
696    }
697    # attribute => 'Decimal'
698    # context => '#pop'
699    # type => 'Int'
700    if ($self->testInt($text, 0, undef, 0, '#pop', 'Decimal')) {
701       return 1
702    }
703    # attribute => 'BaseN'
704    # context => '#pop'
705    # type => 'HlCOct'
706    if ($self->testHlCOct($text, 0, undef, 0, '#pop', 'BaseN')) {
707       return 1
708    }
709    # attribute => 'Float'
710    # context => '#pop'
711    # type => 'HlCHex'
712    if ($self->testHlCHex($text, 0, undef, 0, '#pop', 'Float')) {
713       return 1
714    }
715    return 0;
716 };
717
718 sub parseString {
719    my ($self, $text) = @_;
720    # String => 'characters'
721    # attribute => 'Char'
722    # context => '#stay'
723    # type => 'keyword'
724    if ($self->testKeyword($text, 'characters', 0, undef, 0, '#stay', 'Char')) {
725       return 1
726    }
727    # String => '#\\.'
728    # attribute => 'Char'
729    # context => '#stay'
730    # type => 'RegExpr'
731    if ($self->testRegExpr($text, '#\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
732       return 1
733    }
734    # attribute => 'Char'
735    # char => '\'
736    # char1 => '"'
737    # context => '#stay'
738    # type => 'Detect2Chars'
739    if ($self->testDetect2Chars($text, '\\', '"', 0, 0, 0, undef, 0, '#stay', 'Char')) {
740       return 1
741    }
742    # attribute => 'Char'
743    # char => '\'
744    # char1 => '\'
745    # context => '#stay'
746    # type => 'Detect2Chars'
747    if ($self->testDetect2Chars($text, '\\', '\\', 0, 0, 0, undef, 0, '#stay', 'Char')) {
748       return 1
749    }
750    # attribute => 'String'
751    # char => '"'
752    # context => '#pop'
753    # type => 'DetectChar'
754    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
755       return 1
756    }
757    return 0;
758 };
759
760 sub parsefunction_decl {
761    my ($self, $text) = @_;
762    # String => '\s*[A-Za-z0-9-+\<\>//\*]*\s*'
763    # attribute => 'Function'
764    # context => '#pop'
765    # type => 'RegExpr'
766    if ($self->testRegExpr($text, '\\s*[A-Za-z0-9-+\\<\\>//\\*]*\\s*', 0, 0, 0, undef, 0, '#pop', 'Function')) {
767       return 1
768    }
769    return 0;
770 };
771
772
773 1;
774
775 __END__
776
777 =head1 NAME
778
779 Syntax::Highlight::Engine::Kate::Scheme - a Plugin for Scheme syntax highlighting
780
781 =head1 SYNOPSIS
782
783  require Syntax::Highlight::Engine::Kate::Scheme;
784  my $sh = new Syntax::Highlight::Engine::Kate::Scheme([
785  ]);
786
787 =head1 DESCRIPTION
788
789 Syntax::Highlight::Engine::Kate::Scheme is a  plugin module that provides syntax highlighting
790 for Scheme to the Syntax::Haghlight::Engine::Kate highlighting engine.
791
792 This code is generated from the syntax definition files used
793 by the Kate project.
794 It works quite fine, but can use refinement and optimization.
795
796 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
797
798 =cut
799
800 =head1 AUTHOR
801
802 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
803
804 =cut
805
806 =head1 BUGS
807
808 Unknown. If you find any, please contact the author
809
810 =cut
811