File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/CGiS.pm
Criterion Covered Total %
statement 22 110 20.0
branch 0 70 0.0
condition 1 3 33.3
subroutine 4 14 28.5
pod 0 11 0.0
total 27 208 12.9


line stmt bran cond sub pod time code
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 'cgis.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             #generated: Sun Feb 3 22:02:04 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::CGiS;
13              
14             our $VERSION = '0.14';
15              
16 1     1   645 use strict;
  1         3  
  1         28  
17 1     1   5 use warnings;
  1         2  
  1         30  
18 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1073  
19              
20             sub new {
21 1     1 0 468 my $proto = shift;
22 1   33     10 my $class = ref($proto) || $proto;
23 1         9 my $self = $class->SUPER::new(@_);
24 1         14 $self->attributes({
25             'Alert' => 'Alert',
26             'Char' => 'Char',
27             'Comment' => 'Comment',
28             'Data Type' => 'DataType',
29             'Decimal' => 'DecVal',
30             'Float' => 'Float',
31             'Hex' => 'BaseN',
32             'Hint' => 'Others',
33             'Keyword' => 'Keyword',
34             'Normal Text' => 'Normal',
35             'Octal' => 'BaseN',
36             'Region Marker' => 'RegionMarker',
37             'String' => 'String',
38             'String Char' => 'Char',
39             'Symbol' => 'Normal',
40             });
41 1         6 $self->listAdd('keywords',
42             '1D',
43             '2D',
44             'break',
45             'continue',
46             'do',
47             'else',
48             'extern',
49             'for',
50             'forall',
51             'foreach',
52             'function',
53             'if',
54             'in',
55             'inout',
56             'internal',
57             'out',
58             'reduction',
59             'return',
60             'struct',
61             'typedef',
62             'while',
63             );
64 1         4 $self->listAdd('types',
65             'bool',
66             'bool2',
67             'bool3',
68             'bool4',
69             'float',
70             'float2',
71             'float3',
72             'float4',
73             'half',
74             'half2',
75             'half3',
76             'half4',
77             'int',
78             'int2',
79             'int3',
80             'int4',
81             );
82 1         19 $self->contextdata({
83             'Code' => {
84             callback => \&parseCode,
85             attribute => 'Normal Text',
86             },
87             'Commentar 1' => {
88             callback => \&parseCommentar1,
89             attribute => 'Comment',
90             lineending => '#pop',
91             },
92             'Commentar 2' => {
93             callback => \&parseCommentar2,
94             attribute => 'Comment',
95             },
96             'Common' => {
97             callback => \&parseCommon,
98             attribute => 'Normal Text',
99             },
100             'Control' => {
101             callback => \&parseControl,
102             attribute => 'Normal Text',
103             },
104             'Hint' => {
105             callback => \&parseHint,
106             attribute => 'Hint',
107             },
108             'Interface' => {
109             callback => \&parseInterface,
110             attribute => 'Normal Text',
111             },
112             'Normal' => {
113             callback => \&parseNormal,
114             attribute => 'Normal Text',
115             },
116             'Region Marker' => {
117             callback => \&parseRegionMarker,
118             attribute => 'Region Marker',
119             lineending => '#pop',
120             },
121             });
122 1         5 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
123 1         4 $self->basecontext('Normal');
124 1         5 $self->keywordscase(0);
125 1         3 $self->initialize;
126 1         2 bless ($self, $class);
127 1         3 return $self;
128             }
129              
130             sub language {
131 0     0 0   return 'CGiS';
132             }
133              
134             sub parseCode {
135 0     0 0   my ($self, $text) = @_;
136             # type => 'DetectSpaces'
137 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
138 0           return 1
139             }
140             # String => 'CONTROL'
141             # attribute => 'Keyword'
142             # context => 'Control'
143             # type => 'StringDetect'
144 0 0         if ($self->testStringDetect($text, 'CONTROL', 0, 0, 0, undef, 0, 'Control', 'Keyword')) {
145 0           return 1
146             }
147             # String => '#HINT'
148             # attribute => 'Hint'
149             # context => 'Hint'
150             # type => 'StringDetect'
151 0 0         if ($self->testStringDetect($text, '#HINT', 0, 0, 0, undef, 0, 'Hint', 'Hint')) {
152 0           return 1
153             }
154             # context => 'Common'
155             # type => 'IncludeRules'
156 0 0         if ($self->includeRules('Common', $text)) {
157 0           return 1
158             }
159 0           return 0;
160             };
161              
162             sub parseCommentar1 {
163 0     0 0   my ($self, $text) = @_;
164             # context => '##Alerts'
165             # type => 'IncludeRules'
166 0 0         if ($self->includePlugin('Alerts', $text)) {
167 0           return 1
168             }
169 0           return 0;
170             };
171              
172             sub parseCommentar2 {
173 0     0 0   my ($self, $text) = @_;
174             # attribute => 'Comment'
175             # char => '*'
176             # char1 => '/'
177             # context => '#pop'
178             # endRegion => 'Comment'
179             # type => 'Detect2Chars'
180 0 0         if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
181 0           return 1
182             }
183             # context => '##Alerts'
184             # type => 'IncludeRules'
185 0 0         if ($self->includePlugin('Alerts', $text)) {
186 0           return 1
187             }
188 0           return 0;
189             };
190              
191             sub parseCommon {
192 0     0 0   my ($self, $text) = @_;
193             # String => '//BEGIN'
194             # attribute => 'Region Marker'
195             # beginRegion => 'Region1'
196             # context => 'Region Marker'
197             # firstNonSpace => 'true'
198             # type => 'StringDetect'
199 0 0         if ($self->testStringDetect($text, '//BEGIN', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
200 0           return 1
201             }
202             # String => '//END'
203             # attribute => 'Region Marker'
204             # context => 'Region Marker'
205             # endRegion => 'Region1'
206             # firstNonSpace => 'true'
207             # type => 'StringDetect'
208 0 0         if ($self->testStringDetect($text, '//END', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
209 0           return 1
210             }
211             # String => 'keywords'
212             # attribute => 'Keyword'
213             # context => '#stay'
214             # type => 'keyword'
215 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
216 0           return 1
217             }
218             # String => 'types'
219             # attribute => 'Data Type'
220             # context => '#stay'
221             # type => 'keyword'
222 0 0         if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
223 0           return 1
224             }
225             # type => 'DetectIdentifier'
226 0 0         if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
227 0           return 1
228             }
229             # attribute => 'Symbol'
230             # beginRegion => 'Brace1'
231             # char => '{'
232             # context => '#stay'
233             # type => 'DetectChar'
234 0 0         if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
235 0           return 1
236             }
237             # attribute => 'Symbol'
238             # char => '}'
239             # context => '#stay'
240             # endRegion => 'Brace1'
241             # type => 'DetectChar'
242 0 0         if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
243 0           return 1
244             }
245             # attribute => 'Float'
246             # context => '#stay'
247             # items => 'ARRAY(0x11a5b70)'
248             # type => 'Float'
249 0 0         if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
250             # String => 'fF'
251             # attribute => 'Float'
252             # context => '#stay'
253             # type => 'AnyChar'
254 0 0         if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) {
255 0           return 1
256             }
257             }
258             # attribute => 'Octal'
259             # context => '#stay'
260             # type => 'HlCOct'
261 0 0         if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
262 0           return 1
263             }
264             # attribute => 'Hex'
265             # context => '#stay'
266             # type => 'HlCHex'
267 0 0         if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
268 0           return 1
269             }
270             # attribute => 'Decimal'
271             # context => '#stay'
272             # type => 'Int'
273 0 0         if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
274 0           return 1
275             }
276             # context => '##Doxygen'
277             # type => 'IncludeRules'
278 0 0         if ($self->includePlugin('Doxygen', $text)) {
279 0           return 1
280             }
281             # attribute => 'Comment'
282             # char => '/'
283             # char1 => '/'
284             # context => 'Commentar 1'
285             # type => 'Detect2Chars'
286 0 0         if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
287 0           return 1
288             }
289             # attribute => 'Comment'
290             # beginRegion => 'Comment'
291             # char => '/'
292             # char1 => '*'
293             # context => 'Commentar 2'
294             # type => 'Detect2Chars'
295 0 0         if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
296 0           return 1
297             }
298 0           return 0;
299             };
300              
301             sub parseControl {
302 0     0 0   my ($self, $text) = @_;
303             # type => 'DetectSpaces'
304 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
305 0           return 1
306             }
307             # String => 'CODE'
308             # attribute => 'Keyword'
309             # context => 'Code'
310             # type => 'StringDetect'
311 0 0         if ($self->testStringDetect($text, 'CODE', 0, 0, 0, undef, 0, 'Code', 'Keyword')) {
312 0           return 1
313             }
314             # context => 'Common'
315             # type => 'IncludeRules'
316 0 0         if ($self->includeRules('Common', $text)) {
317 0           return 1
318             }
319 0           return 0;
320             };
321              
322             sub parseHint {
323 0     0 0   my ($self, $text) = @_;
324             # type => 'DetectSpaces'
325 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
326 0           return 1
327             }
328             # attribute => 'Hint'
329             # char => ')'
330             # context => '#pop'
331             # type => 'DetectChar'
332 0 0         if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Hint')) {
333 0           return 1
334             }
335             # type => 'DetectIdentifier'
336 0 0         if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
337 0           return 1
338             }
339 0           return 0;
340             };
341              
342             sub parseInterface {
343 0     0 0   my ($self, $text) = @_;
344             # type => 'DetectSpaces'
345 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
346 0           return 1
347             }
348             # String => 'CONTROL'
349             # attribute => 'Keyword'
350             # context => 'Control'
351             # type => 'StringDetect'
352 0 0         if ($self->testStringDetect($text, 'CONTROL', 0, 0, 0, undef, 0, 'Control', 'Keyword')) {
353 0           return 1
354             }
355             # String => 'CODE'
356             # attribute => 'Keyword'
357             # context => 'Code'
358             # type => 'StringDetect'
359 0 0         if ($self->testStringDetect($text, 'CODE', 0, 0, 0, undef, 0, 'Code', 'Keyword')) {
360 0           return 1
361             }
362             # context => 'Common'
363             # type => 'IncludeRules'
364 0 0         if ($self->includeRules('Common', $text)) {
365 0           return 1
366             }
367 0           return 0;
368             };
369              
370             sub parseNormal {
371 0     0 0   my ($self, $text) = @_;
372             # type => 'DetectSpaces'
373 0 0         if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
374 0           return 1
375             }
376             # String => 'PROGRAM'
377             # attribute => 'Keyword'
378             # context => '#stay'
379             # type => 'StringDetect'
380 0 0         if ($self->testStringDetect($text, 'PROGRAM', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
381 0           return 1
382             }
383             # String => 'INTERFACE'
384             # attribute => 'Keyword'
385             # context => 'Interface'
386             # type => 'StringDetect'
387 0 0         if ($self->testStringDetect($text, 'INTERFACE', 0, 0, 0, undef, 0, 'Interface', 'Keyword')) {
388 0           return 1
389             }
390 0           return 0;
391             };
392              
393             sub parseRegionMarker {
394 0     0 0   my ($self, $text) = @_;
395 0           return 0;
396             };
397              
398              
399             1;
400              
401             __END__