Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Verilog.pm
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 'verilog.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 Yevgen Voronenko (ysv22@drexel.edu)
11 #generated: Sun Feb  3 22:02:06 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::Verilog;
14
15 our $VERSION = '0.06';
16
17 use strict;
18 use warnings;
19 use base('Syntax::Highlight::Engine::Kate::Template');
20
21 sub new {
22    my $proto = shift;
23    my $class = ref($proto) || $proto;
24    my $self = $class->SUPER::new(@_);
25    $self->attributes({
26       'Alert' => 'Alert',
27       'Binary' => 'BaseN',
28       'Block name' => 'DataType',
29       'Comment' => 'Comment',
30       'Data Type' => 'DataType',
31       'Decimal' => 'BaseN',
32       'Delay' => 'BaseN',
33       'Drive/charge strength' => 'BaseN',
34       'Float' => 'Float',
35       'Gate instantiation' => 'DataType',
36       'Hex' => 'BaseN',
37       'Integer' => 'DecVal',
38       'Keyword' => 'Keyword',
39       'Normal Text' => 'Normal',
40       'Octal' => 'BaseN',
41       'Port connection' => 'DataType',
42       'Prep. Lib' => 'Float',
43       'Preprocessor' => 'Others',
44       'String' => 'String',
45       'String Char' => 'Char',
46       'Symbol' => 'Normal',
47       'System Task' => 'DataType',
48    });
49    $self->listAdd('gates',
50       'and',
51       'buf',
52       'bufif0',
53       'bufif1',
54       'cmos',
55       'nand',
56       'nmos',
57       'nor',
58       'not',
59       'notif0',
60       'notif1',
61       'or',
62       'pmos',
63       'pulldown',
64       'pullup',
65       'rcmos',
66       'rnmos',
67       'rpmos',
68       'rtran',
69       'rtranif0',
70       'rtranif1',
71       'tran',
72       'tranif0',
73       'tranif1',
74       'xnor',
75       'xor',
76    );
77    $self->listAdd('keywords',
78       'always',
79       'assign',
80       'begin',
81       'case',
82       'casex',
83       'casez',
84       'deassign',
85       'default',
86       'defparam',
87       'disable',
88       'edge',
89       'else',
90       'end',
91       'endcase',
92       'endfunction',
93       'endmodule',
94       'endspecify',
95       'endtable',
96       'endtask',
97       'for',
98       'force',
99       'forever',
100       'fork',
101       'function',
102       'if',
103       'ifnone',
104       'initial',
105       'join',
106       'macromodule',
107       'module',
108       'negedge',
109       'posedge',
110       'release',
111       'repeat',
112       'specify',
113       'specparam',
114       'table',
115       'task',
116       'wait',
117       'while',
118    );
119    $self->listAdd('strength',
120       'highz0',
121       'highz1',
122       'large',
123       'medium',
124       'pull0',
125       'pull1',
126       'small',
127       'strong0',
128       'strong1',
129       'weak0',
130       'weak1',
131    );
132    $self->listAdd('types',
133       'event',
134       'inout',
135       'input',
136       'integer',
137       'output',
138       'parameter',
139       'real',
140       'realtime',
141       'reg',
142       'scalared',
143       'supply0',
144       'supply1',
145       'time',
146       'tri',
147       'tri0',
148       'tri1',
149       'triand',
150       'trior',
151       'trireg',
152       'vectored',
153       'wand',
154       'wire',
155       'wor',
156    );
157    $self->contextdata({
158       'Block name' => {
159          callback => \&parseBlockname,
160          attribute => 'Block name',
161          lineending => '#pop',
162       },
163       'Commentar 1' => {
164          callback => \&parseCommentar1,
165          attribute => 'Comment',
166          lineending => '#pop',
167       },
168       'Commentar 2' => {
169          callback => \&parseCommentar2,
170          attribute => 'Comment',
171       },
172       'Commentar/Preprocessor' => {
173          callback => \&parseCommentarPreprocessor,
174          attribute => 'Comment',
175       },
176       'Normal' => {
177          callback => \&parseNormal,
178          attribute => 'Normal Text',
179       },
180       'Preprocessor' => {
181          callback => \&parsePreprocessor,
182          attribute => 'Preprocessor',
183          lineending => '#pop',
184       },
185       'Some Context' => {
186          callback => \&parseSomeContext,
187          attribute => 'Normal Text',
188          lineending => '#pop',
189       },
190       'Some Context2' => {
191          callback => \&parseSomeContext2,
192          attribute => 'Comment',
193       },
194       'String' => {
195          callback => \&parseString,
196          attribute => 'String',
197          lineending => '#pop',
198       },
199    });
200    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
201    $self->basecontext('Normal');
202    $self->keywordscase(0);
203    $self->initialize;
204    bless ($self, $class);
205    return $self;
206 }
207
208 sub language {
209    return 'Verilog';
210 }
211
212 sub parseBlockname {
213    my ($self, $text) = @_;
214    # String => '[^ ]+'
215    # attribute => 'Data Type'
216    # context => '#pop'
217    # type => 'RegExpr'
218    if ($self->testRegExpr($text, '[^ ]+', 0, 0, 0, undef, 0, '#pop', 'Data Type')) {
219       return 1
220    }
221    return 0;
222 };
223
224 sub parseCommentar1 {
225    my ($self, $text) = @_;
226    # String => '(FIXME|TODO)'
227    # attribute => 'Alert'
228    # context => '#stay'
229    # type => 'RegExpr'
230    if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
231       return 1
232    }
233    return 0;
234 };
235
236 sub parseCommentar2 {
237    my ($self, $text) = @_;
238    # String => '(FIXME|TODO)'
239    # attribute => 'Alert'
240    # context => '#stay'
241    # type => 'RegExpr'
242    if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
243       return 1
244    }
245    # attribute => 'Comment'
246    # char => '*'
247    # char1 => '/'
248    # context => '#pop'
249    # type => 'Detect2Chars'
250    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
251       return 1
252    }
253    return 0;
254 };
255
256 sub parseCommentarPreprocessor {
257    my ($self, $text) = @_;
258    # attribute => 'Comment'
259    # char => '*'
260    # char1 => '/'
261    # context => '#pop'
262    # type => 'Detect2Chars'
263    if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
264       return 1
265    }
266    return 0;
267 };
268
269 sub parseNormal {
270    my ($self, $text) = @_;
271    # String => 'begin\ *:'
272    # attribute => 'Keyword'
273    # context => 'Block name'
274    # type => 'RegExpr'
275    if ($self->testRegExpr($text, 'begin\\ *:', 0, 0, 0, undef, 0, 'Block name', 'Keyword')) {
276       return 1
277    }
278    # String => 'keywords'
279    # attribute => 'Keyword'
280    # context => '#stay'
281    # type => 'keyword'
282    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
283       return 1
284    }
285    # String => 'types'
286    # attribute => 'Data Type'
287    # context => '#stay'
288    # type => 'keyword'
289    if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
290       return 1
291    }
292    # String => 'strength'
293    # attribute => 'Drive/charge strength'
294    # context => '#stay'
295    # type => 'keyword'
296    if ($self->testKeyword($text, 'strength', 0, undef, 0, '#stay', 'Drive/charge strength')) {
297       return 1
298    }
299    # String => 'gates'
300    # attribute => 'Gate instantiation'
301    # context => '#stay'
302    # type => 'keyword'
303    if ($self->testKeyword($text, 'gates', 0, undef, 0, '#stay', 'Gate instantiation')) {
304       return 1
305    }
306    # String => '[a-zA-Z]+[\w$]*'
307    # attribute => 'Normal Text'
308    # context => '#stay'
309    # type => 'RegExpr'
310    if ($self->testRegExpr($text, '[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
311       return 1
312    }
313    # String => '\\[^ ]+ '
314    # attribute => 'Normal Text'
315    # context => '#stay'
316    # type => 'RegExpr'
317    if ($self->testRegExpr($text, '\\\\[^ ]+ ', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
318       return 1
319    }
320    # String => '[\d_]*'d[\d_]+'
321    # attribute => 'Decimal'
322    # context => '#stay'
323    # type => 'RegExpr'
324    if ($self->testRegExpr($text, '[\\d_]*\'d[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
325       return 1
326    }
327    # String => '[\d_]*'o[0-7xXzZ_]+'
328    # attribute => 'Octal'
329    # context => '#stay'
330    # type => 'RegExpr'
331    if ($self->testRegExpr($text, '[\\d_]*\'o[0-7xXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
332       return 1
333    }
334    # String => '[\d_]*'h[\da-fA-FxXzZ_]+'
335    # attribute => 'Hex'
336    # context => '#stay'
337    # type => 'RegExpr'
338    if ($self->testRegExpr($text, '[\\d_]*\'h[\\da-fA-FxXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Hex')) {
339       return 1
340    }
341    # String => '[\d_]*'b[01_zZxX]+'
342    # attribute => 'Binary'
343    # context => '#stay'
344    # type => 'RegExpr'
345    if ($self->testRegExpr($text, '[\\d_]*\'b[01_zZxX]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
346       return 1
347    }
348    # attribute => 'Float'
349    # context => '#stay'
350    # type => 'Float'
351    if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
352       return 1
353    }
354    # attribute => 'Integer'
355    # context => '#stay'
356    # type => 'Int'
357    if ($self->testInt($text, 0, undef, 0, '#stay', 'Integer')) {
358       return 1
359    }
360    # String => '[^\w$]\.[a-zA-Z]+[\w$]*'
361    # attribute => 'Port connection'
362    # context => '#stay'
363    # type => 'RegExpr'
364    if ($self->testRegExpr($text, '[^\\w$]\\.[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Port connection')) {
365       return 1
366    }
367    # attribute => 'String'
368    # char => '"'
369    # context => 'String'
370    # type => 'DetectChar'
371    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
372       return 1
373    }
374    # attribute => 'Comment'
375    # char => '/'
376    # char1 => '/'
377    # context => 'Commentar 1'
378    # type => 'Detect2Chars'
379    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
380       return 1
381    }
382    # attribute => 'Comment'
383    # char => '/'
384    # char1 => '*'
385    # context => 'Commentar 2'
386    # type => 'Detect2Chars'
387    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
388       return 1
389    }
390    # String => '!%&()+,-<=+/:;>?[]^{|}~@'
391    # attribute => 'Symbol'
392    # context => '#stay'
393    # type => 'AnyChar'
394    if ($self->testAnyChar($text, '!%&()+,-<=+/:;>?[]^{|}~@', 0, 0, undef, 0, '#stay', 'Symbol')) {
395       return 1
396    }
397    # String => '#if 0'
398    # attribute => 'Comment'
399    # context => 'Some Context2'
400    # firstNonSpace => 'true'
401    # insensitive => 'FALSE'
402    # type => 'StringDetect'
403    if ($self->testStringDetect($text, '#if 0', 0, 0, 0, undef, 1, 'Some Context2', 'Comment')) {
404       return 1
405    }
406    # attribute => 'Preprocessor'
407    # char => '`'
408    # column => '0'
409    # context => 'Preprocessor'
410    # type => 'DetectChar'
411    if ($self->testDetectChar($text, '`', 0, 0, 0, 0, 0, 'Preprocessor', 'Preprocessor')) {
412       return 1
413    }
414    # String => '\`[a-zA-Z_]+\w*'
415    # attribute => 'Preprocessor'
416    # context => '#stay'
417    # type => 'RegExpr'
418    if ($self->testRegExpr($text, '\\`[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) {
419       return 1
420    }
421    # String => '\$[a-zA-Z_]+\w*'
422    # attribute => 'System Task'
423    # context => '#stay'
424    # type => 'RegExpr'
425    if ($self->testRegExpr($text, '\\$[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'System Task')) {
426       return 1
427    }
428    # String => '#[\d_]+'
429    # attribute => 'Delay'
430    # context => '#stay'
431    # type => 'RegExpr'
432    if ($self->testRegExpr($text, '#[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Delay')) {
433       return 1
434    }
435    return 0;
436 };
437
438 sub parsePreprocessor {
439    my ($self, $text) = @_;
440    # attribute => 'Preprocessor'
441    # context => 'Some Context'
442    # type => 'LineContinue'
443    if ($self->testLineContinue($text, 0, undef, 0, 'Some Context', 'Preprocessor')) {
444       return 1
445    }
446    # attribute => 'Prep. Lib'
447    # char => '"'
448    # char1 => '"'
449    # context => '#stay'
450    # type => 'RangeDetect'
451    if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
452       return 1
453    }
454    # attribute => 'Prep. Lib'
455    # char => '<'
456    # char1 => '>'
457    # context => '#stay'
458    # type => 'RangeDetect'
459    if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
460       return 1
461    }
462    # attribute => 'Comment'
463    # char => '/'
464    # char1 => '/'
465    # context => 'Commentar 1'
466    # type => 'Detect2Chars'
467    if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
468       return 1
469    }
470    # attribute => 'Comment'
471    # char => '/'
472    # char1 => '*'
473    # context => 'Commentar/Preprocessor'
474    # type => 'Detect2Chars'
475    if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar/Preprocessor', 'Comment')) {
476       return 1
477    }
478    return 0;
479 };
480
481 sub parseSomeContext {
482    my ($self, $text) = @_;
483    return 0;
484 };
485
486 sub parseSomeContext2 {
487    my ($self, $text) = @_;
488    # String => '(FIXME|TODO)'
489    # attribute => 'Alert'
490    # context => '#stay'
491    # type => 'RegExpr'
492    if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
493       return 1
494    }
495    # String => '#endif'
496    # attribute => 'Comment'
497    # context => '#pop'
498    # firstNonSpace => 'true'
499    # type => 'StringDetect'
500    if ($self->testStringDetect($text, '#endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
501       return 1
502    }
503    return 0;
504 };
505
506 sub parseString {
507    my ($self, $text) = @_;
508    # attribute => 'String'
509    # context => 'Some Context'
510    # type => 'LineContinue'
511    if ($self->testLineContinue($text, 0, undef, 0, 'Some Context', 'String')) {
512       return 1
513    }
514    # attribute => 'String Char'
515    # context => '#stay'
516    # type => 'HlCStringChar'
517    if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
518       return 1
519    }
520    # attribute => 'String'
521    # char => '"'
522    # context => '#pop'
523    # type => 'DetectChar'
524    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
525       return 1
526    }
527    return 0;
528 };
529
530
531 1;
532
533 __END__
534
535 =head1 NAME
536
537 Syntax::Highlight::Engine::Kate::Verilog - a Plugin for Verilog syntax highlighting
538
539 =head1 SYNOPSIS
540
541  require Syntax::Highlight::Engine::Kate::Verilog;
542  my $sh = new Syntax::Highlight::Engine::Kate::Verilog([
543  ]);
544
545 =head1 DESCRIPTION
546
547 Syntax::Highlight::Engine::Kate::Verilog is a  plugin module that provides syntax highlighting
548 for Verilog to the Syntax::Haghlight::Engine::Kate highlighting engine.
549
550 This code is generated from the syntax definition files used
551 by the Kate project.
552 It works quite fine, but can use refinement and optimization.
553
554 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
555
556 =cut
557
558 =head1 AUTHOR
559
560 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
561
562 =cut
563
564 =head1 BUGS
565
566 Unknown. If you find any, please contact the author
567
568 =cut
569