Commit | Line | Data |
3fea05b9 |
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 'cs.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.14 |
9 | #kate version 2.3 |
10 | #generated: Sun Feb 3 22:02:04 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::Cdash; |
13 | |
14 | our $VERSION = '0.06'; |
15 | |
16 | use strict; |
17 | use warnings; |
18 | use base('Syntax::Highlight::Engine::Kate::Template'); |
19 | |
20 | sub new { |
21 | my $proto = shift; |
22 | my $class = ref($proto) || $proto; |
23 | my $self = $class->SUPER::new(@_); |
24 | $self->attributes({ |
25 | 'Char' => 'Char', |
26 | 'Comment' => 'Comment', |
27 | 'Data Type' => 'DataType', |
28 | 'Decimal' => 'DecVal', |
29 | 'Float' => 'Float', |
30 | 'Function' => 'Function', |
31 | 'Hex' => 'BaseN', |
32 | 'Keyword' => 'Keyword', |
33 | 'Normal Text' => 'Normal', |
34 | 'Octal' => 'BaseN', |
35 | 'String' => 'String', |
36 | 'String Char' => 'Char', |
37 | 'Symbol' => 'Normal', |
38 | }); |
39 | $self->listAdd('keywords', |
40 | '#define', |
41 | '#elif', |
42 | '#else', |
43 | '#endif', |
44 | '#error', |
45 | '#if', |
46 | '#line', |
47 | '#undef', |
48 | '#warning', |
49 | 'abstract', |
50 | 'as', |
51 | 'base', |
52 | 'break', |
53 | 'case', |
54 | 'catch', |
55 | 'checked', |
56 | 'class', |
57 | 'continue', |
58 | 'default', |
59 | 'delegate', |
60 | 'do', |
61 | 'else', |
62 | 'enum', |
63 | 'event', |
64 | 'explicit', |
65 | 'extern', |
66 | 'false', |
67 | 'finally', |
68 | 'fixed', |
69 | 'for', |
70 | 'foreach', |
71 | 'goto', |
72 | 'if', |
73 | 'implicit', |
74 | 'in', |
75 | 'interface', |
76 | 'internal', |
77 | 'is', |
78 | 'lock', |
79 | 'namespace', |
80 | 'new', |
81 | 'null', |
82 | 'operator', |
83 | 'out', |
84 | 'override', |
85 | 'params', |
86 | 'private', |
87 | 'protected', |
88 | 'public', |
89 | 'readonly', |
90 | 'ref', |
91 | 'return', |
92 | 'sealed', |
93 | 'sizeof', |
94 | 'stackalloc', |
95 | 'static', |
96 | 'struct', |
97 | 'switch', |
98 | 'this', |
99 | 'throw', |
100 | 'true', |
101 | 'try', |
102 | 'typeof', |
103 | 'unchecked', |
104 | 'unsafe', |
105 | 'using', |
106 | 'virtual', |
107 | 'while', |
108 | ); |
109 | $self->listAdd('types', |
110 | 'bool', |
111 | 'byte', |
112 | 'char', |
113 | 'const', |
114 | 'decimal', |
115 | 'double', |
116 | 'float', |
117 | 'int', |
118 | 'long', |
119 | 'object', |
120 | 'sbyte', |
121 | 'short', |
122 | 'string', |
123 | 'uint', |
124 | 'ulong', |
125 | 'ushort', |
126 | 'void', |
127 | ); |
128 | $self->contextdata({ |
129 | 'Commentar 1' => { |
130 | callback => \&parseCommentar1, |
131 | attribute => 'Comment', |
132 | lineending => '#pop', |
133 | }, |
134 | 'Commentar 2' => { |
135 | callback => \&parseCommentar2, |
136 | attribute => 'Comment', |
137 | }, |
138 | 'Member' => { |
139 | callback => \&parseMember, |
140 | attribute => 'Normal Text', |
141 | lineending => '#pop', |
142 | fallthrough => '#pop', |
143 | }, |
144 | 'Normal' => { |
145 | callback => \&parseNormal, |
146 | attribute => 'Normal Text', |
147 | }, |
148 | 'String' => { |
149 | callback => \&parseString, |
150 | attribute => 'String', |
151 | lineending => '#pop', |
152 | }, |
153 | }); |
154 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
155 | $self->basecontext('Normal'); |
156 | $self->keywordscase(0); |
157 | $self->initialize; |
158 | bless ($self, $class); |
159 | return $self; |
160 | } |
161 | |
162 | sub language { |
163 | return 'C#'; |
164 | } |
165 | |
166 | sub parseCommentar1 { |
167 | my ($self, $text) = @_; |
168 | return 0; |
169 | }; |
170 | |
171 | sub parseCommentar2 { |
172 | my ($self, $text) = @_; |
173 | # attribute => 'Comment' |
174 | # char => '*' |
175 | # char1 => '/' |
176 | # context => '#pop' |
177 | # type => 'Detect2Chars' |
178 | if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
179 | return 1 |
180 | } |
181 | return 0; |
182 | }; |
183 | |
184 | sub parseMember { |
185 | my ($self, $text) = @_; |
186 | # String => '\b[_\w][_\w\d]*(?=[\s]*)' |
187 | # attribute => 'Function' |
188 | # context => '#pop' |
189 | # type => 'RegExpr' |
190 | if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) { |
191 | return 1 |
192 | } |
193 | return 0; |
194 | }; |
195 | |
196 | sub parseNormal { |
197 | my ($self, $text) = @_; |
198 | # String => 'keywords' |
199 | # attribute => 'Keyword' |
200 | # context => '#stay' |
201 | # type => 'keyword' |
202 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
203 | return 1 |
204 | } |
205 | # String => 'types' |
206 | # attribute => 'Data Type' |
207 | # context => '#stay' |
208 | # type => 'keyword' |
209 | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) { |
210 | return 1 |
211 | } |
212 | # attribute => 'Float' |
213 | # context => '#stay' |
214 | # items => 'ARRAY(0x10f55a0)' |
215 | # type => 'Float' |
216 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
217 | # String => 'fF' |
218 | # attribute => 'Float' |
219 | # context => '#stay' |
220 | # type => 'AnyChar' |
221 | if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) { |
222 | return 1 |
223 | } |
224 | } |
225 | # attribute => 'Octal' |
226 | # context => '#stay' |
227 | # type => 'HlCOct' |
228 | if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) { |
229 | return 1 |
230 | } |
231 | # attribute => 'Hex' |
232 | # context => '#stay' |
233 | # type => 'HlCHex' |
234 | if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) { |
235 | return 1 |
236 | } |
237 | # attribute => 'Decimal' |
238 | # context => '#stay' |
239 | # items => 'ARRAY(0x1095b90)' |
240 | # type => 'Int' |
241 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
242 | # String => 'ULL' |
243 | # attribute => 'Decimal' |
244 | # context => '#stay' |
245 | # insensitive => 'TRUE' |
246 | # type => 'StringDetect' |
247 | if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
248 | return 1 |
249 | } |
250 | # String => 'LUL' |
251 | # attribute => 'Decimal' |
252 | # context => '#stay' |
253 | # insensitive => 'TRUE' |
254 | # type => 'StringDetect' |
255 | if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
256 | return 1 |
257 | } |
258 | # String => 'LLU' |
259 | # attribute => 'Decimal' |
260 | # context => '#stay' |
261 | # insensitive => 'TRUE' |
262 | # type => 'StringDetect' |
263 | if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
264 | return 1 |
265 | } |
266 | # String => 'UL' |
267 | # attribute => 'Decimal' |
268 | # context => '#stay' |
269 | # insensitive => 'TRUE' |
270 | # type => 'StringDetect' |
271 | if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
272 | return 1 |
273 | } |
274 | # String => 'LU' |
275 | # attribute => 'Decimal' |
276 | # context => '#stay' |
277 | # insensitive => 'TRUE' |
278 | # type => 'StringDetect' |
279 | if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
280 | return 1 |
281 | } |
282 | # String => 'LL' |
283 | # attribute => 'Decimal' |
284 | # context => '#stay' |
285 | # insensitive => 'TRUE' |
286 | # type => 'StringDetect' |
287 | if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
288 | return 1 |
289 | } |
290 | # String => 'U' |
291 | # attribute => 'Decimal' |
292 | # context => '#stay' |
293 | # insensitive => 'TRUE' |
294 | # type => 'StringDetect' |
295 | if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
296 | return 1 |
297 | } |
298 | # String => 'L' |
299 | # attribute => 'Decimal' |
300 | # context => '#stay' |
301 | # insensitive => 'TRUE' |
302 | # type => 'StringDetect' |
303 | if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) { |
304 | return 1 |
305 | } |
306 | } |
307 | # attribute => 'Char' |
308 | # context => '#stay' |
309 | # type => 'HlCChar' |
310 | if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) { |
311 | return 1 |
312 | } |
313 | # attribute => 'String' |
314 | # char => '"' |
315 | # context => 'String' |
316 | # type => 'DetectChar' |
317 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
318 | return 1 |
319 | } |
320 | # context => '##Doxygen' |
321 | # type => 'IncludeRules' |
322 | if ($self->includePlugin('Doxygen', $text)) { |
323 | return 1 |
324 | } |
325 | # attribute => 'Comment' |
326 | # char => '/' |
327 | # char1 => '/' |
328 | # context => 'Commentar 1' |
329 | # type => 'Detect2Chars' |
330 | if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) { |
331 | return 1 |
332 | } |
333 | # attribute => 'Comment' |
334 | # char => '/' |
335 | # char1 => '*' |
336 | # context => 'Commentar 2' |
337 | # type => 'Detect2Chars' |
338 | if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) { |
339 | return 1 |
340 | } |
341 | # attribute => 'Symbol' |
342 | # beginRegion => 'block1' |
343 | # char => '{' |
344 | # context => '#stay' |
345 | # type => 'DetectChar' |
346 | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
347 | return 1 |
348 | } |
349 | # attribute => 'Symbol' |
350 | # char => '}' |
351 | # context => '#stay' |
352 | # endRegion => 'block1' |
353 | # type => 'DetectChar' |
354 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { |
355 | return 1 |
356 | } |
357 | # String => '#region.*$' |
358 | # attribute => 'Decimal' |
359 | # beginRegion => 'Region1' |
360 | # context => '#stay' |
361 | # type => 'RegExpr' |
362 | if ($self->testRegExpr($text, '#region.*$', 0, 0, 0, undef, 0, '#stay', 'Decimal')) { |
363 | return 1 |
364 | } |
365 | # String => '#endregion.*$' |
366 | # attribute => 'Decimal' |
367 | # context => '#stay' |
368 | # endRegion => 'Region1' |
369 | # type => 'RegExpr' |
370 | if ($self->testRegExpr($text, '#endregion.*$', 0, 0, 0, undef, 0, '#stay', 'Decimal')) { |
371 | return 1 |
372 | } |
373 | # String => '\b[_\w][_\w\d]*(?=[\s]*[(])' |
374 | # attribute => 'Function' |
375 | # context => '#stay' |
376 | # type => 'RegExpr' |
377 | if ($self->testRegExpr($text, '\\b[_\\w][_\\w\\d]*(?=[\\s]*[(])', 0, 0, 0, undef, 0, '#stay', 'Function')) { |
378 | return 1 |
379 | } |
380 | # String => '[.]{1,1}' |
381 | # attribute => 'Symbol' |
382 | # context => 'Member' |
383 | # type => 'RegExpr' |
384 | if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) { |
385 | return 1 |
386 | } |
387 | # String => ':!%&()+,-/.*<=>?[]|~^;' |
388 | # attribute => 'Symbol' |
389 | # context => '#stay' |
390 | # type => 'AnyChar' |
391 | if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) { |
392 | return 1 |
393 | } |
394 | return 0; |
395 | }; |
396 | |
397 | sub parseString { |
398 | my ($self, $text) = @_; |
399 | # attribute => 'String' |
400 | # context => '#pop' |
401 | # type => 'LineContinue' |
402 | if ($self->testLineContinue($text, 0, undef, 0, '#pop', 'String')) { |
403 | return 1 |
404 | } |
405 | # attribute => 'String Char' |
406 | # context => '#stay' |
407 | # type => 'HlCStringChar' |
408 | if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
409 | return 1 |
410 | } |
411 | # attribute => 'String' |
412 | # char => '"' |
413 | # context => '#pop' |
414 | # type => 'DetectChar' |
415 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
416 | return 1 |
417 | } |
418 | return 0; |
419 | }; |
420 | |
421 | |
422 | 1; |
423 | |
424 | __END__ |
425 | |
426 | =head1 NAME |
427 | |
428 | Syntax::Highlight::Engine::Kate::Cdash - a Plugin for C# syntax highlighting |
429 | |
430 | =head1 SYNOPSIS |
431 | |
432 | require Syntax::Highlight::Engine::Kate::Cdash; |
433 | my $sh = new Syntax::Highlight::Engine::Kate::Cdash([ |
434 | ]); |
435 | |
436 | =head1 DESCRIPTION |
437 | |
438 | Syntax::Highlight::Engine::Kate::Cdash is a plugin module that provides syntax highlighting |
439 | for C# to the Syntax::Haghlight::Engine::Kate highlighting engine. |
440 | |
441 | This code is generated from the syntax definition files used |
442 | by the Kate project. |
443 | It works quite fine, but can use refinement and optimization. |
444 | |
445 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
446 | |
447 | =cut |
448 | |
449 | =head1 AUTHOR |
450 | |
451 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
452 | |
453 | =cut |
454 | |
455 | =head1 BUGS |
456 | |
457 | Unknown. If you find any, please contact the author |
458 | |
459 | =cut |
460 | |