Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / XHarbour.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 'xharbour.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 Giancarlo Niccolai (giancarlo@niccolai.ws)
11 #generated: Sun Feb  3 22:02:06 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::XHarbour;
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       'Comment' => 'Comment',
27       'Function' => 'Function',
28       'Keyword' => 'Keyword',
29       'Normal Text' => 'Normal',
30       'Number' => 'DecVal',
31       'Operator' => 'BaseN',
32       'Preprocessor' => 'Others',
33       'String' => 'String',
34    });
35    $self->listAdd('class_keywords',
36       'classdata',
37       'data',
38       'from',
39       'hidden',
40       'init',
41       'inline',
42       'method',
43    );
44    $self->listAdd('context_beginners',
45       'BEGIN',
46       'FOR',
47       'FUNCTION',
48       'IF',
49       'METHOD',
50       'PROCEDURE',
51       'SWITCH',
52       'TRY',
53       'WHILE',
54    );
55    $self->listAdd('context_terminators',
56       'END',
57       'ENDCASE',
58       'ENDDO',
59       'ENDIF',
60       'NEXT',
61    );
62    $self->listAdd('functions',
63       'ABS',
64       'ALLTRIM',
65       'ASC',
66       'AT',
67       'CDOW',
68       'CHR',
69       'CMONTH',
70       'CTOD',
71       'CURDIR',
72       'CreateMutex',
73       'DATE',
74       'DAY',
75       'DAYS',
76       'DBAPPEND',
77       'DBCLEARFILTER',
78       'DBCLOSEALL',
79       'DBCLOSEAREA',
80       'DBCOMMIT',
81       'DBCOMMITALL',
82       'DBCREATE',
83       'DBDELETE',
84       'DBEVAL',
85       'DBF',
86       'DBFILTER',
87       'DBGOBOTTOM',
88       'DBGOTO',
89       'DBGOTOP',
90       'DBRECALL',
91       'DBRLOCK',
92       'DBRLOCKLIST',
93       'DBRUNLOCK',
94       'DBSEEK',
95       'DBSELECTAREA',
96       'DBSETDRIVER',
97       'DBSETFILTER',
98       'DBSKIP',
99       'DBSTRUCT',
100       'DBUNLOCK',
101       'DBUNLOCKALL',
102       'DBUSEAREA',
103       'DIRCHANGE',
104       'DIRREMOVE',
105       'DISKSPACE',
106       'DOW',
107       'DTOC',
108       'DTOS',
109       'DestroyMutex',
110       'EXP',
111       'FCLOSE',
112       'FCREATE',
113       'FERASE',
114       'FERROR',
115       'FOPEN',
116       'FREAD',
117       'FREADSTR',
118       'FSEEK',
119       'FWRITE',
120       'GETENV',
121       'HARDCR',
122       'HB_ANSITOOEM',
123       'HB_DISKSPACE',
124       'HB_FEOF',
125       'HB_ISBYREF',
126       'HB_LANGNAME',
127       'HB_LANGSELECT',
128       'HB_OEMTOANSI',
129       'HB_SETKEYSAVE',
130       'HB_SetKeyCheck',
131       'HB_SetKeyGet',
132       'HB_VALTOSTR',
133       'HB_pvalue',
134       'INDEXEXT',
135       'INDEXKEY',
136       'INDEXORD',
137       'INT',
138       'ISAFFIRM',
139       'ISALPHA',
140       'ISDIGIT',
141       'ISDISK',
142       'ISLOWER',
143       'ISNEGATIVE',
144       'ISUPPER',
145       'InetAccept',
146       'InetAddress',
147       'InetCleanup',
148       'InetClearTimeout',
149       'InetConnect',
150       'InetConnectIP',
151       'InetCreate',
152       'InetDGram',
153       'InetDGramRecv',
154       'InetDGramSend',
155       'InetDestroy',
156       'InetError',
157       'InetErrorDesc',
158       'InetGetHosts',
159       'InetGetTimeout',
160       'InetInit',
161       'InetPort',
162       'InetRecv',
163       'InetRecvAll',
164       'InetSend',
165       'InetSendAll',
166       'InetServer',
167       'InetSetTimeout',
168       'KillAllThreads',
169       'LEFT',
170       'LEN',
171       'LOG',
172       'LOWER',
173       'LTRIM',
174       'MAKEDIR',
175       'MAX',
176       'MEMOTRAN',
177       'MIN',
178       'MOD',
179       'MONTH',
180       'MutexLock',
181       'MutexUnlock',
182       'NATIONMSG',
183       'Notify',
184       'NotifyAll',
185       'ORDBAGEXT',
186       'ORDBAGNAME',
187       'ORDCONDSET',
188       'ORDCREATE',
189       'ORDDESTROY',
190       'ORDFOR',
191       'ORDKEY',
192       'ORDLISTADD',
193       'ORDLISTCLEAR',
194       'ORDLISTREBUILD',
195       'ORDNAME',
196       'ORDNUMBER',
197       'ORDSETFOCUS',
198       'PADC',
199       'PADL',
200       'PADR',
201       'PROCFILE',
202       'PROCLINE',
203       'PROCNAME',
204       'RAT',
205       'RDDLIST',
206       'RDDNAME',
207       'RDDSETDEFAULT',
208       'REPLICATE',
209       'RIGHT',
210       'ROUND',
211       'RTRIM',
212       'SET',
213       'SETKEY',
214       'SETMODE',
215       'SETTYPEAHEAD',
216       'SPACE',
217       'SQRT',
218       'STR',
219       'STRTRAN',
220       'STRZERO',
221       'SUBSTR',
222       'Subscribe',
223       'SubscribeNow',
224       'TAssociativeArray',
225       'TRANSFORM',
226       'TRIM',
227       'TYPE',
228       'ThreadJoin',
229       'ThreadKill',
230       'ThreadSleep',
231       'ThreadStart',
232       'ThreadStop',
233       'UPPER',
234       'VAL',
235       'VALTYPE',
236       'VERSION',
237       'WaitForThreads',
238       'YEAR',
239       '__DBCONTINUE',
240       '__DBZAP',
241       '__FLEDIT',
242       '__QUIT',
243       '__RDDSETDEFAULT',
244       '__SETCENTURY',
245       '__SetFunction',
246       '__WAIT',
247       '__atprompt',
248       '__dbCopyStruct',
249       '__dbCopyXStruct',
250       '__dbCreate',
251       '__dbStructFilter',
252       '__dbdelim',
253       '__dbsdf',
254       '__dir',
255       '__input',
256       '__menuto',
257       '__nonoallert',
258       '__run',
259       '__typefile',
260       '__xrestscreen',
261       '__xsavescreen',
262       'aadd',
263       'achoice',
264       'aclone',
265       'adel',
266       'adir',
267       'aeval',
268       'afill',
269       'ains',
270       'alert',
271       'array',
272       'ascan',
273       'asize',
274       'asort',
275       'atail',
276       'bin21',
277       'bin2l',
278       'bin2u',
279       'bin2w',
280       'break',
281       'browse',
282       'col',
283       'dbSkipper',
284       'dbedit',
285       'descend',
286       'devoutpict',
287       'do',
288       'elaptime',
289       'empty',
290       'errornew',
291       'errorsys',
292       'eval',
293       'fieldblock',
294       'fieldwblock',
295       'file',
296       'frename',
297       'hb_chechsum',
298       'hb_class',
299       'hb_colorindex',
300       'hb_crypt',
301       'hb_decrypt',
302       'hb_exec',
303       'hb_execfromarray',
304       'hb_hextonum',
305       'hb_keyput',
306       'hb_numtohex',
307       'hb_osnewline',
308       'hb_random',
309       'hb_readini',
310       'hb_regex',
311       'hb_regexcomp',
312       'hb_regexmatch',
313       'hb_regexsplit',
314       'hb_writeini',
315       'i2bin',
316       'inkey',
317       'l2bin',
318       'lastkey',
319       'maxcol',
320       'maxrow',
321       'mcol',
322       'mrow',
323       'nextkey',
324       'os',
325       'outerr',
326       'outstd',
327       'pcount',
328       'readkey',
329       'readvar',
330       'row',
331       'seconds',
332       'secs',
333       'throw',
334       'time',
335       'tone',
336       'u2bin',
337       'valtoprg',
338       'w2bin',
339       'word',
340    );
341    $self->listAdd('keywords',
342       '?',
343       'alias',
344       'all',
345       'as',
346       'box',
347       'case',
348       'catch',
349       'class',
350       'clear',
351       'close',
352       'color',
353       'databases',
354       'date',
355       'do',
356       'each',
357       'else',
358       'elseif',
359       'exit',
360       'extern',
361       'external',
362       'field',
363       'get',
364       'global',
365       'has',
366       'in',
367       'index',
368       'like',
369       'local',
370       'loop',
371       'nil',
372       'off',
373       'on',
374       'otherwise',
375       'read',
376       'return',
377       'say',
378       'say',
379       'screen',
380       'select',
381       'self',
382       'set',
383       'static',
384       'super',
385       'switch',
386       'to',
387       'use',
388    );
389    $self->listAdd('pragma',
390       '#define',
391       '#else',
392       '#endif',
393       '#if',
394       '#ifdef',
395       '#ifndef',
396       '#include',
397    );
398    $self->listAdd('set_commands',
399       'ALTERNATE',
400       'ALTFILE',
401       'AUTOPEN',
402       'AUTORDER',
403       'AUTOSHARE',
404       'BELL',
405       'CANCEL',
406       'COLOR',
407       'CONFIRM',
408       'CONSOLE',
409       'CURSOR',
410       'DATEFORMAT',
411       'DEBUG',
412       'DECIMALS',
413       'DEFAULT',
414       'DELETED',
415       'DELIMCHARS',
416       'DELIMITERS',
417       'DEVICE',
418       'DIRCASE',
419       'DIRSEPARATOR',
420       'EPOCH',
421       'ESCAPE',
422       'EVENTMASK',
423       'EXACT',
424       'EXCLUSIVE',
425       'EXIT',
426       'EXTRA',
427       'EXTRAFILE',
428       'FILECASE',
429       'FIXED',
430       'IDLEREPEAT',
431       'INSERT',
432       'INTENSITY',
433       'INVALID',
434       'LANGUAGE',
435       'MARGIN',
436       'MBLOCKSIZE',
437       'MCENTER',
438       'MESSAGE',
439       'MFILEEXT',
440       'OPTIMIZE',
441       'PATH',
442       'PRINTER',
443       'PRINTFILE',
444       'SCOREBOARD',
445       'SCROLLBREAK',
446       'SOFTSEEK',
447       'STRICTREAD',
448       'TRACE',
449       'TRACEFILE',
450       'TRACESTACK',
451       'TYPEAHEAD',
452       'UNIQUE',
453       'VIDEOMODE',
454       'WRAP',
455    );
456    $self->contextdata({
457       'ClassContext' => {
458          callback => \&parseClassContext,
459          attribute => 'Normal Text',
460       },
461       'TopLevel' => {
462          callback => \&parseTopLevel,
463          attribute => 'Normal Text',
464       },
465       'comment' => {
466          callback => \&parsecomment,
467          attribute => 'Comment',
468          lineending => '#pop',
469       },
470       'logic' => {
471          callback => \&parselogic,
472          attribute => 'Operator',
473          lineending => '#pop',
474       },
475       'ml_comment' => {
476          callback => \&parseml_comment,
477          attribute => 'Comment',
478       },
479       'string' => {
480          callback => \&parsestring,
481          attribute => 'String',
482          lineending => '#pop',
483       },
484       'stringc' => {
485          callback => \&parsestringc,
486          attribute => 'String',
487          lineending => '#pop',
488       },
489    });
490    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
491    $self->basecontext('TopLevel');
492    $self->keywordscase(0);
493    $self->initialize;
494    bless ($self, $class);
495    return $self;
496 }
497
498 sub language {
499    return 'xHarbour';
500 }
501
502 sub parseClassContext {
503    my ($self, $text) = @_;
504    # attribute => 'Comment'
505    # beginRegion => 'comment_region'
506    # char => '/'
507    # char1 => '*'
508    # context => 'ml_comment'
509    # type => 'Detect2Chars'
510    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'ml_comment', 'Comment')) {
511       return 1
512    }
513    # attribute => 'Comment'
514    # char => '*'
515    # context => 'comment'
516    # firstNonSpace => 'true'
517    # type => 'DetectChar'
518    if ($self->testDetectChar($text, '*', 0, 0, 0, undef, 1, 'comment', 'Comment')) {
519       return 1
520    }
521    # attribute => 'Comment'
522    # char => '/'
523    # char1 => '/'
524    # context => 'comment'
525    # type => 'Detect2Chars'
526    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
527       return 1
528    }
529    # String => 'class_keywords'
530    # attribute => 'Keyword'
531    # context => '#stay'
532    # type => 'keyword'
533    if ($self->testKeyword($text, 'class_keywords', 0, undef, 0, '#stay', 'Keyword')) {
534       return 1
535    }
536    # String => 'END(CLASS)? *$'
537    # attribute => 'Keyword'
538    # context => '#pop'
539    # endRegion => 'ClassDeclRegion'
540    # firstNonSpace => 'true'
541    # insensitive => 'TRUE'
542    # type => 'RegExpr'
543    if ($self->testRegExpr($text, 'END(CLASS)? *$', 1, 0, 0, undef, 1, '#pop', 'Keyword')) {
544       return 1
545    }
546    return 0;
547 };
548
549 sub parseTopLevel {
550    my ($self, $text) = @_;
551    # attribute => 'Comment'
552    # beginRegion => 'comment_region'
553    # char => '/'
554    # char1 => '*'
555    # context => 'ml_comment'
556    # type => 'Detect2Chars'
557    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'ml_comment', 'Comment')) {
558       return 1
559    }
560    # attribute => 'Comment'
561    # char => '*'
562    # context => 'comment'
563    # firstNonSpace => 'true'
564    # type => 'DetectChar'
565    if ($self->testDetectChar($text, '*', 0, 0, 0, undef, 1, 'comment', 'Comment')) {
566       return 1
567    }
568    # attribute => 'Comment'
569    # char => '/'
570    # char1 => '/'
571    # context => 'comment'
572    # type => 'Detect2Chars'
573    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
574       return 1
575    }
576    # attribute => 'String'
577    # char => '"'
578    # context => 'string'
579    # type => 'DetectChar'
580    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
581       return 1
582    }
583    # attribute => 'String'
584    # char => '''
585    # context => 'stringc'
586    # type => 'DetectChar'
587    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'stringc', 'String')) {
588       return 1
589    }
590    # String => '.and.'
591    # attribute => 'Operator'
592    # context => '#stay'
593    # insensitive => 'TRUE'
594    # type => 'StringDetect'
595    if ($self->testStringDetect($text, '.and.', 1, 0, 0, undef, 0, '#stay', 'Operator')) {
596       return 1
597    }
598    # String => '.or.'
599    # attribute => 'Operator'
600    # context => '#stay'
601    # insensitive => 'TRUE'
602    # type => 'StringDetect'
603    if ($self->testStringDetect($text, '.or.', 1, 0, 0, undef, 0, '#stay', 'Operator')) {
604       return 1
605    }
606    # String => '.not.'
607    # attribute => 'Operator'
608    # context => '#stay'
609    # insensitive => 'TRUE'
610    # type => 'StringDetect'
611    if ($self->testStringDetect($text, '.not.', 1, 0, 0, undef, 0, '#stay', 'Operator')) {
612       return 1
613    }
614    # String => '.f.'
615    # attribute => 'Operator'
616    # context => '#stay'
617    # insensitive => 'TRUE'
618    # type => 'StringDetect'
619    if ($self->testStringDetect($text, '.f.', 1, 0, 0, undef, 0, '#stay', 'Operator')) {
620       return 1
621    }
622    # String => '.t.'
623    # attribute => 'Operator'
624    # context => '#stay'
625    # insensitive => 'TRUE'
626    # type => 'StringDetect'
627    if ($self->testStringDetect($text, '.t.', 1, 0, 0, undef, 0, '#stay', 'Operator')) {
628       return 1
629    }
630    # String => ':=!'
631    # attribute => 'Operator'
632    # context => '#stay'
633    # type => 'AnyChar'
634    if ($self->testAnyChar($text, ':=!', 0, 0, undef, 0, '#stay', 'Operator')) {
635       return 1
636    }
637    # attribute => 'Keyword'
638    # char => '@'
639    # context => '#stay'
640    # type => 'DetectChar'
641    if ($self->testDetectChar($text, '@', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
642       return 1
643    }
644    # String => 'CLASS[\t ]+'
645    # attribute => 'Keyword'
646    # beginRegion => 'ClassDeclRegion'
647    # context => 'ClassContext'
648    # firstNonSpace => 'true'
649    # insensitive => 'TRUE'
650    # type => 'RegExpr'
651    if ($self->testRegExpr($text, 'CLASS[\\t ]+', 1, 0, 0, undef, 1, 'ClassContext', 'Keyword')) {
652       return 1
653    }
654    # String => 'DO[\t ]+CASE[\t ]*$'
655    # attribute => 'Keyword'
656    # beginRegion => 'IndentRegion'
657    # context => '#stay'
658    # firstNonSpace => 'true'
659    # insensitive => 'TRUE'
660    # type => 'RegExpr'
661    if ($self->testRegExpr($text, 'DO[\\t ]+CASE[\\t ]*$', 1, 0, 0, undef, 1, '#stay', 'Keyword')) {
662       return 1
663    }
664    # String => 'context_beginners'
665    # attribute => 'Keyword'
666    # beginRegion => 'IndentRegion'
667    # context => '#stay'
668    # type => 'keyword'
669    if ($self->testKeyword($text, 'context_beginners', 0, undef, 0, '#stay', 'Keyword')) {
670       return 1
671    }
672    # String => 'context_terminators'
673    # attribute => 'Keyword'
674    # context => '#stay'
675    # endRegion => 'IndentRegion'
676    # type => 'keyword'
677    if ($self->testKeyword($text, 'context_terminators', 0, undef, 0, '#stay', 'Keyword')) {
678       return 1
679    }
680    # String => 'return ?'
681    # attribute => 'Keyword'
682    # column => '0'
683    # context => '#stay'
684    # endRegion => 'IndentRegion'
685    # insensitive => 'TRUE'
686    # type => 'RegExpr'
687    if ($self->testRegExpr($text, 'return ?', 1, 0, 0, 0, 0, '#stay', 'Keyword')) {
688       return 1
689    }
690    # String => 'keywords'
691    # attribute => 'Keyword'
692    # context => '#stay'
693    # type => 'keyword'
694    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
695       return 1
696    }
697    # String => 'set_commands'
698    # attribute => 'Keyword'
699    # context => '#stay'
700    # type => 'keyword'
701    if ($self->testKeyword($text, 'set_commands', 0, undef, 0, '#stay', 'Keyword')) {
702       return 1
703    }
704    # String => 'functions'
705    # attribute => 'Function'
706    # context => '#stay'
707    # type => 'keyword'
708    if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) {
709       return 1
710    }
711    # String => 'pragma'
712    # attribute => 'Preprocessor'
713    # context => '#stay'
714    # type => 'keyword'
715    if ($self->testKeyword($text, 'pragma', 0, undef, 0, '#stay', 'Preprocessor')) {
716       return 1
717    }
718    # attribute => 'Operator'
719    # char => '-'
720    # char1 => '>'
721    # context => '#stay'
722    # type => 'Detect2Chars'
723    if ($self->testDetect2Chars($text, '-', '>', 0, 0, 0, undef, 0, '#stay', 'Operator')) {
724       return 1
725    }
726    # String => '\d+'
727    # attribute => 'Number'
728    # context => '#stay'
729    # type => 'RegExpr'
730    if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#stay', 'Number')) {
731       return 1
732    }
733    return 0;
734 };
735
736 sub parsecomment {
737    my ($self, $text) = @_;
738    return 0;
739 };
740
741 sub parselogic {
742    my ($self, $text) = @_;
743    # attribute => 'Operator'
744    # char => '.'
745    # context => '#pop'
746    # type => 'DetectChar'
747    if ($self->testDetectChar($text, '.', 0, 0, 0, undef, 0, '#pop', 'Operator')) {
748       return 1
749    }
750    return 0;
751 };
752
753 sub parseml_comment {
754    my ($self, $text) = @_;
755    # attribute => 'Comment'
756    # char => '*'
757    # char1 => '/'
758    # context => '#pop'
759    # endRegion => 'comment_region'
760    # type => 'Detect2Chars'
761    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
762       return 1
763    }
764    return 0;
765 };
766
767 sub parsestring {
768    my ($self, $text) = @_;
769    # attribute => 'String'
770    # char => '"'
771    # context => '#pop'
772    # type => 'DetectChar'
773    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
774       return 1
775    }
776    return 0;
777 };
778
779 sub parsestringc {
780    my ($self, $text) = @_;
781    # attribute => 'String'
782    # char => '''
783    # context => '#pop'
784    # type => 'DetectChar'
785    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
786       return 1
787    }
788    return 0;
789 };
790
791
792 1;
793
794 __END__
795
796 =head1 NAME
797
798 Syntax::Highlight::Engine::Kate::XHarbour - a Plugin for xHarbour syntax highlighting
799
800 =head1 SYNOPSIS
801
802  require Syntax::Highlight::Engine::Kate::XHarbour;
803  my $sh = new Syntax::Highlight::Engine::Kate::XHarbour([
804  ]);
805
806 =head1 DESCRIPTION
807
808 Syntax::Highlight::Engine::Kate::XHarbour is a  plugin module that provides syntax highlighting
809 for xHarbour to the Syntax::Haghlight::Engine::Kate highlighting engine.
810
811 This code is generated from the syntax definition files used
812 by the Kate project.
813 It works quite fine, but can use refinement and optimization.
814
815 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
816
817 =cut
818
819 =head1 AUTHOR
820
821 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
822
823 =cut
824
825 =head1 BUGS
826
827 Unknown. If you find any, please contact the author
828
829 =cut
830