Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Prolog.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 'prolog.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.1
10 #generated: Sun Feb  3 22:02:06 2008, localtime
11
12 package Syntax::Highlight::Engine::Kate::Prolog;
13
14 our $VERSION = '0.06';
15
16 use strict;
17 use warnings;
18 use base('Syntax::Highlight::Engine::Kate::Template');
19
20 sub new {
21    my $proto = shift;
22    my $class = ref($proto) || $proto;
23    my $self = $class->SUPER::new(@_);
24    $self->attributes({
25       'Arithmetic' => 'Keyword',
26       'Comment' => 'Comment',
27       'Data Type' => 'DataType',
28       'Identifier' => 'Normal',
29       'Integer' => 'DecVal',
30       'Keyword' => 'Keyword',
31       'Normal Text' => 'Normal',
32       'String' => 'String',
33       'Symbol' => 'Normal',
34       'Variable' => 'Others',
35    });
36    $self->listAdd('arith',
37       'abs',
38       'arctan',
39       'cos',
40       'div',
41       'exp',
42       'ln',
43       'log',
44       'mod',
45       'random',
46       'randominit',
47       'round',
48       'sin',
49       'sqrt',
50       'tan',
51       'trunc',
52       'val',
53    );
54    $self->listAdd('basetype',
55       'binary',
56       'byte',
57       'char',
58       'dword',
59       'integer',
60       'long',
61       'real',
62       'ref',
63       'sbyte',
64       'short',
65       'string',
66       'symbol',
67       'ulong',
68       'unsigned',
69       'ushort',
70       'word',
71    );
72    $self->listAdd('compiler',
73       'bgidriver',
74       'bgifont',
75       'check_determ',
76       'code',
77       'config',
78       'diagnostics',
79       'error',
80       'errorlevel',
81       'gstacksize',
82       'heap',
83       'nobreak',
84       'nowarnings',
85       'printermenu',
86       'project',
87    );
88    $self->listAdd('keywordl',
89       'abstract',
90       'align',
91       'and',
92       'as',
93       'class',
94       'clauses',
95       'constants',
96       'database',
97       'determ',
98       'domains',
99       'elsedef',
100       'endclass',
101       'enddef',
102       'erroneous',
103       'facts',
104       'failure',
105       'global',
106       'goal',
107       'if',
108       'ifdef',
109       'ifndef',
110       'implement',
111       'include',
112       'language',
113       'multi',
114       'nocopy',
115       'nondeterm',
116       'object',
117       'or',
118       'predicates',
119       'procedure',
120       'protected',
121       'reference',
122       'single',
123       'static',
124       'struct',
125       'this',
126    );
127    $self->listAdd('keywords',
128       'false',
129       'true',
130    );
131    $self->listAdd('keywordu',
132       'ABSTRACT',
133       'ALIGN',
134       'AND',
135       'AS',
136       'CLASS',
137       'CLAUSES',
138       'CONSTANTS',
139       'DATABASE',
140       'DETERM',
141       'DOMAINS',
142       'ELSEDEF',
143       'ENDCLASS',
144       'ENDDEF',
145       'ERRONEOUS',
146       'FACTS',
147       'FAILURE',
148       'GLOBAL',
149       'GOAL',
150       'IF',
151       'IFDEF',
152       'IFNDEF',
153       'IMPLEMENT',
154       'INCLUDE',
155       'LANGUAGE',
156       'MULTI',
157       'NOCOPY',
158       'NONDETERM',
159       'OBJECT',
160       'OR',
161       'PREDICATES',
162       'PROCEDURE',
163       'PROTECTED',
164       'REFERENCE',
165       'SINGLE',
166       'STATIC',
167       'STRUCT',
168       'THIS',
169    );
170    $self->listAdd('special',
171       'assert',
172       'asserta',
173       'assertz',
174       'bound',
175       'chain_inserta',
176       'chain_insertafter',
177       'chain_insertz',
178       'chain_terms',
179       'consult',
180       'db_btrees',
181       'db_chains',
182       'fail',
183       'findall',
184       'format',
185       'free',
186       'msgrecv',
187       'msgsend',
188       'nl',
189       'not',
190       'readterm',
191       'ref_term',
192       'retract',
193       'retractall',
194       'save',
195       'term_bin',
196       'term_replace',
197       'term_str',
198       'trap',
199       'write',
200       'writef',
201    );
202    $self->contextdata({
203       'comment' => {
204          callback => \&parsecomment,
205          attribute => 'Comment',
206          lineending => '#pop',
207       },
208       'comment region' => {
209          callback => \&parsecommentregion,
210          attribute => 'Comment',
211       },
212       'normal' => {
213          callback => \&parsenormal,
214          attribute => 'Symbol',
215       },
216       'string' => {
217          callback => \&parsestring,
218          attribute => 'String',
219       },
220       'string2' => {
221          callback => \&parsestring2,
222          attribute => 'String',
223       },
224    });
225    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
226    $self->basecontext('normal');
227    $self->keywordscase(0);
228    $self->initialize;
229    bless ($self, $class);
230    return $self;
231 }
232
233 sub language {
234    return 'Prolog';
235 }
236
237 sub parsecomment {
238    my ($self, $text) = @_;
239    return 0;
240 };
241
242 sub parsecommentregion {
243    my ($self, $text) = @_;
244    # attribute => 'Comment'
245    # char => '*'
246    # char1 => '/'
247    # context => '#pop'
248    # type => 'Detect2Chars'
249    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
250       return 1
251    }
252    return 0;
253 };
254
255 sub parsenormal {
256    my ($self, $text) = @_;
257    # String => 'keywordl'
258    # attribute => 'Keyword'
259    # context => '#stay'
260    # type => 'keyword'
261    if ($self->testKeyword($text, 'keywordl', 0, undef, 0, '#stay', 'Keyword')) {
262       return 1
263    }
264    # String => 'keywordu'
265    # attribute => 'Keyword'
266    # context => '#stay'
267    # type => 'keyword'
268    if ($self->testKeyword($text, 'keywordu', 0, undef, 0, '#stay', 'Keyword')) {
269       return 1
270    }
271    # String => 'arith'
272    # attribute => 'Arithmetic'
273    # context => '#stay'
274    # type => 'keyword'
275    if ($self->testKeyword($text, 'arith', 0, undef, 0, '#stay', 'Arithmetic')) {
276       return 1
277    }
278    # String => 'compiler'
279    # attribute => 'Keyword'
280    # context => '#stay'
281    # type => 'keyword'
282    if ($self->testKeyword($text, 'compiler', 0, undef, 0, '#stay', 'Keyword')) {
283       return 1
284    }
285    # String => 'special'
286    # attribute => 'Keyword'
287    # context => '#stay'
288    # type => 'keyword'
289    if ($self->testKeyword($text, 'special', 0, undef, 0, '#stay', 'Keyword')) {
290       return 1
291    }
292    # String => 'basetype'
293    # attribute => 'Data Type'
294    # context => '#stay'
295    # type => 'keyword'
296    if ($self->testKeyword($text, 'basetype', 0, undef, 0, '#stay', 'Data Type')) {
297       return 1
298    }
299    # String => '[A-Z_][A-Za-z0-9_]*'
300    # attribute => 'Variable'
301    # context => '#stay'
302    # type => 'RegExpr'
303    if ($self->testRegExpr($text, '[A-Z_][A-Za-z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Variable')) {
304       return 1
305    }
306    # String => '[a-z][A-Za-z0-9_]*'
307    # attribute => 'Identifier'
308    # context => '#stay'
309    # type => 'RegExpr'
310    if ($self->testRegExpr($text, '[a-z][A-Za-z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Identifier')) {
311       return 1
312    }
313    # attribute => 'Comment'
314    # char => '%'
315    # context => 'comment'
316    # type => 'DetectChar'
317    if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
318       return 1
319    }
320    # attribute => 'Comment'
321    # char => '/'
322    # char1 => '*'
323    # context => 'comment region'
324    # type => 'Detect2Chars'
325    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment region', 'Comment')) {
326       return 1
327    }
328    # attribute => 'Integer'
329    # context => '#stay'
330    # type => 'Int'
331    if ($self->testInt($text, 0, undef, 0, '#stay', 'Integer')) {
332       return 1
333    }
334    # attribute => 'String'
335    # char => '"'
336    # context => 'string'
337    # type => 'DetectChar'
338    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
339       return 1
340    }
341    # attribute => 'String'
342    # char => '''
343    # context => 'string2'
344    # type => 'DetectChar'
345    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'string2', 'String')) {
346       return 1
347    }
348    # String => '~!^*()-+=[]|\:;,./?&<>'
349    # attribute => 'Symbol'
350    # context => '#stay'
351    # type => 'AnyChar'
352    if ($self->testAnyChar($text, '~!^*()-+=[]|\\:;,./?&<>', 0, 0, undef, 0, '#stay', 'Symbol')) {
353       return 1
354    }
355    return 0;
356 };
357
358 sub parsestring {
359    my ($self, $text) = @_;
360    # attribute => 'String'
361    # char => '"'
362    # context => '#pop'
363    # type => 'DetectChar'
364    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
365       return 1
366    }
367    return 0;
368 };
369
370 sub parsestring2 {
371    my ($self, $text) = @_;
372    # attribute => 'String'
373    # char => '''
374    # context => '#pop'
375    # type => 'DetectChar'
376    if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
377       return 1
378    }
379    return 0;
380 };
381
382
383 1;
384
385 __END__
386
387 =head1 NAME
388
389 Syntax::Highlight::Engine::Kate::Prolog - a Plugin for Prolog syntax highlighting
390
391 =head1 SYNOPSIS
392
393  require Syntax::Highlight::Engine::Kate::Prolog;
394  my $sh = new Syntax::Highlight::Engine::Kate::Prolog([
395  ]);
396
397 =head1 DESCRIPTION
398
399 Syntax::Highlight::Engine::Kate::Prolog is a  plugin module that provides syntax highlighting
400 for Prolog to the Syntax::Haghlight::Engine::Kate highlighting engine.
401
402 This code is generated from the syntax definition files used
403 by the Kate project.
404 It works quite fine, but can use refinement and optimization.
405
406 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
407
408 =cut
409
410 =head1 AUTHOR
411
412 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
413
414 =cut
415
416 =head1 BUGS
417
418 Unknown. If you find any, please contact the author
419
420 =cut
421