Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / GLSL.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 'glsl.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7
8 #kate xml version 1.02
9 #kate version 2.4
10 #kate author Oliver Richers (o.richers@tu-bs.de)
11 #generated: Sun Feb  3 22:02:05 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::GLSL;
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       'Comment' => 'Comment',
28       'Data Type' => 'DataType',
29       'Decimal' => 'DecVal',
30       'Float' => 'Float',
31       'Function' => 'Function',
32       'Hex' => 'BaseN',
33       'Keyword' => 'Keyword',
34       'Normal Text' => 'Normal',
35       'Octal' => 'BaseN',
36       'Preprocessor' => 'Others',
37       'StdFunction' => 'Function',
38       'StdVariable' => 'Function',
39       'Symbol' => 'Normal',
40       'Type Qualifier' => 'DataType',
41    });
42    $self->listAdd('attention',
43       'BUG',
44       'FIXME',
45       'TODO',
46    );
47    $self->listAdd('keywords',
48       'break',
49       'continue',
50       'discard',
51       'do',
52       'else',
53       'false',
54       'for',
55       'if',
56       'return',
57       'struct',
58       'true',
59       'while',
60    );
61    $self->listAdd('stdlib',
62       'abs',
63       'acos',
64       'all',
65       'any',
66       'asin',
67       'atan',
68       'ceil',
69       'clamp',
70       'cos',
71       'cross',
72       'dFdx',
73       'dFdy',
74       'degrees',
75       'distance',
76       'dot',
77       'equal',
78       'exp',
79       'exp2',
80       'faceforward',
81       'floor',
82       'fract',
83       'ftransform',
84       'fwidth',
85       'greaterThan',
86       'greaterThanEqual',
87       'inversesqrt',
88       'length',
89       'lessThan',
90       'lessThenEqual',
91       'log',
92       'log2',
93       'matrixCompMult',
94       'max',
95       'min',
96       'mix',
97       'mod',
98       'noise1',
99       'noise2',
100       'noise3',
101       'noise4',
102       'normalize',
103       'not',
104       'notEqual',
105       'pow',
106       'radians',
107       'reflect',
108       'refract',
109       'shadow1D',
110       'shadow1DLod',
111       'shadow1DProj',
112       'shadow1DProjLod',
113       'shadow2D',
114       'shadow2DLod',
115       'shadow2DProj',
116       'shadow2DProjLod',
117       'sign',
118       'sin',
119       'smoothstep',
120       'sqrt',
121       'step',
122       'tan',
123       'texture1D',
124       'texture1DLod',
125       'texture1DProj',
126       'texture1DProjLod',
127       'texture2D',
128       'texture2DLod',
129       'texture2DProj',
130       'texture2DProjLod',
131       'texture3D',
132       'texture3DLod',
133       'texture3DProj',
134       'texture3DProjLod',
135       'textureCube',
136       'textureCubeLod',
137    );
138    $self->listAdd('stdvar',
139       'gl_BackColor',
140       'gl_BackLightModelProduct',
141       'gl_BackLightProduct',
142       'gl_BackMaterial',
143       'gl_BackSecondaryColor',
144       'gl_ClipPlane',
145       'gl_ClipVertex',
146       'gl_Color',
147       'gl_Color',
148       'gl_DepthRange',
149       'gl_DepthRangeParameters',
150       'gl_EyePlaneQ',
151       'gl_EyePlaneR',
152       'gl_EyePlaneS',
153       'gl_EyePlaneT',
154       'gl_Fog',
155       'gl_FogColor',
156       'gl_FogFragCoord',
157       'gl_FogParameters',
158       'gl_FragColor',
159       'gl_FragCoord',
160       'gl_FragData',
161       'gl_FragDepth',
162       'gl_FragFacing',
163       'gl_FrontColor',
164       'gl_FrontLightModelProduct',
165       'gl_FrontLightProduct',
166       'gl_FrontMaterial',
167       'gl_FrontSecondaryColor',
168       'gl_LightModel',
169       'gl_LightModelParameters',
170       'gl_LightModelProducts',
171       'gl_LightProducts',
172       'gl_LightSource',
173       'gl_LightSourceParameters',
174       'gl_MaterialParameters',
175       'gl_MaxClipPlanes',
176       'gl_MaxCombinedTextureImageUnits',
177       'gl_MaxDrawBuffers',
178       'gl_MaxFragmentUniformComponents',
179       'gl_MaxLights',
180       'gl_MaxTextureCoords',
181       'gl_MaxTextureImageUnits',
182       'gl_MaxTextureUnits',
183       'gl_MaxVaryingFloats',
184       'gl_MaxVertexAttributes',
185       'gl_MaxVertexTextureImageUnits',
186       'gl_MaxVertexUniformComponents',
187       'gl_ModelViewMatrix',
188       'gl_ModelViewMatrixInverse',
189       'gl_ModelViewMatrixInverseTranspose',
190       'gl_ModelViewMatrixTranspose',
191       'gl_ModelViewProjectionMatrix',
192       'gl_ModelViewProjectionMatrixInverse',
193       'gl_ModelViewProjectionMatrixInverseTranspose',
194       'gl_ModelViewProjectionMatrixTranspose',
195       'gl_MultiTexCoord0',
196       'gl_MultiTexCoord1',
197       'gl_MultiTexCoord2',
198       'gl_MultiTexCoord2',
199       'gl_MultiTexCoord3',
200       'gl_MultiTexCoord4',
201       'gl_MultiTexCoord5',
202       'gl_MultiTexCoord6',
203       'gl_MultiTexCoord7',
204       'gl_NormScale',
205       'gl_Normal',
206       'gl_NormalMatrix',
207       'gl_ObjectPlaneQ',
208       'gl_ObjectPlaneR',
209       'gl_ObjectPlaneS',
210       'gl_ObjectPlaneT',
211       'gl_Point',
212       'gl_PointParameters',
213       'gl_PointSize',
214       'gl_Position',
215       'gl_ProjectionMatrix',
216       'gl_ProjectionMatrixInverse',
217       'gl_ProjectionMatrixInverseTranspose',
218       'gl_ProjectionMatrixTranspose',
219       'gl_SecondaryColor',
220       'gl_SecondaryColor',
221       'gl_TexCoord',
222       'gl_TextureEnvColor',
223       'gl_TextureMatrix',
224       'gl_TextureMatrixInverse',
225       'gl_TextureMatrixInverseTranspose',
226       'gl_TextureMatrixTranspose',
227       'gl_Vertex',
228    );
229    $self->listAdd('typequal',
230       'attribute',
231       'const',
232       'in',
233       'inout',
234       'out',
235       'uniform',
236       'varying',
237    );
238    $self->listAdd('types',
239       'bool',
240       'bvec2',
241       'bvec3',
242       'bvec4',
243       'float',
244       'int',
245       'ivec2',
246       'ivec3',
247       'ivec4',
248       'mat2',
249       'mat3',
250       'mat4',
251       'sampler1D',
252       'sampler1DShadow',
253       'sampler2D',
254       'sampler2DShadow',
255       'sampler3D',
256       'samplerCube',
257       'vec2',
258       'vec3',
259       'vec4',
260       'void',
261    );
262    $self->contextdata({
263       'Commentar 1' => {
264          callback => \&parseCommentar1,
265          attribute => 'Comment',
266          lineending => '#pop',
267       },
268       'Commentar 2' => {
269          callback => \&parseCommentar2,
270          attribute => 'Comment',
271       },
272       'Member' => {
273          callback => \&parseMember,
274          attribute => 'Normal Text',
275          lineending => '#pop',
276          fallthrough => '#pop',
277       },
278       'Normal' => {
279          callback => \&parseNormal,
280          attribute => 'Normal Text',
281       },
282       'Preprocessor' => {
283          callback => \&parsePreprocessor,
284          attribute => 'Preprocessor',
285          lineending => '#pop',
286       },
287    });
288    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
289    $self->basecontext('Normal');
290    $self->keywordscase(0);
291    $self->initialize;
292    bless ($self, $class);
293    return $self;
294 }
295
296 sub language {
297    return 'GLSL';
298 }
299
300 sub parseCommentar1 {
301    my ($self, $text) = @_;
302    # String => 'attention'
303    # attribute => 'Alert'
304    # context => '#stay'
305    # type => 'keyword'
306    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
307       return 1
308    }
309    return 0;
310 };
311
312 sub parseCommentar2 {
313    my ($self, $text) = @_;
314    # attribute => 'Comment'
315    # char => '*'
316    # char1 => '/'
317    # context => '#pop'
318    # endRegion => 'Comment'
319    # type => 'Detect2Chars'
320    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
321       return 1
322    }
323    # String => 'attention'
324    # attribute => 'Alert'
325    # context => '#stay'
326    # type => 'keyword'
327    if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
328       return 1
329    }
330    return 0;
331 };
332
333 sub parseMember {
334    my ($self, $text) = @_;
335    # String => '\b[_\w][_\w\d]*(?=[\s]*)'
336    # attribute => 'Function'
337    # context => '#pop'
338    # type => 'RegExpr'
339    if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) {
340       return 1
341    }
342    return 0;
343 };
344
345 sub parseNormal {
346    my ($self, $text) = @_;
347    # String => 'keywords'
348    # attribute => 'Keyword'
349    # context => '#stay'
350    # type => 'keyword'
351    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
352       return 1
353    }
354    # String => 'types'
355    # attribute => 'Data Type'
356    # context => '#stay'
357    # type => 'keyword'
358    if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
359       return 1
360    }
361    # String => 'typequal'
362    # attribute => 'Type Qualifier'
363    # context => '#stay'
364    # type => 'keyword'
365    if ($self->testKeyword($text, 'typequal', 0, undef, 0, '#stay', 'Type Qualifier')) {
366       return 1
367    }
368    # String => 'stdlib'
369    # attribute => 'StdFunction'
370    # context => '#stay'
371    # type => 'keyword'
372    if ($self->testKeyword($text, 'stdlib', 0, undef, 0, '#stay', 'StdFunction')) {
373       return 1
374    }
375    # String => 'stdvar'
376    # attribute => 'StdVariable'
377    # context => '#stay'
378    # type => 'keyword'
379    if ($self->testKeyword($text, 'stdvar', 0, undef, 0, '#stay', 'StdVariable')) {
380       return 1
381    }
382    # attribute => 'Float'
383    # context => '#stay'
384    # type => 'Float'
385    if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
386       return 1
387    }
388    # attribute => 'Octal'
389    # context => '#stay'
390    # type => 'HlCOct'
391    if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
392       return 1
393    }
394    # attribute => 'Hex'
395    # context => '#stay'
396    # type => 'HlCHex'
397    if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
398       return 1
399    }
400    # attribute => 'Decimal'
401    # context => '#stay'
402    # type => 'Int'
403    if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
404       return 1
405    }
406    # attribute => 'Comment'
407    # char => '/'
408    # char1 => '/'
409    # context => 'Commentar 1'
410    # type => 'Detect2Chars'
411    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
412       return 1
413    }
414    # attribute => 'Comment'
415    # beginRegion => 'Comment'
416    # char => '/'
417    # char1 => '*'
418    # context => 'Commentar 2'
419    # type => 'Detect2Chars'
420    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
421       return 1
422    }
423    # attribute => 'Symbol'
424    # beginRegion => 'Brace1'
425    # char => '{'
426    # context => '#stay'
427    # type => 'DetectChar'
428    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
429       return 1
430    }
431    # attribute => 'Symbol'
432    # char => '}'
433    # context => '#stay'
434    # endRegion => 'Brace1'
435    # type => 'DetectChar'
436    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
437       return 1
438    }
439    # attribute => 'Preprocessor'
440    # char => '#'
441    # context => 'Preprocessor'
442    # firstNonSpace => 'true'
443    # type => 'DetectChar'
444    if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Preprocessor', 'Preprocessor')) {
445       return 1
446    }
447    # String => '\b[_\w][_\w\d]*(?=[\s]*[(])'
448    # attribute => 'Function'
449    # context => '#stay'
450    # type => 'RegExpr'
451    if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*[(])', 0, 0, 0, undef, 0, '#stay', 'Function')) {
452       return 1
453    }
454    # String => '[.]{1,1}'
455    # attribute => 'Symbol'
456    # context => 'Member'
457    # type => 'RegExpr'
458    if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) {
459       return 1
460    }
461    # String => '.+-/*%<>[]()^|&~=!:;,?;'
462    # attribute => 'Symbol'
463    # context => '#stay'
464    # type => 'AnyChar'
465    if ($self->testAnyChar($text, '.+-/*%<>[]()^|&~=!:;,?;', 0, 0, undef, 0, '#stay', 'Symbol')) {
466       return 1
467    }
468    return 0;
469 };
470
471 sub parsePreprocessor {
472    my ($self, $text) = @_;
473    return 0;
474 };
475
476
477 1;
478
479 __END__
480
481 =head1 NAME
482
483 Syntax::Highlight::Engine::Kate::GLSL - a Plugin for GLSL syntax highlighting
484
485 =head1 SYNOPSIS
486
487  require Syntax::Highlight::Engine::Kate::GLSL;
488  my $sh = new Syntax::Highlight::Engine::Kate::GLSL([
489  ]);
490
491 =head1 DESCRIPTION
492
493 Syntax::Highlight::Engine::Kate::GLSL is a  plugin module that provides syntax highlighting
494 for GLSL to the Syntax::Haghlight::Engine::Kate highlighting engine.
495
496 This code is generated from the syntax definition files used
497 by the Kate project.
498 It works quite fine, but can use refinement and optimization.
499
500 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
501
502 =cut
503
504 =head1 AUTHOR
505
506 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
507
508 =cut
509
510 =head1 BUGS
511
512 Unknown. If you find any, please contact the author
513
514 =cut
515