Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / 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 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       '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    $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    $self->listAdd('data constructors',
60       'EQ',
61       'False',
62       'GT',
63       'Just',
64       'LT',
65       'Left',
66       'Nothing',
67       'Right',
68       'True',
69    );
70    $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    $self->listAdd('infix operators',
290       'div',
291       'elem',
292       'mod',
293       'notElem',
294       'quot',
295       'rem',
296       'seq',
297    );
298    $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    $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    $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    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
369    $self->basecontext('normal');
370    $self->keywordscase(0);
371    $self->initialize;
372    bless ($self, $class);
373    return $self;
374 }
375
376 sub language {
377    return 'Haskell';
378 }
379
380 sub parsecomment_multi_line {
381    my ($self, $text) = @_;
382    # attribute => 'Comment'
383    # char => '-'
384    # char1 => '}'
385    # context => '#pop'
386    # type => 'Detect2Chars'
387    if ($self->testDetect2Chars($text, '-', '}', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
388       return 1
389    }
390    return 0;
391 };
392
393 sub parsecomment_single_line {
394    my ($self, $text) = @_;
395    return 0;
396 };
397
398 sub parsefunction_definition {
399    my ($self, $text) = @_;
400    # attribute => 'Function Definition'
401    # char => ';'
402    # context => '#pop'
403    # type => 'DetectChar'
404    if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Function Definition')) {
405       return 1
406    }
407    return 0;
408 };
409
410 sub parseinfix {
411    my ($self, $text) = @_;
412    # attribute => 'Infix Operator'
413    # char => '`'
414    # context => '#pop'
415    # type => 'DetectChar'
416    if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, '#pop', 'Infix Operator')) {
417       return 1
418    }
419    return 0;
420 };
421
422 sub parsenormal {
423    my ($self, $text) = @_;
424    # attribute => 'Comment'
425    # char => '{'
426    # char1 => '-'
427    # context => 'comment_multi_line'
428    # type => 'Detect2Chars'
429    if ($self->testDetect2Chars($text, '{', '-', 0, 0, 0, undef, 0, 'comment_multi_line', 'Comment')) {
430       return 1
431    }
432    # attribute => 'Comment'
433    # char => '-'
434    # char1 => '-'
435    # context => 'comment_single_line'
436    # type => 'Detect2Chars'
437    if ($self->testDetect2Chars($text, '-', '-', 0, 0, 0, undef, 0, 'comment_single_line', 'Comment')) {
438       return 1
439    }
440    # String => 'keywords'
441    # attribute => 'Keyword'
442    # context => '#stay'
443    # type => 'keyword'
444    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
445       return 1
446    }
447    # String => 'classes'
448    # attribute => 'Class'
449    # context => '#stay'
450    # type => 'keyword'
451    if ($self->testKeyword($text, 'classes', 0, undef, 0, '#stay', 'Class')) {
452       return 1
453    }
454    # String => 'type constructors'
455    # attribute => 'Type Constructor'
456    # context => '#stay'
457    # type => 'keyword'
458    if ($self->testKeyword($text, 'type constructors', 0, undef, 0, '#stay', 'Type Constructor')) {
459       return 1
460    }
461    # String => 'functions'
462    # attribute => 'Function'
463    # context => '#stay'
464    # type => 'keyword'
465    if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
466       return 1
467    }
468    # String => 'data constructors'
469    # attribute => 'Data Constructor'
470    # context => '#stay'
471    # type => 'keyword'
472    if ($self->testKeyword($text, 'data constructors', 0, undef, 0, '#stay', 'Data Constructor')) {
473       return 1
474    }
475    # attribute => 'String'
476    # char => '"'
477    # context => 'string'
478    # type => 'DetectChar'
479    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
480       return 1
481    }
482    # attribute => 'Infix Operator'
483    # char => '`'
484    # context => 'infix'
485    # type => 'DetectChar'
486    if ($self->testDetectChar($text, '`', 0, 0, 0, undef, 0, 'infix', 'Infix Operator')) {
487       return 1
488    }
489    # String => '\w[']+'
490    # attribute => 'Normal Text'
491    # context => '#stay'
492    # type => 'RegExpr'
493    if ($self->testRegExpr($text, '\\w[\']+', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
494       return 1
495    }
496    # attribute => 'Char'
497    # char => '''
498    # context => 'single_char'
499    # type => 'DetectChar'
500    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'single_char', 'Char')) {
501       return 1
502    }
503    # String => '[a-z_]+\w*'*\s*::'
504    # attribute => 'Function Definition'
505    # context => '#stay'
506    # type => 'RegExpr'
507    if ($self->testRegExpr($text, '[a-z_]+\\w*\'*\\s*::', 0, 0, 0, undef, 0, '#stay', 'Function Definition')) {
508       return 1
509    }
510    # attribute => 'Float'
511    # context => '#stay'
512    # type => 'Float'
513    if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
514       return 1
515    }
516    # attribute => 'Decimal'
517    # context => '#stay'
518    # type => 'Int'
519    if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
520       return 1
521    }
522    return 0;
523 };
524
525 sub parsesingle_char {
526    my ($self, $text) = @_;
527    # String => '\\.'
528    # attribute => 'Char'
529    # context => '#stay'
530    # type => 'RegExpr'
531    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
532       return 1
533    }
534    # attribute => 'Char'
535    # char => '''
536    # context => '#pop'
537    # type => 'DetectChar'
538    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Char')) {
539       return 1
540    }
541    return 0;
542 };
543
544 sub parsestring {
545    my ($self, $text) = @_;
546    # String => '\\.'
547    # attribute => 'String'
548    # context => '#stay'
549    # type => 'RegExpr'
550    if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'String')) {
551       return 1
552    }
553    # attribute => 'String'
554    # char => '"'
555    # context => '#pop'
556    # type => 'DetectChar'
557    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
558       return 1
559    }
560    return 0;
561 };
562
563
564 1;
565
566 __END__
567
568 =head1 NAME
569
570 Syntax::Highlight::Engine::Kate::Haskell - a Plugin for Haskell syntax highlighting
571
572 =head1 SYNOPSIS
573
574  require Syntax::Highlight::Engine::Kate::Haskell;
575  my $sh = new Syntax::Highlight::Engine::Kate::Haskell([
576  ]);
577
578 =head1 DESCRIPTION
579
580 Syntax::Highlight::Engine::Kate::Haskell is a  plugin module that provides syntax highlighting
581 for Haskell to the Syntax::Haghlight::Engine::Kate highlighting engine.
582
583 This code is generated from the syntax definition files used
584 by the Kate project.
585 It works quite fine, but can use refinement and optimization.
586
587 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
588
589 =cut
590
591 =head1 AUTHOR
592
593 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
594
595 =cut
596
597 =head1 BUGS
598
599 Unknown. If you find any, please contact the author
600
601 =cut
602