File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/AHDL.pm
Criterion Covered Total %
statement 23 86 26.7
branch 0 56 0.0
condition 1 3 33.3
subroutine 4 8 50.0
pod 0 5 0.0
total 28 158 17.7


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 'ahdl.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.04
9             #kate version 2.4
10             #kate author Dominik Haumann (dhdev@gmx.de)
11             #generated: Sun Feb 3 22:02:04 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::AHDL;
14              
15             our $VERSION = '0.14';
16              
17 1     1   597 use strict;
  1         2  
  1         28  
18 1     1   4 use warnings;
  1         2  
  1         29  
19 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         789  
20              
21             sub new {
22 1     1 0 1031 my $proto = shift;
23 1   33     6 my $class = ref($proto) || $proto;
24 1         9 my $self = $class->SUPER::new(@_);
25 1         11 $self->attributes({
26             'Bit' => 'DecVal',
27             'Char' => 'Char',
28             'Comment' => 'Comment',
29             'Data Type' => 'DataType',
30             'Decimal' => 'DecVal',
31             'Hex' => 'BaseN',
32             'Keyword' => 'Keyword',
33             'Normal Text' => 'Normal',
34             'Octal' => 'BaseN',
35             'Operator' => 'Others',
36             'Region Marker' => 'RegionMarker',
37             'String' => 'String',
38             });
39 1         7 $self->listAdd('keywords',
40             'assert',
41             'bidir',
42             'bits',
43             'buried',
44             'case',
45             'clique',
46             'connected_pins',
47             'constant',
48             'defaults',
49             'define',
50             'design',
51             'device',
52             'else',
53             'elsif',
54             'for',
55             'function',
56             'generate',
57             'gnd',
58             'help_id',
59             'in',
60             'include',
61             'input',
62             'is',
63             'machine',
64             'node',
65             'of',
66             'options',
67             'others',
68             'output',
69             'parameters',
70             'returns',
71             'states',
72             'subdesign',
73             'then',
74             'title',
75             'to',
76             'tri_state_node',
77             'variable',
78             'vcc',
79             'when',
80             'with',
81             );
82 1         2 $self->listAdd('operator',
83             'and',
84             'ceil',
85             'div',
86             'floor',
87             'log2',
88             'mod',
89             'nand',
90             'nor',
91             'not',
92             'or',
93             'used',
94             'xnor',
95             'xor',
96             );
97 1         4 $self->listAdd('types',
98             'carry',
99             'cascade',
100             'dff',
101             'dffe',
102             'exp',
103             'global',
104             'jkff',
105             'jkffe',
106             'latch',
107             'lcell',
108             'mcell',
109             'memory',
110             'opendrn',
111             'soft',
112             'srff',
113             'srffe',
114             'tff',
115             'tffe',
116             'tri',
117             'wire',
118             'x',
119             );
120 1         11 $self->contextdata({
121             'comment' => {
122             callback => \&parsecomment,
123             attribute => 'Comment',
124             },
125             'normal' => {
126             callback => \&parsenormal,
127             attribute => 'Normal Text',
128             },
129             'string' => {
130             callback => \&parsestring,
131             attribute => 'String',
132             },
133             });
134 1         5 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
135 1         4 $self->basecontext('normal');
136 1         6 $self->keywordscase(0);
137 1         3 $self->initialize;
138 1         2 bless ($self, $class);
139 1         3 return $self;
140             }
141              
142             sub language {
143 0     0 0   return 'AHDL';
144             }
145              
146             sub parsecomment {
147 0     0 0   my ($self, $text) = @_;
148             # attribute => 'Comment'
149             # char => '%'
150             # context => '#pop'
151             # type => 'DetectChar'
152 0 0         if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
153 0           return 1
154             }
155 0           return 0;
156             };
157              
158             sub parsenormal {
159 0     0 0   my ($self, $text) = @_;
160             # String => '\bdefaults\b'
161             # attribute => 'Keyword'
162             # beginRegion => 'def'
163             # context => '#stay'
164             # insensitive => 'true'
165             # type => 'RegExpr'
166 0 0         if ($self->testRegExpr($text, '\\bdefaults\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
167 0           return 1
168             }
169             # String => '\bend\s+defaults\b'
170             # attribute => 'Keyword'
171             # context => '#stay'
172             # endRegion => 'def'
173             # insensitive => 'true'
174             # type => 'RegExpr'
175 0 0         if ($self->testRegExpr($text, '\\bend\\s+defaults\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
176 0           return 1
177             }
178             # String => '\bif\b'
179             # attribute => 'Keyword'
180             # beginRegion => 'if'
181             # context => '#stay'
182             # insensitive => 'true'
183             # type => 'RegExpr'
184 0 0         if ($self->testRegExpr($text, '\\bif\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
185 0           return 1
186             }
187             # String => '\bend\s+if\b'
188             # attribute => 'Keyword'
189             # context => '#stay'
190             # endRegion => 'if'
191             # insensitive => 'true'
192             # type => 'RegExpr'
193 0 0         if ($self->testRegExpr($text, '\\bend\\s+if\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
194 0           return 1
195             }
196             # String => '\btable\b'
197             # attribute => 'Keyword'
198             # beginRegion => 'table'
199             # context => '#stay'
200             # insensitive => 'true'
201             # type => 'RegExpr'
202 0 0         if ($self->testRegExpr($text, '\\btable\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
203 0           return 1
204             }
205             # String => '\bend\s+table\b'
206             # attribute => 'Keyword'
207             # context => '#stay'
208             # endRegion => 'table'
209             # insensitive => 'true'
210             # type => 'RegExpr'
211 0 0         if ($self->testRegExpr($text, '\\bend\\s+table\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
212 0           return 1
213             }
214             # String => '\bcase\b'
215             # attribute => 'Keyword'
216             # beginRegion => 'case'
217             # context => '#stay'
218             # insensitive => 'true'
219             # type => 'RegExpr'
220 0 0         if ($self->testRegExpr($text, '\\bcase\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
221 0           return 1
222             }
223             # String => '\bend\s+case\b'
224             # attribute => 'Keyword'
225             # context => '#stay'
226             # endRegion => 'case'
227             # insensitive => 'true'
228             # type => 'RegExpr'
229 0 0         if ($self->testRegExpr($text, '\\bend\\s+case\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
230 0           return 1
231             }
232             # String => '\bbegin\b'
233             # attribute => 'Keyword'
234             # beginRegion => 'block'
235             # context => '#stay'
236             # insensitive => 'true'
237             # type => 'RegExpr'
238 0 0         if ($self->testRegExpr($text, '\\bbegin\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
239 0           return 1
240             }
241             # String => '\bend\b'
242             # attribute => 'Keyword'
243             # context => '#stay'
244             # endRegion => 'block'
245             # insensitive => 'true'
246             # type => 'RegExpr'
247 0 0         if ($self->testRegExpr($text, '\\bend\\b', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
248 0           return 1
249             }
250             # attribute => 'Normal Text'
251             # beginRegion => 'bracket'
252             # char => '('
253             # context => '#stay'
254             # type => 'DetectChar'
255 0 0         if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
256 0           return 1
257             }
258             # attribute => 'Normal Text'
259             # char => ')'
260             # context => '#stay'
261             # endRegion => 'bracket'
262             # type => 'DetectChar'
263 0 0         if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
264 0           return 1
265             }
266             # String => 'keywords'
267             # attribute => 'Keyword'
268             # context => '#stay'
269             # type => 'keyword'
270 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
271 0           return 1
272             }
273             # String => 'types'
274             # attribute => 'Data Type'
275             # context => '#stay'
276             # type => 'keyword'
277 0 0         if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
278 0           return 1
279             }
280             # String => 'operator'
281             # attribute => 'Operator'
282             # context => '#stay'
283             # type => 'keyword'
284 0 0         if ($self->testKeyword($text, 'operator', 0, undef, 0, '#stay', 'Operator')) {
285 0           return 1
286             }
287             # String => '\b(\d+)\b'
288             # attribute => 'Decimal'
289             # context => '#stay'
290             # type => 'RegExpr'
291 0 0         if ($self->testRegExpr($text, '\\b(\\d+)\\b', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
292 0           return 1
293             }
294             # String => '\bb"(0|1|x)+"'
295             # attribute => 'Bit'
296             # context => '#stay'
297             # insensitive => 'true'
298             # type => 'RegExpr'
299 0 0         if ($self->testRegExpr($text, '\\bb"(0|1|x)+"', 1, 0, 0, undef, 0, '#stay', 'Bit')) {
300 0           return 1
301             }
302             # String => '\b(o|q)"[0-7*]"'
303             # attribute => 'Octal'
304             # context => '#stay'
305             # insensitive => 'true'
306             # type => 'RegExpr'
307 0 0         if ($self->testRegExpr($text, '\\b(o|q)"[0-7*]"', 1, 0, 0, undef, 0, '#stay', 'Octal')) {
308 0           return 1
309             }
310             # String => '\b(h|x)"[0-9a-f]*"'
311             # attribute => 'Hex'
312             # context => '#stay'
313             # insensitive => 'true'
314             # type => 'RegExpr'
315 0 0         if ($self->testRegExpr($text, '\\b(h|x)"[0-9a-f]*"', 1, 0, 0, undef, 0, '#stay', 'Hex')) {
316 0           return 1
317             }
318             # attribute => 'String'
319             # char => '"'
320             # context => 'string'
321             # type => 'DetectChar'
322 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
323 0           return 1
324             }
325             # String => '--\s*BEGIN.*$'
326             # attribute => 'Region Marker'
327             # beginRegion => 'region'
328             # context => '#stay'
329             # firstNonSpace => 'true'
330             # type => 'RegExpr'
331 0 0         if ($self->testRegExpr($text, '--\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) {
332 0           return 1
333             }
334             # String => '--\s*END.*$'
335             # attribute => 'Region Marker'
336             # context => '#stay'
337             # endRegion => 'region'
338             # firstNonSpace => 'true'
339             # type => 'RegExpr'
340 0 0         if ($self->testRegExpr($text, '--\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) {
341 0           return 1
342             }
343             # String => '--.*$'
344             # attribute => 'Comment'
345             # context => '#stay'
346             # type => 'RegExpr'
347 0 0         if ($self->testRegExpr($text, '--.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
348 0           return 1
349             }
350             # attribute => 'Comment'
351             # char => '%'
352             # context => 'comment'
353             # type => 'DetectChar'
354 0 0         if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'comment', 'Comment')) {
355 0           return 1
356             }
357             # attribute => 'Char'
358             # context => '#stay'
359             # type => 'HlCChar'
360 0 0         if ($self->testHlCChar($text, 0, undef, 0, '#stay', 'Char')) {
361 0           return 1
362             }
363 0           return 0;
364             };
365              
366             sub parsestring {
367 0     0 0   my ($self, $text) = @_;
368             # attribute => 'Char'
369             # char => '\'
370             # char1 => '"'
371             # context => '#stay'
372             # type => 'Detect2Chars'
373 0 0         if ($self->testDetect2Chars($text, '\\', '"', 0, 0, 0, undef, 0, '#stay', 'Char')) {
374 0           return 1
375             }
376             # attribute => 'String'
377             # char => '"'
378             # context => '#pop'
379             # type => 'DetectChar'
380 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
381 0           return 1
382             }
383 0           return 0;
384             };
385              
386              
387             1;
388              
389             __END__