File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Verilog.pm
Criterion Covered Total %
statement 24 119 20.1
branch 0 76 0.0
condition 1 3 33.3
subroutine 4 14 28.5
pod 0 11 0.0
total 29 223 13.0


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 '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.14';
16              
17 1     1   473 use strict;
  1         3  
  1         24  
18 1     1   4 use warnings;
  1         2  
  1         22  
19 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1145  
20              
21             sub new {
22 1     1 0 611 my $proto = shift;
23 1   33     6 my $class = ref($proto) || $proto;
24 1         6 my $self = $class->SUPER::new(@_);
25 1         17 $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 1         4 $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 1         3 $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 1         2 $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 1         4 $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 1         16 $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 1         5 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
201 1         4 $self->basecontext('Normal');
202 1         4 $self->keywordscase(0);
203 1         4 $self->initialize;
204 1         3 bless ($self, $class);
205 1         2 return $self;
206             }
207              
208             sub language {
209 0     0 0   return 'Verilog';
210             }
211              
212             sub parseBlockname {
213 0     0 0   my ($self, $text) = @_;
214             # String => '[^ ]+'
215             # attribute => 'Data Type'
216             # context => '#pop'
217             # type => 'RegExpr'
218 0 0         if ($self->testRegExpr($text, '[^ ]+', 0, 0, 0, undef, 0, '#pop', 'Data Type')) {
219 0           return 1
220             }
221 0           return 0;
222             };
223              
224             sub parseCommentar1 {
225 0     0 0   my ($self, $text) = @_;
226             # String => '(FIXME|TODO)'
227             # attribute => 'Alert'
228             # context => '#stay'
229             # type => 'RegExpr'
230 0 0         if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
231 0           return 1
232             }
233 0           return 0;
234             };
235              
236             sub parseCommentar2 {
237 0     0 0   my ($self, $text) = @_;
238             # String => '(FIXME|TODO)'
239             # attribute => 'Alert'
240             # context => '#stay'
241             # type => 'RegExpr'
242 0 0         if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
243 0           return 1
244             }
245             # attribute => 'Comment'
246             # char => '*'
247             # char1 => '/'
248             # context => '#pop'
249             # type => 'Detect2Chars'
250 0 0         if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
251 0           return 1
252             }
253 0           return 0;
254             };
255              
256             sub parseCommentarPreprocessor {
257 0     0 0   my ($self, $text) = @_;
258             # attribute => 'Comment'
259             # char => '*'
260             # char1 => '/'
261             # context => '#pop'
262             # type => 'Detect2Chars'
263 0 0         if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
264 0           return 1
265             }
266 0           return 0;
267             };
268              
269             sub parseNormal {
270 0     0 0   my ($self, $text) = @_;
271             # String => 'begin\ *:'
272             # attribute => 'Keyword'
273             # context => 'Block name'
274             # type => 'RegExpr'
275 0 0         if ($self->testRegExpr($text, 'begin\\ *:', 0, 0, 0, undef, 0, 'Block name', 'Keyword')) {
276 0           return 1
277             }
278             # String => 'keywords'
279             # attribute => 'Keyword'
280             # context => '#stay'
281             # type => 'keyword'
282 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
283 0           return 1
284             }
285             # String => 'types'
286             # attribute => 'Data Type'
287             # context => '#stay'
288             # type => 'keyword'
289 0 0         if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
290 0           return 1
291             }
292             # String => 'strength'
293             # attribute => 'Drive/charge strength'
294             # context => '#stay'
295             # type => 'keyword'
296 0 0         if ($self->testKeyword($text, 'strength', 0, undef, 0, '#stay', 'Drive/charge strength')) {
297 0           return 1
298             }
299             # String => 'gates'
300             # attribute => 'Gate instantiation'
301             # context => '#stay'
302             # type => 'keyword'
303 0 0         if ($self->testKeyword($text, 'gates', 0, undef, 0, '#stay', 'Gate instantiation')) {
304 0           return 1
305             }
306             # String => '[a-zA-Z]+[\w$]*'
307             # attribute => 'Normal Text'
308             # context => '#stay'
309             # type => 'RegExpr'
310 0 0         if ($self->testRegExpr($text, '[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
311 0           return 1
312             }
313             # String => '\\[^ ]+ '
314             # attribute => 'Normal Text'
315             # context => '#stay'
316             # type => 'RegExpr'
317 0 0         if ($self->testRegExpr($text, '\\\\[^ ]+ ', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
318 0           return 1
319             }
320             # String => '[\d_]*'d[\d_]+'
321             # attribute => 'Decimal'
322             # context => '#stay'
323             # type => 'RegExpr'
324 0 0         if ($self->testRegExpr($text, '[\\d_]*\'d[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
325 0           return 1
326             }
327             # String => '[\d_]*'o[0-7xXzZ_]+'
328             # attribute => 'Octal'
329             # context => '#stay'
330             # type => 'RegExpr'
331 0 0         if ($self->testRegExpr($text, '[\\d_]*\'o[0-7xXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
332 0           return 1
333             }
334             # String => '[\d_]*'h[\da-fA-FxXzZ_]+'
335             # attribute => 'Hex'
336             # context => '#stay'
337             # type => 'RegExpr'
338 0 0         if ($self->testRegExpr($text, '[\\d_]*\'h[\\da-fA-FxXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Hex')) {
339 0           return 1
340             }
341             # String => '[\d_]*'b[01_zZxX]+'
342             # attribute => 'Binary'
343             # context => '#stay'
344             # type => 'RegExpr'
345 0 0         if ($self->testRegExpr($text, '[\\d_]*\'b[01_zZxX]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
346 0           return 1
347             }
348             # attribute => 'Float'
349             # context => '#stay'
350             # type => 'Float'
351 0 0         if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
352 0           return 1
353             }
354             # attribute => 'Integer'
355             # context => '#stay'
356             # type => 'Int'
357 0 0         if ($self->testInt($text, 0, undef, 0, '#stay', 'Integer')) {
358 0           return 1
359             }
360             # String => '[^\w$]\.[a-zA-Z]+[\w$]*'
361             # attribute => 'Port connection'
362             # context => '#stay'
363             # type => 'RegExpr'
364 0 0         if ($self->testRegExpr($text, '[^\\w$]\\.[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Port connection')) {
365 0           return 1
366             }
367             # attribute => 'String'
368             # char => '"'
369             # context => 'String'
370             # type => 'DetectChar'
371 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
372 0           return 1
373             }
374             # attribute => 'Comment'
375             # char => '/'
376             # char1 => '/'
377             # context => 'Commentar 1'
378             # type => 'Detect2Chars'
379 0 0         if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
380 0           return 1
381             }
382             # attribute => 'Comment'
383             # char => '/'
384             # char1 => '*'
385             # context => 'Commentar 2'
386             # type => 'Detect2Chars'
387 0 0         if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
388 0           return 1
389             }
390             # String => '!%&()+,-<=+/:;>?[]^{|}~@'
391             # attribute => 'Symbol'
392             # context => '#stay'
393             # type => 'AnyChar'
394 0 0         if ($self->testAnyChar($text, '!%&()+,-<=+/:;>?[]^{|}~@', 0, 0, undef, 0, '#stay', 'Symbol')) {
395 0           return 1
396             }
397             # String => '#if 0'
398             # attribute => 'Comment'
399             # context => 'Some Context2'
400             # firstNonSpace => 'true'
401             # insensitive => 'FALSE'
402             # type => 'StringDetect'
403 0 0         if ($self->testStringDetect($text, '#if 0', 0, 0, 0, undef, 1, 'Some Context2', 'Comment')) {
404 0           return 1
405             }
406             # attribute => 'Preprocessor'
407             # char => '`'
408             # column => '0'
409             # context => 'Preprocessor'
410             # type => 'DetectChar'
411 0 0         if ($self->testDetectChar($text, '`', 0, 0, 0, 0, 0, 'Preprocessor', 'Preprocessor')) {
412 0           return 1
413             }
414             # String => '\`[a-zA-Z_]+\w*'
415             # attribute => 'Preprocessor'
416             # context => '#stay'
417             # type => 'RegExpr'
418 0 0         if ($self->testRegExpr($text, '\\`[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) {
419 0           return 1
420             }
421             # String => '\$[a-zA-Z_]+\w*'
422             # attribute => 'System Task'
423             # context => '#stay'
424             # type => 'RegExpr'
425 0 0         if ($self->testRegExpr($text, '\\$[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'System Task')) {
426 0           return 1
427             }
428             # String => '#[\d_]+'
429             # attribute => 'Delay'
430             # context => '#stay'
431             # type => 'RegExpr'
432 0 0         if ($self->testRegExpr($text, '#[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Delay')) {
433 0           return 1
434             }
435 0           return 0;
436             };
437              
438             sub parsePreprocessor {
439 0     0 0   my ($self, $text) = @_;
440             # attribute => 'Preprocessor'
441             # context => 'Some Context'
442             # type => 'LineContinue'
443 0 0         if ($self->testLineContinue($text, 0, undef, 0, 'Some Context', 'Preprocessor')) {
444 0           return 1
445             }
446             # attribute => 'Prep. Lib'
447             # char => '"'
448             # char1 => '"'
449             # context => '#stay'
450             # type => 'RangeDetect'
451 0 0         if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
452 0           return 1
453             }
454             # attribute => 'Prep. Lib'
455             # char => '<'
456             # char1 => '>'
457             # context => '#stay'
458             # type => 'RangeDetect'
459 0 0         if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
460 0           return 1
461             }
462             # attribute => 'Comment'
463             # char => '/'
464             # char1 => '/'
465             # context => 'Commentar 1'
466             # type => 'Detect2Chars'
467 0 0         if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
468 0           return 1
469             }
470             # attribute => 'Comment'
471             # char => '/'
472             # char1 => '*'
473             # context => 'Commentar/Preprocessor'
474             # type => 'Detect2Chars'
475 0 0         if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar/Preprocessor', 'Comment')) {
476 0           return 1
477             }
478 0           return 0;
479             };
480              
481             sub parseSomeContext {
482 0     0 0   my ($self, $text) = @_;
483 0           return 0;
484             };
485              
486             sub parseSomeContext2 {
487 0     0 0   my ($self, $text) = @_;
488             # String => '(FIXME|TODO)'
489             # attribute => 'Alert'
490             # context => '#stay'
491             # type => 'RegExpr'
492 0 0         if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
493 0           return 1
494             }
495             # String => '#endif'
496             # attribute => 'Comment'
497             # context => '#pop'
498             # firstNonSpace => 'true'
499             # type => 'StringDetect'
500 0 0         if ($self->testStringDetect($text, '#endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
501 0           return 1
502             }
503 0           return 0;
504             };
505              
506             sub parseString {
507 0     0 0   my ($self, $text) = @_;
508             # attribute => 'String'
509             # context => 'Some Context'
510             # type => 'LineContinue'
511 0 0         if ($self->testLineContinue($text, 0, undef, 0, 'Some Context', 'String')) {
512 0           return 1
513             }
514             # attribute => 'String Char'
515             # context => '#stay'
516             # type => 'HlCStringChar'
517 0 0         if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
518 0           return 1
519             }
520             # attribute => 'String'
521             # char => '"'
522             # context => '#pop'
523             # type => 'DetectChar'
524 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
525 0           return 1
526             }
527 0           return 0;
528             };
529              
530              
531             1;
532              
533             __END__