File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/UnrealScript.pm
Criterion Covered Total %
statement 73 97 75.2
branch 45 66 68.1
condition 1 3 33.3
subroutine 8 10 80.0
pod 0 7 0.0
total 127 183 69.4


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 'uscript.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 0.91
9             #kate version 2.3
10             #generated: Sun Feb 3 22:02:06 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::UnrealScript;
13              
14             our $VERSION = '0.12';
15              
16 1     1   688 use strict;
  1         3  
  1         36  
17 1     1   5 use warnings;
  1         3  
  1         35  
18 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         3  
  1         1573  
19              
20             sub new {
21 2     2 0 987 my $proto = shift;
22 2   33     15 my $class = ref($proto) || $proto;
23 2         19 my $self = $class->SUPER::new(@_);
24 2         29 $self->attributes({
25             'Char' => 'Char',
26             'Comment' => 'Comment',
27             'Data Type' => 'DataType',
28             'Decimal' => 'DecVal',
29             'Float' => 'Float',
30             'Hex' => 'BaseN',
31             'Keyword' => 'Keyword',
32             'Normal Text' => 'Normal',
33             'Octal' => 'BaseN',
34             'Preprocessor' => 'Others',
35             'Region Marker' => 'RegionMarker',
36             'String' => 'String',
37             'String Char' => 'Char',
38             'Symbol' => 'Normal',
39             });
40 2         18 $self->listAdd('keywords',
41             'Cross',
42             'Dot',
43             'Static',
44             'abstract',
45             'array',
46             'auto',
47             'break',
48             'case',
49             'coerce',
50             'config',
51             'const',
52             'continue',
53             'cpptext',
54             'default',
55             'defaultproperties',
56             'do',
57             'editconst',
58             'editinline',
59             'editinlinenew',
60             'editinlineuse',
61             'else',
62             'enum',
63             'event',
64             'exec',
65             'expands',
66             'export',
67             'extends',
68             'false',
69             'final',
70             'final',
71             'for',
72             'foreach',
73             'function',
74             'global',
75             'hidecategories',
76             'if',
77             'ignores',
78             'instanceof',
79             'iterator',
80             'latent',
81             'local',
82             'localized',
83             'native',
84             'nativereplication',
85             'new',
86             'noexport',
87             'none',
88             'null',
89             'operator',
90             'optional',
91             'out',
92             'placeable',
93             'postoperator',
94             'preoperator',
95             'private',
96             'protected',
97             'public',
98             'reliable',
99             'replication',
100             'return',
101             'self',
102             'simulated',
103             'singular',
104             'state',
105             'static',
106             'struct',
107             'super',
108             'switch',
109             'synchronized',
110             'throws',
111             'transient',
112             'true',
113             'unreliable',
114             'var',
115             'virtual',
116             'volatile',
117             'while',
118             );
119 2         13 $self->listAdd('types',
120             'ELightType',
121             'Pawn',
122             'actor',
123             'ammo',
124             'bool',
125             'boolean',
126             'byte',
127             'char',
128             'class',
129             'color',
130             'coords',
131             'double',
132             'float',
133             'int',
134             'ipaddr',
135             'long',
136             'material',
137             'name',
138             'object',
139             'package',
140             'plane',
141             'rotator',
142             'short',
143             'sound',
144             'staticmesh',
145             'string',
146             'vector',
147             'void',
148             );
149 2         38 $self->contextdata({
150             'Commentar 1' => {
151             callback => \&parseCommentar1,
152             attribute => 'Comment',
153             lineending => '#pop',
154             },
155             'Commentar 2' => {
156             callback => \&parseCommentar2,
157             attribute => 'Comment',
158             },
159             'Normal' => {
160             callback => \&parseNormal,
161             attribute => 'Normal Text',
162             },
163             'Preprocessor' => {
164             callback => \&parsePreprocessor,
165             attribute => 'Preprocessor',
166             lineending => '#pop',
167             },
168             'String' => {
169             callback => \&parseString,
170             attribute => 'String',
171             lineending => '#pop',
172             },
173             });
174 2         11 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
175 2         8 $self->basecontext('Normal');
176 2         10 $self->keywordscase(0);
177 2         6 $self->initialize;
178 2         7 bless ($self, $class);
179 2         12 return $self;
180             }
181              
182             sub language {
183 0     0 0 0 return 'UnrealScript';
184             }
185              
186             sub parseCommentar1 {
187 712     712 0 1225 my ($self, $text) = @_;
188 712         1401 return 0;
189             };
190              
191             sub parseCommentar2 {
192 92     92 0 180 my ($self, $text) = @_;
193             # attribute => 'Comment'
194             # char => '*'
195             # char1 => '/'
196             # context => '#pop'
197             # endRegion => 'Comment'
198             # type => 'Detect2Chars'
199 92 100       259 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
200 2         8 return 1
201             }
202 90         209 return 0;
203             };
204              
205             sub parseNormal {
206 8524     8524 0 17439 my ($self, $text) = @_;
207             # String => 'keywords'
208             # attribute => 'Keyword'
209             # context => '#stay'
210             # type => 'keyword'
211 8524 100       25511 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
212 256         849 return 1
213             }
214             # String => 'types'
215             # attribute => 'Data Type'
216             # context => '#stay'
217             # type => 'keyword'
218 8268 100       24257 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
219 80         254 return 1
220             }
221             # attribute => 'Float'
222             # context => '#stay'
223             # items => 'ARRAY(0x16a9b80)'
224             # type => 'Float'
225 8188 100       26135 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
226             # String => 'fF'
227             # attribute => 'Float'
228             # context => '#stay'
229             # type => 'AnyChar'
230 166 50       784 if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) {
231 0         0 return 1
232             }
233             }
234             # attribute => 'Octal'
235             # context => '#stay'
236             # type => 'HlCOct'
237 8188 50       23696 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
238 0         0 return 1
239             }
240             # attribute => 'Hex'
241             # context => '#stay'
242             # type => 'HlCHex'
243 8188 50       23837 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
244 0         0 return 1
245             }
246             # attribute => 'Decimal'
247             # context => '#stay'
248             # items => 'ARRAY(0x16fe360)'
249             # type => 'Int'
250 8188 100       23034 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
251             # String => 'ULL'
252             # attribute => 'Decimal'
253             # context => '#stay'
254             # insensitive => 'TRUE'
255             # type => 'StringDetect'
256 10 50       66 if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
257 0         0 return 1
258             }
259             # String => 'LUL'
260             # attribute => 'Decimal'
261             # context => '#stay'
262             # insensitive => 'TRUE'
263             # type => 'StringDetect'
264 10 50       41 if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
265 0         0 return 1
266             }
267             # String => 'LLU'
268             # attribute => 'Decimal'
269             # context => '#stay'
270             # insensitive => 'TRUE'
271             # type => 'StringDetect'
272 10 50       39 if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
273 0         0 return 1
274             }
275             # String => 'UL'
276             # attribute => 'Decimal'
277             # context => '#stay'
278             # insensitive => 'TRUE'
279             # type => 'StringDetect'
280 10 50       39 if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
281 0         0 return 1
282             }
283             # String => 'LU'
284             # attribute => 'Decimal'
285             # context => '#stay'
286             # insensitive => 'TRUE'
287             # type => 'StringDetect'
288 10 50       38 if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
289 0         0 return 1
290             }
291             # String => 'LL'
292             # attribute => 'Decimal'
293             # context => '#stay'
294             # insensitive => 'TRUE'
295             # type => 'StringDetect'
296 10 50       35 if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
297 0         0 return 1
298             }
299             # String => 'U'
300             # attribute => 'Decimal'
301             # context => '#stay'
302             # insensitive => 'TRUE'
303             # type => 'StringDetect'
304 10 50       39 if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
305 0         0 return 1
306             }
307             # String => 'L'
308             # attribute => 'Decimal'
309             # context => '#stay'
310             # insensitive => 'TRUE'
311             # type => 'StringDetect'
312 10 50       39 if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
313 0         0 return 1
314             }
315             }
316             # attribute => 'Char'
317             # context => '#stay'
318             # type => 'HlCChar'
319 8188 50       24073 if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
320 0         0 return 1
321             }
322             # String => '//BEGIN.*$'
323             # attribute => 'Region Marker'
324             # beginRegion => 'Region1'
325             # context => '#stay'
326             # type => 'RegExpr'
327 8188 50       23699 if ($self->testRegExpr($text, '//BEGIN.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
328 0         0 return 1
329             }
330             # String => '//END.*$'
331             # attribute => 'Region Marker'
332             # context => '#stay'
333             # endRegion => 'Region1'
334             # type => 'RegExpr'
335 8188 50       25298 if ($self->testRegExpr($text, '//END.*$', 0, 0, 0, undef, 0, '#stay', 'Region Marker')) {
336 0         0 return 1
337             }
338             # attribute => 'String'
339             # char => '"'
340             # context => 'String'
341             # type => 'DetectChar'
342 8188 100       24284 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
343 6         23 return 1
344             }
345             # attribute => 'String'
346             # char => '''
347             # context => 'String'
348             # type => 'DetectChar'
349 8182 100       20797 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String', 'String')) {
350 22         88 return 1
351             }
352             # attribute => 'Comment'
353             # char => '/'
354             # char1 => '/'
355             # context => 'Commentar 1'
356             # type => 'Detect2Chars'
357 8160 100       21747 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
358 18         67 return 1
359             }
360             # attribute => 'Comment'
361             # beginRegion => 'Comment'
362             # char => '/'
363             # char1 => '*'
364             # context => 'Commentar 2'
365             # type => 'Detect2Chars'
366 8142 100       22626 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
367 2         7 return 1
368             }
369             # attribute => 'Normal Text'
370             # beginRegion => 'Brace1'
371             # char => '{'
372             # context => '#stay'
373             # type => 'DetectChar'
374 8140 100       20298 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
375 58         175 return 1
376             }
377             # attribute => 'Normal Text'
378             # char => '}'
379             # context => '#stay'
380             # endRegion => 'Brace1'
381             # type => 'DetectChar'
382 8082 100       21143 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
383 58         195 return 1
384             }
385             # String => '!%&()+,-<=>?[]^{|}~'
386             # attribute => 'Symbol'
387             # context => '#stay'
388             # type => 'AnyChar'
389 8024 100       23130 if ($self->testAnyChar($text, '!%&()+,-<=>?[]^{|}~', 0, 0, undef, 0, '#stay', 'Symbol')) {
390 954         3118 return 1
391             }
392             # String => '#exec'
393             # attribute => 'Preprocessor'
394             # context => 'Preprocessor'
395             # insensitive => 'TRUE'
396             # type => 'RegExpr'
397 7070 50       22301 if ($self->testRegExpr($text, '#exec', 1, 0, 0, undef, 0, 'Preprocessor', 'Preprocessor')) {
398 0         0 return 1
399             }
400 7070         19807 return 0;
401             };
402              
403             sub parsePreprocessor {
404 0     0 0 0 my ($self, $text) = @_;
405             # attribute => 'Comment'
406             # char => '/'
407             # char1 => '/'
408             # context => 'Commentar 1'
409             # type => 'Detect2Chars'
410 0 0       0 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
411 0         0 return 1
412             }
413             # attribute => 'Comment'
414             # char => '/'
415             # char1 => '*'
416             # context => 'Commentar 2'
417             # type => 'Detect2Chars'
418 0 0       0 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
419 0         0 return 1
420             }
421 0         0 return 0;
422             };
423              
424             sub parseString {
425 526     526 0 1064 my ($self, $text) = @_;
426             # attribute => 'String'
427             # context => '#stay'
428             # type => 'LineContinue'
429 526 50       1410 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
430 0         0 return 1
431             }
432             # attribute => 'String Char'
433             # context => '#stay'
434             # type => 'HlCStringChar'
435 526 50       1422 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
436 0         0 return 1
437             }
438             # attribute => 'String'
439             # char => '"'
440             # context => '#pop'
441             # type => 'DetectChar'
442 526 100       1550 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
443 6         19 return 1
444             }
445             # attribute => 'String'
446             # char => '''
447             # context => '#pop'
448             # type => 'DetectChar'
449 520 100       1378 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
450 22         72 return 1
451             }
452 498         1129 return 0;
453             };
454              
455              
456             1;
457              
458             __END__