Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / C.pm
CommitLineData
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 'c.xml' file of the syntax highlight
6# engine of the kate text editor (http://www.kate-editor.org
7
8#kate xml version 1.25
9#kate version 2.4
10#generated: Sun Feb 3 22:02:04 2008, localtime
11
12package Syntax::Highlight::Engine::Kate::C;
13
14our $VERSION = '0.06';
15
16use strict;
17use warnings;
18use base('Syntax::Highlight::Engine::Kate::Template');
19
20sub new {
21 my $proto = shift;
22 my $class = ref($proto) || $proto;
23 my $self = $class->SUPER::new(@_);
24 $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 'Keyword' => 'Keyword',
33 'Normal Text' => 'Normal',
34 'Octal' => 'BaseN',
35 'Prep. Lib' => 'Others',
36 'Preprocessor' => 'Others',
37 'Region Marker' => 'RegionMarker',
38 'String' => 'String',
39 'String Char' => 'Char',
40 'Symbol' => 'Normal',
41 });
42 $self->listAdd('keywords',
43 'break',
44 'case',
45 'continue',
46 'default',
47 'do',
48 'else',
49 'enum',
50 'extern',
51 'for',
52 'goto',
53 'if',
54 'inline',
55 'return',
56 'sizeof',
57 'struct',
58 'switch',
59 'typedef',
60 'union',
61 'while',
62 );
63 $self->listAdd('types',
64 '_Bool',
65 '_Complex',
66 '_Imaginary',
67 'auto',
68 'char',
69 'const',
70 'double',
71 'float',
72 'int',
73 'long',
74 'register',
75 'restrict',
76 'short',
77 'signed',
78 'static',
79 'unsigned',
80 'void',
81 'volatile',
82 );
83 $self->contextdata({
84 'Commentar 1' => {
85 callback => \&parseCommentar1,
86 attribute => 'Comment',
87 lineending => '#pop',
88 },
89 'Commentar 2' => {
90 callback => \&parseCommentar2,
91 attribute => 'Comment',
92 },
93 'Commentar/Preprocessor' => {
94 callback => \&parseCommentarPreprocessor,
95 attribute => 'Comment',
96 },
97 'Define' => {
98 callback => \&parseDefine,
99 attribute => 'Preprocessor',
100 lineending => '#pop',
101 },
102 'Normal' => {
103 callback => \&parseNormal,
104 attribute => 'Normal Text',
105 },
106 'Outscoped' => {
107 callback => \&parseOutscoped,
108 attribute => 'Comment',
109 },
110 'Outscoped intern' => {
111 callback => \&parseOutscopedintern,
112 attribute => 'Comment',
113 },
114 'Preprocessor' => {
115 callback => \&parsePreprocessor,
116 attribute => 'Preprocessor',
117 lineending => '#pop',
118 },
119 'Region Marker' => {
120 callback => \&parseRegionMarker,
121 attribute => 'Region Marker',
122 lineending => '#pop',
123 },
124 'String' => {
125 callback => \&parseString,
126 attribute => 'String',
127 lineending => '#pop',
128 },
129 });
130 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
131 $self->basecontext('Normal');
132 $self->keywordscase(0);
133 $self->initialize;
134 bless ($self, $class);
135 return $self;
136}
137
138sub language {
139 return 'C';
140}
141
142sub parseCommentar1 {
143 my ($self, $text) = @_;
144 # context => '##Alerts'
145 # type => 'IncludeRules'
146 if ($self->includePlugin('Alerts', $text)) {
147 return 1
148 }
149 return 0;
150};
151
152sub parseCommentar2 {
153 my ($self, $text) = @_;
154 # attribute => 'Comment'
155 # char => '*'
156 # char1 => '/'
157 # context => '#pop'
158 # endRegion => 'Comment'
159 # type => 'Detect2Chars'
160 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
161 return 1
162 }
163 # context => '##Alerts'
164 # type => 'IncludeRules'
165 if ($self->includePlugin('Alerts', $text)) {
166 return 1
167 }
168 return 0;
169};
170
171sub parseCommentarPreprocessor {
172 my ($self, $text) = @_;
173 # attribute => 'Comment'
174 # char => '*'
175 # char1 => '/'
176 # context => '#pop'
177 # endRegion => 'Comment2'
178 # type => 'Detect2Chars'
179 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
180 return 1
181 }
182 return 0;
183};
184
185sub parseDefine {
186 my ($self, $text) = @_;
187 # attribute => 'Preprocessor'
188 # context => '#stay'
189 # type => 'LineContinue'
190 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) {
191 return 1
192 }
193 return 0;
194};
195
196sub parseNormal {
197 my ($self, $text) = @_;
198 # type => 'DetectSpaces'
199 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
200 return 1
201 }
202 # String => '#\s*if\s+0'
203 # attribute => 'Preprocessor'
204 # beginRegion => 'Outscoped'
205 # context => 'Outscoped'
206 # firstNonSpace => 'true'
207 # type => 'RegExpr'
208 if ($self->testRegExpr($text, '#\\s*if\\s+0', 0, 0, 0, undef, 1, 'Outscoped', 'Preprocessor')) {
209 return 1
210 }
211 # attribute => 'Preprocessor'
212 # char => '#'
213 # context => 'Preprocessor'
214 # firstNonSpace => 'true'
215 # type => 'DetectChar'
216 if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Preprocessor', 'Preprocessor')) {
217 return 1
218 }
219 # String => '//BEGIN'
220 # attribute => 'Region Marker'
221 # beginRegion => 'Region1'
222 # context => 'Region Marker'
223 # firstNonSpace => 'true'
224 # type => 'StringDetect'
225 if ($self->testStringDetect($text, '//BEGIN', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
226 return 1
227 }
228 # String => '//END'
229 # attribute => 'Region Marker'
230 # context => 'Region Marker'
231 # endRegion => 'Region1'
232 # firstNonSpace => 'true'
233 # type => 'StringDetect'
234 if ($self->testStringDetect($text, '//END', 0, 0, 0, undef, 1, 'Region Marker', 'Region Marker')) {
235 return 1
236 }
237 # String => 'keywords'
238 # attribute => 'Keyword'
239 # context => '#stay'
240 # type => 'keyword'
241 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
242 return 1
243 }
244 # String => 'types'
245 # attribute => 'Data Type'
246 # context => '#stay'
247 # type => 'keyword'
248 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
249 return 1
250 }
251 # type => 'DetectIdentifier'
252 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
253 return 1
254 }
255 # attribute => 'Symbol'
256 # beginRegion => 'Brace1'
257 # char => '{'
258 # context => '#stay'
259 # type => 'DetectChar'
260 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
261 return 1
262 }
263 # attribute => 'Symbol'
264 # char => '}'
265 # context => '#stay'
266 # endRegion => 'Brace1'
267 # type => 'DetectChar'
268 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) {
269 return 1
270 }
271 # attribute => 'Float'
272 # context => '#stay'
273 # items => 'ARRAY(0x12df8b0)'
274 # type => 'Float'
275 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
276 # String => 'fF'
277 # attribute => 'Float'
278 # context => '#stay'
279 # type => 'AnyChar'
280 if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) {
281 return 1
282 }
283 }
284 # attribute => 'Octal'
285 # context => '#stay'
286 # type => 'HlCOct'
287 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
288 return 1
289 }
290 # attribute => 'Hex'
291 # context => '#stay'
292 # type => 'HlCHex'
293 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
294 return 1
295 }
296 # attribute => 'Decimal'
297 # context => '#stay'
298 # items => 'ARRAY(0x12207d0)'
299 # type => 'Int'
300 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
301 # String => 'ULL'
302 # attribute => 'Decimal'
303 # context => '#stay'
304 # insensitive => 'TRUE'
305 # type => 'StringDetect'
306 if ($self->testStringDetect($text, 'ULL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
307 return 1
308 }
309 # String => 'LUL'
310 # attribute => 'Decimal'
311 # context => '#stay'
312 # insensitive => 'TRUE'
313 # type => 'StringDetect'
314 if ($self->testStringDetect($text, 'LUL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
315 return 1
316 }
317 # String => 'LLU'
318 # attribute => 'Decimal'
319 # context => '#stay'
320 # insensitive => 'TRUE'
321 # type => 'StringDetect'
322 if ($self->testStringDetect($text, 'LLU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
323 return 1
324 }
325 # String => 'UL'
326 # attribute => 'Decimal'
327 # context => '#stay'
328 # insensitive => 'TRUE'
329 # type => 'StringDetect'
330 if ($self->testStringDetect($text, 'UL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
331 return 1
332 }
333 # String => 'LU'
334 # attribute => 'Decimal'
335 # context => '#stay'
336 # insensitive => 'TRUE'
337 # type => 'StringDetect'
338 if ($self->testStringDetect($text, 'LU', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
339 return 1
340 }
341 # String => 'LL'
342 # attribute => 'Decimal'
343 # context => '#stay'
344 # insensitive => 'TRUE'
345 # type => 'StringDetect'
346 if ($self->testStringDetect($text, 'LL', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
347 return 1
348 }
349 # String => 'U'
350 # attribute => 'Decimal'
351 # context => '#stay'
352 # insensitive => 'TRUE'
353 # type => 'StringDetect'
354 if ($self->testStringDetect($text, 'U', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
355 return 1
356 }
357 # String => 'L'
358 # attribute => 'Decimal'
359 # context => '#stay'
360 # insensitive => 'TRUE'
361 # type => 'StringDetect'
362 if ($self->testStringDetect($text, 'L', 1, 0, 0, undef, 0, '#stay', 'Decimal')) {
363 return 1
364 }
365 }
366 # attribute => 'Char'
367 # context => '#stay'
368 # type => 'HlCChar'
369 if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
370 return 1
371 }
372 # attribute => 'String'
373 # char => '"'
374 # context => 'String'
375 # type => 'DetectChar'
376 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
377 return 1
378 }
379 # context => '##Doxygen'
380 # type => 'IncludeRules'
381 if ($self->includePlugin('Doxygen', $text)) {
382 return 1
383 }
384 # attribute => 'Comment'
385 # char => '/'
386 # char1 => '/'
387 # context => 'Commentar 1'
388 # type => 'Detect2Chars'
389 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
390 return 1
391 }
392 # attribute => 'Comment'
393 # beginRegion => 'Comment'
394 # char => '/'
395 # char1 => '*'
396 # context => 'Commentar 2'
397 # type => 'Detect2Chars'
398 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
399 return 1
400 }
401 # String => ':!%&()+,-/.*<=>?[]|~^;'
402 # attribute => 'Symbol'
403 # context => '#stay'
404 # type => 'AnyChar'
405 if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) {
406 return 1
407 }
408 return 0;
409};
410
411sub parseOutscoped {
412 my ($self, $text) = @_;
413 # type => 'DetectSpaces'
414 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
415 return 1
416 }
417 # context => '##Alerts'
418 # type => 'IncludeRules'
419 if ($self->includePlugin('Alerts', $text)) {
420 return 1
421 }
422 # type => 'DetectIdentifier'
423 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
424 return 1
425 }
426 # attribute => 'String'
427 # char => '"'
428 # context => 'String'
429 # type => 'DetectChar'
430 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
431 return 1
432 }
433 # context => '##Doxygen'
434 # type => 'IncludeRules'
435 if ($self->includePlugin('Doxygen', $text)) {
436 return 1
437 }
438 # attribute => 'Comment'
439 # char => '/'
440 # char1 => '/'
441 # context => 'Commentar 1'
442 # type => 'Detect2Chars'
443 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
444 return 1
445 }
446 # attribute => 'Comment'
447 # beginRegion => 'Comment'
448 # char => '/'
449 # char1 => '*'
450 # context => 'Commentar 2'
451 # type => 'Detect2Chars'
452 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
453 return 1
454 }
455 # String => '#\s*if'
456 # attribute => 'Comment'
457 # beginRegion => 'Outscoped'
458 # context => 'Outscoped intern'
459 # firstNonSpace => 'true'
460 # type => 'RegExpr'
461 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
462 return 1
463 }
464 # String => '#\s*(endif|else|elif)'
465 # attribute => 'Preprocessor'
466 # context => '#pop'
467 # endRegion => 'Outscoped'
468 # firstNonSpace => 'true'
469 # type => 'RegExpr'
470 if ($self->testRegExpr($text, '#\\s*(endif|else|elif)', 0, 0, 0, undef, 1, '#pop', 'Preprocessor')) {
471 return 1
472 }
473 return 0;
474};
475
476sub parseOutscopedintern {
477 my ($self, $text) = @_;
478 # type => 'DetectSpaces'
479 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
480 return 1
481 }
482 # context => '##Alerts'
483 # type => 'IncludeRules'
484 if ($self->includePlugin('Alerts', $text)) {
485 return 1
486 }
487 # type => 'DetectIdentifier'
488 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) {
489 return 1
490 }
491 # attribute => 'String'
492 # char => '"'
493 # context => 'String'
494 # type => 'DetectChar'
495 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
496 return 1
497 }
498 # context => '##Doxygen'
499 # type => 'IncludeRules'
500 if ($self->includePlugin('Doxygen', $text)) {
501 return 1
502 }
503 # attribute => 'Comment'
504 # char => '/'
505 # char1 => '/'
506 # context => 'Commentar 1'
507 # type => 'Detect2Chars'
508 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
509 return 1
510 }
511 # attribute => 'Comment'
512 # beginRegion => 'Comment'
513 # char => '/'
514 # char1 => '*'
515 # context => 'Commentar 2'
516 # type => 'Detect2Chars'
517 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
518 return 1
519 }
520 # String => '#\s*if'
521 # attribute => 'Comment'
522 # beginRegion => 'Outscoped'
523 # context => 'Outscoped intern'
524 # firstNonSpace => 'true'
525 # type => 'RegExpr'
526 if ($self->testRegExpr($text, '#\\s*if', 0, 0, 0, undef, 1, 'Outscoped intern', 'Comment')) {
527 return 1
528 }
529 # String => '#\s*endif'
530 # attribute => 'Comment'
531 # context => '#pop'
532 # endRegion => 'Outscoped'
533 # firstNonSpace => 'true'
534 # type => 'RegExpr'
535 if ($self->testRegExpr($text, '#\\s*endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
536 return 1
537 }
538 return 0;
539};
540
541sub parsePreprocessor {
542 my ($self, $text) = @_;
543 # attribute => 'Preprocessor'
544 # context => '#stay'
545 # type => 'LineContinue'
546 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'Preprocessor')) {
547 return 1
548 }
549 # String => 'define.*((?=\\))'
550 # attribute => 'Preprocessor'
551 # context => 'Define'
552 # type => 'RegExpr'
553 if ($self->testRegExpr($text, 'define.*((?=\\\\))', 0, 0, 0, undef, 0, 'Define', 'Preprocessor')) {
554 return 1
555 }
556 # String => 'define.*'
557 # attribute => 'Preprocessor'
558 # context => '#stay'
559 # type => 'RegExpr'
560 if ($self->testRegExpr($text, 'define.*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) {
561 return 1
562 }
563 # attribute => 'Prep. Lib'
564 # char => '"'
565 # char1 => '"'
566 # context => '#stay'
567 # type => 'RangeDetect'
568 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
569 return 1
570 }
571 # attribute => 'Prep. Lib'
572 # char => '<'
573 # char1 => '>'
574 # context => '#stay'
575 # type => 'RangeDetect'
576 if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
577 return 1
578 }
579 # context => '##Doxygen'
580 # type => 'IncludeRules'
581 if ($self->includePlugin('Doxygen', $text)) {
582 return 1
583 }
584 # attribute => 'Comment'
585 # beginRegion => 'Comment2'
586 # char => '/'
587 # char1 => '*'
588 # context => 'Commentar/Preprocessor'
589 # type => 'Detect2Chars'
590 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar/Preprocessor', 'Comment')) {
591 return 1
592 }
593 return 0;
594};
595
596sub parseRegionMarker {
597 my ($self, $text) = @_;
598 return 0;
599};
600
601sub parseString {
602 my ($self, $text) = @_;
603 # attribute => 'String'
604 # context => '#stay'
605 # type => 'LineContinue'
606 if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) {
607 return 1
608 }
609 # attribute => 'String Char'
610 # context => '#stay'
611 # type => 'HlCStringChar'
612 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
613 return 1
614 }
615 # attribute => 'String'
616 # char => '"'
617 # context => '#pop'
618 # type => 'DetectChar'
619 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
620 return 1
621 }
622 return 0;
623};
624
625
6261;
627
628__END__
629
630=head1 NAME
631
632Syntax::Highlight::Engine::Kate::C - a Plugin for C syntax highlighting
633
634=head1 SYNOPSIS
635
636 require Syntax::Highlight::Engine::Kate::C;
637 my $sh = new Syntax::Highlight::Engine::Kate::C([
638 ]);
639
640=head1 DESCRIPTION
641
642Syntax::Highlight::Engine::Kate::C is a plugin module that provides syntax highlighting
643for C to the Syntax::Haghlight::Engine::Kate highlighting engine.
644
645This code is generated from the syntax definition files used
646by the Kate project.
647It works quite fine, but can use refinement and optimization.
648
649It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
650
651=cut
652
653=head1 AUTHOR
654
655Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
656
657=cut
658
659=head1 BUGS
660
661Unknown. If you find any, please contact the author
662
663=cut
664