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 'cg.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
10 #kate author Florian Schanda (florian.schanda@schanda.de)
11 #generated: Sun Feb 3 22:02:04 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Cg;
15 our $VERSION = '0.06';
19 use base('Syntax::Highlight::Engine::Kate::Template');
23 my $class = ref($proto) || $proto;
24 my $self = $class->SUPER::new(@_);
27 'Binding' => 'Keyword',
28 'Comment' => 'Comment',
29 'Data Type' => 'DataType',
30 'Decimal' => 'DecVal',
34 'Function' => 'Function',
36 'Keyword' => 'Keyword',
37 'Normal Text' => 'Normal',
38 'StdFunction' => 'Reserved',
39 'Swizzle' => 'Operator',
42 $self->listAdd('attention',
47 $self->listAdd('binding',
101 $self->listAdd('keywords',
115 $self->listAdd('stdlib',
194 $self->listAdd('stdstruct',
198 $self->listAdd('types',
220 callback => \&parseCommentar1,
221 attribute => 'Comment',
222 lineending => '#pop',
225 callback => \&parseCommentar2,
226 attribute => 'Comment',
228 'Commentar/Preprocessor' => {
229 callback => \&parseCommentarPreprocessor,
230 attribute => 'Comment',
233 callback => \&parseMember,
234 attribute => 'Normal Text',
235 lineending => '#pop',
236 fallthrough => '#pop',
239 callback => \&parseNormal,
240 attribute => 'Normal Text',
243 callback => \&parseOutscoped,
244 attribute => 'Comment',
246 'Outscoped intern' => {
247 callback => \&parseOutscopedintern,
248 attribute => 'Comment',
251 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
252 $self->basecontext('Normal');
253 $self->keywordscase(0);
255 bless ($self, $class);
263 sub parseCommentar1 {
264 my ($self, $text) = @_;
265 # String => 'attention'
266 # attribute => 'Alert'
269 if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
275 sub parseCommentar2 {
276 my ($self, $text) = @_;
277 # attribute => 'Comment'
281 # endRegion => 'Comment'
282 # type => 'Detect2Chars'
283 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
286 # String => 'attention'
287 # attribute => 'Alert'
290 if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
296 sub parseCommentarPreprocessor {
297 my ($self, $text) = @_;
298 # attribute => 'Comment'
302 # endRegion => 'Comment2'
303 # type => 'Detect2Chars'
304 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
311 my ($self, $text) = @_;
312 # String => '\b[_\w][_\w\d]*(?=[\s]*)'
313 # attribute => 'Function'
316 if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) {
323 my ($self, $text) = @_;
324 # String => 'keywords'
325 # attribute => 'Keyword'
328 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
331 # String => 'binding'
332 # attribute => 'Binding'
335 if ($self->testKeyword($text, 'binding', 0, undef, 0, '#stay', 'Binding')) {
338 # String => 'attention'
339 # attribute => 'Alert'
342 if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
345 # attribute => 'Symbol'
346 # beginRegion => 'Brace1'
349 # type => 'DetectChar'
350 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
353 # attribute => 'Symbol'
356 # endRegion => 'Brace1'
357 # type => 'DetectChar'
358 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
361 # String => 'float[1234](x[1234])?'
362 # attribute => 'Data Type'
365 if ($self->testRegExpr($text, 'float[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
368 # String => 'half[1234](x[1234])?'
369 # attribute => 'Data Type'
372 if ($self->testRegExpr($text, 'half[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
375 # String => 'fixed[1234](x[1234])?'
376 # attribute => 'Data Type'
379 if ($self->testRegExpr($text, 'fixed[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
382 # String => 'bool[1234](x[1234])?'
383 # attribute => 'Data Type'
386 if ($self->testRegExpr($text, 'bool[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
389 # String => 'int[1234](x[1234])?'
390 # attribute => 'Data Type'
393 if ($self->testRegExpr($text, 'int[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
397 # attribute => 'Data Type'
400 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
403 # String => 'stdstruct'
404 # attribute => 'Data Type'
407 if ($self->testKeyword($text, 'stdstruct', 0, undef, 0, '#stay', 'Data Type')) {
410 # String => '[0123456789]*[.][0123456789]+f'
411 # attribute => 'Float'
414 if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+f', 0, 0, 0, undef, 0, '#stay', 'Float')) {
417 # String => '[0123456789]*[.][0123456789]+h'
418 # attribute => 'Half'
421 if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+h', 0, 0, 0, undef, 0, '#stay', 'Half')) {
424 # String => '[0123456789]*[.][0123456789]+x'
425 # attribute => 'Fixed'
428 if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+x', 0, 0, 0, undef, 0, '#stay', 'Fixed')) {
431 # String => '[0123456789]*[.][0123456789]+'
432 # attribute => 'Float'
435 if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+', 0, 0, 0, undef, 0, '#stay', 'Float')) {
438 # attribute => 'Decimal'
441 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
444 # attribute => 'Comment'
447 # context => 'Commentar 1'
448 # type => 'Detect2Chars'
449 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
452 # attribute => 'Comment'
453 # beginRegion => 'Comment'
456 # context => 'Commentar 2'
457 # type => 'Detect2Chars'
458 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
462 # attribute => 'StdFunction'
465 if ($self->testKeyword($text, 'stdlib', 0, undef, 0, '#stay', 'StdFunction')) {
468 # String => '\b[_\w][_\w\d]*(?=[\s]*[(])'
469 # attribute => 'Function'
472 if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*[(])', 0, 0, 0, undef, 0, '#stay', 'Function')) {
475 # String => '[.]{1,1}[rgbaxyzw]+(?=[\s/*-+<>])'
476 # attribute => 'Swizzle'
479 if ($self->testRegExpr($text, '[.]{1,1}[rgbaxyzw]+(?=[\\s/*-+<>])', 0, 0, 0, undef, 0, '#stay', 'Swizzle')) {
482 # String => '[.]{1,1}'
483 # attribute => 'Symbol'
484 # context => 'Member'
486 if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) {
489 # String => ':!%&()+,-/.*<=>?[]|~^;'
490 # attribute => 'Symbol'
493 if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
500 my ($self, $text) = @_;
501 # attribute => 'Comment'
502 # beginRegion => 'Comment'
505 # context => 'Commentar 2'
506 # type => 'Detect2Chars'
507 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
510 # String => 'attention'
511 # attribute => 'Alert'
514 if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
518 # attribute => 'Comment'
519 # beginRegion => 'Outscoped'
520 # context => 'Outscoped intern'
521 # firstNonSpace => 'true'
523 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
526 # String => '#\s*(endif|else|elif)'
527 # attribute => 'Preprocessor'
529 # endRegion => 'Outscoped'
530 # firstNonSpace => 'true'
532 if ($self->testRegExpr($text, '#\\s*(endif|else|elif)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) {
538 sub parseOutscopedintern {
539 my ($self, $text) = @_;
540 # attribute => 'Comment'
541 # beginRegion => 'Comment'
544 # context => 'Commentar 2'
545 # type => 'Detect2Chars'
546 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
550 # attribute => 'Comment'
551 # beginRegion => 'Outscoped'
552 # context => 'Outscoped intern'
553 # firstNonSpace => 'true'
555 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
558 # String => '#\s*endif'
559 # attribute => 'Comment'
561 # endRegion => 'Outscoped'
562 # firstNonSpace => 'true'
564 if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
577 Syntax::Highlight::Engine::Kate::Cg - a Plugin for Cg syntax highlighting
581 require Syntax::Highlight::Engine::Kate::Cg;
582 my $sh = new Syntax::Highlight::Engine::Kate::Cg([
587 Syntax::Highlight::Engine::Kate::Cg is a plugin module that provides syntax highlighting
588 for Cg to the Syntax::Haghlight::Engine::Kate highlighting engine.
590 This code is generated from the syntax definition files used
592 It works quite fine, but can use refinement and optimization.
594 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
600 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
606 Unknown. If you find any, please contact the author