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