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.
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
10 #kate author Yevgen Voronenko (ysv22@drexel.edu)
11 #generated: Sun Feb 3 22:02:06 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Verilog;
15 our $VERSION = '0.06';
19 use base('Syntax::Highlight::Engine::Kate::Template');
23 my $class = ref($proto) || $proto;
24 my $self = $class->SUPER::new(@_);
28 'Block name' => 'DataType',
29 'Comment' => 'Comment',
30 'Data Type' => 'DataType',
33 'Drive/charge strength' => 'BaseN',
35 'Gate instantiation' => 'DataType',
37 'Integer' => 'DecVal',
38 'Keyword' => 'Keyword',
39 'Normal Text' => 'Normal',
41 'Port connection' => 'DataType',
42 'Prep. Lib' => 'Float',
43 'Preprocessor' => 'Others',
45 'String Char' => 'Char',
47 'System Task' => 'DataType',
49 $self->listAdd('gates',
77 $self->listAdd('keywords',
119 $self->listAdd('strength',
132 $self->listAdd('types',
159 callback => \&parseBlockname,
160 attribute => 'Block name',
161 lineending => '#pop',
164 callback => \&parseCommentar1,
165 attribute => 'Comment',
166 lineending => '#pop',
169 callback => \&parseCommentar2,
170 attribute => 'Comment',
172 'Commentar/Preprocessor' => {
173 callback => \&parseCommentarPreprocessor,
174 attribute => 'Comment',
177 callback => \&parseNormal,
178 attribute => 'Normal Text',
181 callback => \&parsePreprocessor,
182 attribute => 'Preprocessor',
183 lineending => '#pop',
186 callback => \&parseSomeContext,
187 attribute => 'Normal Text',
188 lineending => '#pop',
191 callback => \&parseSomeContext2,
192 attribute => 'Comment',
195 callback => \&parseString,
196 attribute => 'String',
197 lineending => '#pop',
200 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
201 $self->basecontext('Normal');
202 $self->keywordscase(0);
204 bless ($self, $class);
213 my ($self, $text) = @_;
215 # attribute => 'Data Type'
218 if ($self->testRegExpr($text, '[^ ]+', 0, 0, 0, undef, 0, '#pop', 'Data Type')) {
224 sub parseCommentar1 {
225 my ($self, $text) = @_;
226 # String => '(FIXME|TODO)'
227 # attribute => 'Alert'
230 if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
236 sub parseCommentar2 {
237 my ($self, $text) = @_;
238 # String => '(FIXME|TODO)'
239 # attribute => 'Alert'
242 if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
245 # attribute => 'Comment'
249 # type => 'Detect2Chars'
250 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
256 sub parseCommentarPreprocessor {
257 my ($self, $text) = @_;
258 # attribute => 'Comment'
262 # type => 'Detect2Chars'
263 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
270 my ($self, $text) = @_;
271 # String => 'begin\ *:'
272 # attribute => 'Keyword'
273 # context => 'Block name'
275 if ($self->testRegExpr($text, 'begin\\ *:', 0, 0, 0, undef, 0, 'Block name', 'Keyword')) {
278 # String => 'keywords'
279 # attribute => 'Keyword'
282 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
286 # attribute => 'Data Type'
289 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
292 # String => 'strength'
293 # attribute => 'Drive/charge strength'
296 if ($self->testKeyword($text, 'strength', 0, undef, 0, '#stay', 'Drive/charge strength')) {
300 # attribute => 'Gate instantiation'
303 if ($self->testKeyword($text, 'gates', 0, undef, 0, '#stay', 'Gate instantiation')) {
306 # String => '[a-zA-Z]+[\w$]*'
307 # attribute => 'Normal Text'
310 if ($self->testRegExpr($text, '[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
313 # String => '\\[^ ]+ '
314 # attribute => 'Normal Text'
317 if ($self->testRegExpr($text, '\\\\[^ ]+ ', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
320 # String => '[\d_]*'d[\d_]+'
321 # attribute => 'Decimal'
324 if ($self->testRegExpr($text, '[\\d_]*\'d[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
327 # String => '[\d_]*'o[0-7xXzZ_]+'
328 # attribute => 'Octal'
331 if ($self->testRegExpr($text, '[\\d_]*\'o[0-7xXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
334 # String => '[\d_]*'h[\da-fA-FxXzZ_]+'
338 if ($self->testRegExpr($text, '[\\d_]*\'h[\\da-fA-FxXzZ_]+', 0, 0, 0, undef, 0, '#stay', 'Hex')) {
341 # String => '[\d_]*'b[01_zZxX]+'
342 # attribute => 'Binary'
345 if ($self->testRegExpr($text, '[\\d_]*\'b[01_zZxX]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
348 # attribute => 'Float'
351 if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
354 # attribute => 'Integer'
357 if ($self->testInt($text, 0, undef, 0, '#stay', 'Integer')) {
360 # String => '[^\w$]\.[a-zA-Z]+[\w$]*'
361 # attribute => 'Port connection'
364 if ($self->testRegExpr($text, '[^\\w$]\\.[a-zA-Z]+[\\w$]*', 0, 0, 0, undef, 0, '#stay', 'Port connection')) {
367 # attribute => 'String'
369 # context => 'String'
370 # type => 'DetectChar'
371 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
374 # attribute => 'Comment'
377 # context => 'Commentar 1'
378 # type => 'Detect2Chars'
379 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
382 # attribute => 'Comment'
385 # context => 'Commentar 2'
386 # type => 'Detect2Chars'
387 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
390 # String => '!%&()+,-<=+/:;>?[]^{|}~@'
391 # attribute => 'Symbol'
394 if ($self->testAnyChar($text, '!%&()+,-<=+/:;>?[]^{|}~@', 0, 0, undef, 0, '#stay', 'Symbol')) {
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')) {
406 # attribute => 'Preprocessor'
409 # context => 'Preprocessor'
410 # type => 'DetectChar'
411 if ($self->testDetectChar($text, '`', 0, 0, 0, 0, 0, 'Preprocessor', 'Preprocessor')) {
414 # String => '\`[a-zA-Z_]+\w*'
415 # attribute => 'Preprocessor'
418 if ($self->testRegExpr($text, '\\`[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'Preprocessor')) {
421 # String => '\$[a-zA-Z_]+\w*'
422 # attribute => 'System Task'
425 if ($self->testRegExpr($text, '\\$[a-zA-Z_]+\\w*', 0, 0, 0, undef, 0, '#stay', 'System Task')) {
428 # String => '#[\d_]+'
429 # attribute => 'Delay'
432 if ($self->testRegExpr($text, '#[\\d_]+', 0, 0, 0, undef, 0, '#stay', 'Delay')) {
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')) {
446 # attribute => 'Prep. Lib'
450 # type => 'RangeDetect'
451 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
454 # attribute => 'Prep. Lib'
458 # type => 'RangeDetect'
459 if ($self->testRangeDetect($text, '<', '>', 0, 0, undef, 0, '#stay', 'Prep. Lib')) {
462 # attribute => 'Comment'
465 # context => 'Commentar 1'
466 # type => 'Detect2Chars'
467 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
470 # attribute => 'Comment'
473 # context => 'Commentar/Preprocessor'
474 # type => 'Detect2Chars'
475 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar/Preprocessor', 'Comment')) {
481 sub parseSomeContext {
482 my ($self, $text) = @_;
486 sub parseSomeContext2 {
487 my ($self, $text) = @_;
488 # String => '(FIXME|TODO)'
489 # attribute => 'Alert'
492 if ($self->testRegExpr($text, '(FIXME|TODO)', 0, 0, 0, undef, 0, '#stay', 'Alert')) {
496 # attribute => 'Comment'
498 # firstNonSpace => 'true'
499 # type => 'StringDetect'
500 if ($self->testStringDetect($text, '#endif', 0, 0, 0, undef, 1, '#pop', 'Comment')) {
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')) {
514 # attribute => 'String Char'
516 # type => 'HlCStringChar'
517 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
520 # attribute => 'String'
523 # type => 'DetectChar'
524 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
537 Syntax::Highlight::Engine::Kate::Verilog - a Plugin for Verilog syntax highlighting
541 require Syntax::Highlight::Engine::Kate::Verilog;
542 my $sh = new Syntax::Highlight::Engine::Kate::Verilog([
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.
550 This code is generated from the syntax definition files used
552 It works quite fine, but can use refinement and optimization.
554 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
560 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
566 Unknown. If you find any, please contact the author