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.
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
10 #generated: Sun Feb 3 22:02:06 2008, localtime
12 package Syntax::Highlight::Engine::Kate::Prolog;
14 our $VERSION = '0.06';
18 use base('Syntax::Highlight::Engine::Kate::Template');
22 my $class = ref($proto) || $proto;
23 my $self = $class->SUPER::new(@_);
25 'Arithmetic' => 'Keyword',
26 'Comment' => 'Comment',
27 'Data Type' => 'DataType',
28 'Identifier' => 'Normal',
29 'Integer' => 'DecVal',
30 'Keyword' => 'Keyword',
31 'Normal Text' => 'Normal',
34 'Variable' => 'Others',
36 $self->listAdd('arith',
54 $self->listAdd('basetype',
72 $self->listAdd('compiler',
88 $self->listAdd('keywordl',
127 $self->listAdd('keywords',
131 $self->listAdd('keywordu',
170 $self->listAdd('special',
204 callback => \&parsecomment,
205 attribute => 'Comment',
206 lineending => '#pop',
208 'comment region' => {
209 callback => \&parsecommentregion,
210 attribute => 'Comment',
213 callback => \&parsenormal,
214 attribute => 'Symbol',
217 callback => \&parsestring,
218 attribute => 'String',
221 callback => \&parsestring2,
222 attribute => 'String',
225 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
226 $self->basecontext('normal');
227 $self->keywordscase(0);
229 bless ($self, $class);
238 my ($self, $text) = @_;
242 sub parsecommentregion {
243 my ($self, $text) = @_;
244 # attribute => 'Comment'
248 # type => 'Detect2Chars'
249 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
256 my ($self, $text) = @_;
257 # String => 'keywordl'
258 # attribute => 'Keyword'
261 if ($self->testKeyword($text, 'keywordl', 0, undef, 0, '#stay', 'Keyword')) {
264 # String => 'keywordu'
265 # attribute => 'Keyword'
268 if ($self->testKeyword($text, 'keywordu', 0, undef, 0, '#stay', 'Keyword')) {
272 # attribute => 'Arithmetic'
275 if ($self->testKeyword($text, 'arith', 0, undef, 0, '#stay', 'Arithmetic')) {
278 # String => 'compiler'
279 # attribute => 'Keyword'
282 if ($self->testKeyword($text, 'compiler', 0, undef, 0, '#stay', 'Keyword')) {
285 # String => 'special'
286 # attribute => 'Keyword'
289 if ($self->testKeyword($text, 'special', 0, undef, 0, '#stay', 'Keyword')) {
292 # String => 'basetype'
293 # attribute => 'Data Type'
296 if ($self->testKeyword($text, 'basetype', 0, undef, 0, '#stay', 'Data Type')) {
299 # String => '[A-Z_][A-Za-z0-9_]*'
300 # attribute => 'Variable'
303 if ($self->testRegExpr($text, '[A-Z_][A-Za-z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Variable')) {
306 # String => '[a-z][A-Za-z0-9_]*'
307 # attribute => 'Identifier'
310 if ($self->testRegExpr($text, '[a-z][A-Za-z0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Identifier')) {
313 # attribute => 'Comment'
315 # context => 'comment'
316 # type => 'DetectChar'
317 if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
320 # attribute => 'Comment'
323 # context => 'comment region'
324 # type => 'Detect2Chars'
325 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'comment region', 'Comment')) {
328 # attribute => 'Integer'
331 if ($self->testInt($text, 0, undef, 0, '#stay', 'Integer')) {
334 # attribute => 'String'
336 # context => 'string'
337 # type => 'DetectChar'
338 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
341 # attribute => 'String'
343 # context => 'string2'
344 # type => 'DetectChar'
345 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'string2', 'String')) {
348 # String => '~!^*()-+=[]|\:;,./?&<>'
349 # attribute => 'Symbol'
352 if ($self->testAnyChar($text, '~!^*()-+=[]|\\:;,./?&<>', 0, 0, undef, 0, '#stay', 'Symbol')) {
359 my ($self, $text) = @_;
360 # attribute => 'String'
363 # type => 'DetectChar'
364 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
371 my ($self, $text) = @_;
372 # attribute => 'String'
375 # type => 'DetectChar'
376 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
389 Syntax::Highlight::Engine::Kate::Prolog - a Plugin for Prolog syntax highlighting
393 require Syntax::Highlight::Engine::Kate::Prolog;
394 my $sh = new Syntax::Highlight::Engine::Kate::Prolog([
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.
402 This code is generated from the syntax definition files used
404 It works quite fine, but can use refinement and optimization.
406 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
412 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
418 Unknown. If you find any, please contact the author