Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Cg.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 'cg.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7
8 #kate xml version 1.11
9 #kate version 2.4
10 #kate author Florian Schanda (florian.schanda@schanda.de)
11 #generated: Sun Feb  3 22:02:04 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::Cg;
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       'Alert' => 'Alert',
27       'Binding' => 'Keyword',
28       'Comment' => 'Comment',
29       'Data Type' => 'DataType',
30       'Decimal' => 'DecVal',
31       'Error' => 'Error',
32       'Fixed' => 'Float',
33       'Float' => 'Float',
34       'Function' => 'Function',
35       'Half' => 'Float',
36       'Keyword' => 'Keyword',
37       'Normal Text' => 'Normal',
38       'StdFunction' => 'Reserved',
39       'Swizzle' => 'Operator',
40       'Symbol' => 'Normal',
41    });
42    $self->listAdd('attention',
43       'BUG',
44       'FIXME',
45       'TODO',
46    );
47    $self->listAdd('binding',
48       'BCOL0',
49       'BCOL1',
50       'BINORMAL',
51       'BLENDINDICES',
52       'BLENDWEIGHT',
53       'COLOR',
54       'COLOR0',
55       'COLOR1',
56       'COLOR2',
57       'COLOR3',
58       'DEPTH',
59       'FACE',
60       'FOG',
61       'FOGCOORD',
62       'NORMAL',
63       'POSITION',
64       'PSIZE',
65       'TANGENT',
66       'TESSFACTOR',
67       'TEXCOORD0',
68       'TEXCOORD1',
69       'TEXCOORD10',
70       'TEXCOORD11',
71       'TEXCOORD12',
72       'TEXCOORD13',
73       'TEXCOORD14',
74       'TEXCOORD15',
75       'TEXCOORD2',
76       'TEXCOORD3',
77       'TEXCOORD4',
78       'TEXCOORD5',
79       'TEXCOORD6',
80       'TEXCOORD7',
81       'TEXCOORD8',
82       'TEXCOORD9',
83       'TEXUNIT0',
84       'TEXUNIT1',
85       'TEXUNIT10',
86       'TEXUNIT11',
87       'TEXUNIT12',
88       'TEXUNIT13',
89       'TEXUNIT14',
90       'TEXUNIT15',
91       'TEXUNIT2',
92       'TEXUNIT3',
93       'TEXUNIT4',
94       'TEXUNIT5',
95       'TEXUNIT6',
96       'TEXUNIT7',
97       'TEXUNIT8',
98       'TEXUNIT9',
99       'WPOS',
100    );
101    $self->listAdd('keywords',
102       'discard',
103       'do',
104       'else',
105       'false',
106       'for',
107       'if',
108       'return',
109       'static',
110       'struct',
111       'true',
112       'typedef',
113       'while',
114    );
115    $self->listAdd('stdlib',
116       'abs',
117       'acos',
118       'all',
119       'any',
120       'asin',
121       'atan',
122       'atan2',
123       'ceil',
124       'clamp',
125       'cos',
126       'cosh',
127       'cross',
128       'ddx',
129       'ddy',
130       'debug',
131       'degrees',
132       'determinant',
133       'distance',
134       'dot',
135       'exp',
136       'exp2',
137       'faceforward',
138       'floor',
139       'fmod',
140       'frac',
141       'frexp',
142       'isfinite',
143       'isinf',
144       'isnan',
145       'ldexp',
146       'length',
147       'lerp',
148       'lit',
149       'log',
150       'log10',
151       'log2',
152       'max',
153       'min',
154       'modf',
155       'mul',
156       'noise',
157       'normalize',
158       'pack_2half',
159       'pack_2ushort',
160       'pack_4byte',
161       'pack_4ubyte',
162       'pow',
163       'radians',
164       'reflect',
165       'refract',
166       'round',
167       'rsqrt',
168       'saturate',
169       'sign',
170       'sin',
171       'sincos',
172       'sinh',
173       'smoothstep',
174       'sqrt',
175       'step',
176       'tan',
177       'tanh',
178       'tex1D',
179       'tex1Dproj',
180       'tex2D',
181       'tex2Dproj',
182       'tex3D',
183       'tex3Dproj',
184       'texCUBE',
185       'texCUBEproj',
186       'texRECT',
187       'texRECTproj',
188       'transpose',
189       'unpack_2half',
190       'unpack_2ushort',
191       'unpack_4byte',
192       'unpack_4ubyte',
193    );
194    $self->listAdd('stdstruct',
195       'fragout',
196       'fragout_float',
197    );
198    $self->listAdd('types',
199       'bool',
200       'const',
201       'fixed',
202       'float',
203       'half',
204       'in',
205       'inout',
206       'int',
207       'out',
208       'packed',
209       'sampler',
210       'sampler1D',
211       'sampler2D',
212       'sampler3D',
213       'samplerCUBE',
214       'samplerRECT',
215       'uniform',
216       'void',
217    );
218    $self->contextdata({
219       'Commentar 1' => {
220          callback => \&parseCommentar1,
221          attribute => 'Comment',
222          lineending => '#pop',
223       },
224       'Commentar 2' => {
225          callback => \&parseCommentar2,
226          attribute => 'Comment',
227       },
228       'Commentar/Preprocessor' => {
229          callback => \&parseCommentarPreprocessor,
230          attribute => 'Comment',
231       },
232       'Member' => {
233          callback => \&parseMember,
234          attribute => 'Normal Text',
235          lineending => '#pop',
236          fallthrough => '#pop',
237       },
238       'Normal' => {
239          callback => \&parseNormal,
240          attribute => 'Normal Text',
241       },
242       'Outscoped' => {
243          callback => \&parseOutscoped,
244          attribute => 'Comment',
245       },
246       'Outscoped intern' => {
247          callback => \&parseOutscopedintern,
248          attribute => 'Comment',
249       },
250    });
251    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
252    $self->basecontext('Normal');
253    $self->keywordscase(0);
254    $self->initialize;
255    bless ($self, $class);
256    return $self;
257 }
258
259 sub language {
260    return 'Cg';
261 }
262
263 sub parseCommentar1 {
264    my ($self, $text) = @_;
265    # String => 'attention'
266    # attribute => 'Alert'
267    # context => '#stay'
268    # type => 'keyword'
269    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
270       return 1
271    }
272    return 0;
273 };
274
275 sub parseCommentar2 {
276    my ($self, $text) = @_;
277    # attribute => 'Comment'
278    # char => '*'
279    # char1 => '/'
280    # context => '#pop'
281    # endRegion => 'Comment'
282    # type => 'Detect2Chars'
283    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
284       return 1
285    }
286    # String => 'attention'
287    # attribute => 'Alert'
288    # context => '#stay'
289    # type => 'keyword'
290    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
291       return 1
292    }
293    return 0;
294 };
295
296 sub parseCommentarPreprocessor {
297    my ($self, $text) = @_;
298    # attribute => 'Comment'
299    # char => '*'
300    # char1 => '/'
301    # context => '#pop'
302    # endRegion => 'Comment2'
303    # type => 'Detect2Chars'
304    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
305       return 1
306    }
307    return 0;
308 };
309
310 sub parseMember {
311    my ($self, $text) = @_;
312    # String => '\b[_\w][_\w\d]*(?=[\s]*)'
313    # attribute => 'Function'
314    # context => '#pop'
315    # type => 'RegExpr'
316    if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) {
317       return 1
318    }
319    return 0;
320 };
321
322 sub parseNormal {
323    my ($self, $text) = @_;
324    # String => 'keywords'
325    # attribute => 'Keyword'
326    # context => '#stay'
327    # type => 'keyword'
328    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
329       return 1
330    }
331    # String => 'binding'
332    # attribute => 'Binding'
333    # context => '#stay'
334    # type => 'keyword'
335    if ($self->testKeyword($text, 'binding', 0, undef, 0, '#stay', 'Binding')) {
336       return 1
337    }
338    # String => 'attention'
339    # attribute => 'Alert'
340    # context => '#stay'
341    # type => 'keyword'
342    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
343       return 1
344    }
345    # attribute => 'Symbol'
346    # beginRegion => 'Brace1'
347    # char => '{'
348    # context => '#stay'
349    # type => 'DetectChar'
350    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
351       return 1
352    }
353    # attribute => 'Symbol'
354    # char => '}'
355    # context => '#stay'
356    # endRegion => 'Brace1'
357    # type => 'DetectChar'
358    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
359       return 1
360    }
361    # String => 'float[1234](x[1234])?'
362    # attribute => 'Data Type'
363    # context => '#stay'
364    # type => 'RegExpr'
365    if ($self->testRegExpr($text, 'float[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
366       return 1
367    }
368    # String => 'half[1234](x[1234])?'
369    # attribute => 'Data Type'
370    # context => '#stay'
371    # type => 'RegExpr'
372    if ($self->testRegExpr($text, 'half[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
373       return 1
374    }
375    # String => 'fixed[1234](x[1234])?'
376    # attribute => 'Data Type'
377    # context => '#stay'
378    # type => 'RegExpr'
379    if ($self->testRegExpr($text, 'fixed[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
380       return 1
381    }
382    # String => 'bool[1234](x[1234])?'
383    # attribute => 'Data Type'
384    # context => '#stay'
385    # type => 'RegExpr'
386    if ($self->testRegExpr($text, 'bool[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
387       return 1
388    }
389    # String => 'int[1234](x[1234])?'
390    # attribute => 'Data Type'
391    # context => '#stay'
392    # type => 'RegExpr'
393    if ($self->testRegExpr($text, 'int[1234](x[1234])?', 0, 0, 0, undef, 0, '#stay', 'Data Type')) {
394       return 1
395    }
396    # String => 'types'
397    # attribute => 'Data Type'
398    # context => '#stay'
399    # type => 'keyword'
400    if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
401       return 1
402    }
403    # String => 'stdstruct'
404    # attribute => 'Data Type'
405    # context => '#stay'
406    # type => 'keyword'
407    if ($self->testKeyword($text, 'stdstruct', 0, undef, 0, '#stay', 'Data Type')) {
408       return 1
409    }
410    # String => '[0123456789]*[.][0123456789]+f'
411    # attribute => 'Float'
412    # context => '#stay'
413    # type => 'RegExpr'
414    if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+f', 0, 0, 0, undef, 0, '#stay', 'Float')) {
415       return 1
416    }
417    # String => '[0123456789]*[.][0123456789]+h'
418    # attribute => 'Half'
419    # context => '#stay'
420    # type => 'RegExpr'
421    if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+h', 0, 0, 0, undef, 0, '#stay', 'Half')) {
422       return 1
423    }
424    # String => '[0123456789]*[.][0123456789]+x'
425    # attribute => 'Fixed'
426    # context => '#stay'
427    # type => 'RegExpr'
428    if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+x', 0, 0, 0, undef, 0, '#stay', 'Fixed')) {
429       return 1
430    }
431    # String => '[0123456789]*[.][0123456789]+'
432    # attribute => 'Float'
433    # context => '#stay'
434    # type => 'RegExpr'
435    if ($self->testRegExpr($text, '[0123456789]*[.][0123456789]+', 0, 0, 0, undef, 0, '#stay', 'Float')) {
436       return 1
437    }
438    # attribute => 'Decimal'
439    # context => '#stay'
440    # type => 'Int'
441    if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
442       return 1
443    }
444    # attribute => 'Comment'
445    # char => '/'
446    # char1 => '/'
447    # context => 'Commentar 1'
448    # type => 'Detect2Chars'
449    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
450       return 1
451    }
452    # attribute => 'Comment'
453    # beginRegion => 'Comment'
454    # char => '/'
455    # char1 => '*'
456    # context => 'Commentar 2'
457    # type => 'Detect2Chars'
458    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
459       return 1
460    }
461    # String => 'stdlib'
462    # attribute => 'StdFunction'
463    # context => '#stay'
464    # type => 'keyword'
465    if ($self->testKeyword($text, 'stdlib', 0, undef, 0, '#stay', 'StdFunction')) {
466       return 1
467    }
468    # String => '\b[_\w][_\w\d]*(?=[\s]*[(])'
469    # attribute => 'Function'
470    # context => '#stay'
471    # type => 'RegExpr'
472    if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*[(])', 0, 0, 0, undef, 0, '#stay', 'Function')) {
473       return 1
474    }
475    # String => '[.]{1,1}[rgbaxyzw]+(?=[\s/*-+<>])'
476    # attribute => 'Swizzle'
477    # context => '#stay'
478    # type => 'RegExpr'
479    if ($self->testRegExpr($text, '[.]{1,1}[rgbaxyzw]+(?=[\\s/*-+<>])', 0, 0, 0, undef, 0, '#stay', 'Swizzle')) {
480       return 1
481    }
482    # String => '[.]{1,1}'
483    # attribute => 'Symbol'
484    # context => 'Member'
485    # type => 'RegExpr'
486    if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) {
487       return 1
488    }
489    # String => ':!%&()+,-/.*<=>?[]|~^;'
490    # attribute => 'Symbol'
491    # context => '#stay'
492    # type => 'AnyChar'
493    if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
494       return 1
495    }
496    return 0;
497 };
498
499 sub parseOutscoped {
500    my ($self, $text) = @_;
501    # attribute => 'Comment'
502    # beginRegion => 'Comment'
503    # char => '/'
504    # char1 => '*'
505    # context => 'Commentar 2'
506    # type => 'Detect2Chars'
507    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
508       return 1
509    }
510    # String => 'attention'
511    # attribute => 'Alert'
512    # context => '#stay'
513    # type => 'keyword'
514    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
515       return 1
516    }
517    # String => '#\s*if'
518    # attribute => 'Comment'
519    # beginRegion => 'Outscoped'
520    # context => 'Outscoped intern'
521    # firstNonSpace => 'true'
522    # type => 'RegExpr'
523    if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
524       return 1
525    }
526    # String => '#\s*(endif|else|elif)'
527    # attribute => 'Preprocessor'
528    # context => '#pop'
529    # endRegion => 'Outscoped'
530    # firstNonSpace => 'true'
531    # type => 'RegExpr'
532    if ($self->testRegExpr($text, '#\\s*(endif|else|elif)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) {
533       return 1
534    }
535    return 0;
536 };
537
538 sub parseOutscopedintern {
539    my ($self, $text) = @_;
540    # attribute => 'Comment'
541    # beginRegion => 'Comment'
542    # char => '/'
543    # char1 => '*'
544    # context => 'Commentar 2'
545    # type => 'Detect2Chars'
546    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
547       return 1
548    }
549    # String => '#\s*if'
550    # attribute => 'Comment'
551    # beginRegion => 'Outscoped'
552    # context => 'Outscoped intern'
553    # firstNonSpace => 'true'
554    # type => 'RegExpr'
555    if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
556       return 1
557    }
558    # String => '#\s*endif'
559    # attribute => 'Comment'
560    # context => '#pop'
561    # endRegion => 'Outscoped'
562    # firstNonSpace => 'true'
563    # type => 'RegExpr'
564    if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
565       return 1
566    }
567    return 0;
568 };
569
570
571 1;
572
573 __END__
574
575 =head1 NAME
576
577 Syntax::Highlight::Engine::Kate::Cg - a Plugin for Cg syntax highlighting
578
579 =head1 SYNOPSIS
580
581  require Syntax::Highlight::Engine::Kate::Cg;
582  my $sh = new Syntax::Highlight::Engine::Kate::Cg([
583  ]);
584
585 =head1 DESCRIPTION
586
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.
589
590 This code is generated from the syntax definition files used
591 by the Kate project.
592 It works quite fine, but can use refinement and optimization.
593
594 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
595
596 =cut
597
598 =head1 AUTHOR
599
600 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
601
602 =cut
603
604 =head1 BUGS
605
606 Unknown. If you find any, please contact the author
607
608 =cut
609