File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/AVR_Assembler.pm
Criterion Covered Total %
statement 53 72 73.6
branch 26 38 68.4
condition 1 3 33.3
subroutine 7 11 63.6
pod 0 8 0.0
total 87 132 65.9


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 'asm-avr.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.03
9             #kate version 2.4
10             #kate author Roland Nagy
11             #generated: Sun Feb 3 22:02:04 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::AVR_Assembler;
14              
15             our $VERSION = '0.16';
16              
17 1     1   1394 use strict;
  1         3  
  1         90  
18 1     1   9 use warnings;
  1         2  
  1         112  
19 1     1   8 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         1378  
20              
21             sub new {
22 2     2 0 1040 my $proto = shift;
23 2   33     40 my $class = ref($proto) || $proto;
24 2         20 my $self = $class->SUPER::new(@_);
25 2         33 $self->attributes({
26             'Binary' => 'BaseN',
27             'Char' => 'Char',
28             'Comment' => 'Comment',
29             'Decimal' => 'DecVal',
30             'Float' => 'Float',
31             'Hex' => 'BaseN',
32             'Keyword' => 'Keyword',
33             'Label' => 'Function',
34             'Normal Text' => 'Normal',
35             'Octal' => 'BaseN',
36             'Preprocessor' => 'Others',
37             'String' => 'String',
38             'String Char' => 'Char',
39             'Symbol' => 'Normal',
40             });
41 2         32 $self->listAdd('keywords',
42             'adc',
43             'add',
44             'adiw',
45             'and',
46             'andi',
47             'asr',
48             'bclr',
49             'bld',
50             'brbc',
51             'brbs',
52             'break',
53             'breq',
54             'brge',
55             'brhc',
56             'brhs',
57             'brid',
58             'brie',
59             'brlo',
60             'brlt',
61             'brmi',
62             'brne',
63             'brpl',
64             'brsh',
65             'brtc',
66             'brts',
67             'brvc',
68             'brvs',
69             'bset',
70             'bst',
71             'call',
72             'cbi',
73             'cbr',
74             'clc',
75             'clh',
76             'cli',
77             'cln',
78             'clr',
79             'cls',
80             'clt',
81             'clv',
82             'clz',
83             'com',
84             'cp',
85             'cpc',
86             'cpi',
87             'cpse',
88             'dec',
89             'eicall',
90             'eijmp',
91             'elpm',
92             'eor',
93             'fmul',
94             'fmuls',
95             'fmulsu',
96             'icall',
97             'ijmp',
98             'in',
99             'inc',
100             'jmp',
101             'ld',
102             'ldi',
103             'lds',
104             'lpm',
105             'lsl',
106             'lsr',
107             'mov',
108             'movw',
109             'mul',
110             'muls',
111             'mulsu',
112             'neg',
113             'nop',
114             'or',
115             'ori',
116             'out',
117             'pop',
118             'push',
119             'rcall',
120             'ret',
121             'reti',
122             'rjmp',
123             'rol',
124             'ror',
125             'sbc',
126             'sbci',
127             'sbi',
128             'sbic',
129             'sbis',
130             'sbiw',
131             'sbr',
132             'sbrc',
133             'sbrs',
134             'sec',
135             'seh',
136             'sei',
137             'sen',
138             'ser',
139             'ses',
140             'set',
141             'sev',
142             'sez',
143             'sleep',
144             'spm',
145             'st',
146             'sts',
147             'sub',
148             'subi',
149             'swap',
150             'tst',
151             'wdr',
152             );
153 2         40 $self->contextdata({
154             'Commentar 1' => {
155             callback => \&parseCommentar1,
156             attribute => 'Comment',
157             },
158             'Commentar 2' => {
159             callback => \&parseCommentar2,
160             attribute => 'Comment',
161             lineending => '#pop',
162             },
163             'Normal' => {
164             callback => \&parseNormal,
165             attribute => 'Normal Text',
166             },
167             'Preprocessor' => {
168             callback => \&parsePreprocessor,
169             attribute => 'Preprocessor',
170             lineending => '#pop',
171             },
172             'Some Context' => {
173             callback => \&parseSomeContext,
174             attribute => 'Normal Text',
175             lineending => '#pop',
176             },
177             'String' => {
178             callback => \&parseString,
179             attribute => 'String',
180             lineending => '#pop',
181             },
182             });
183 2         24 $self->deliminators('\\s||\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|_|\\.|\\$');
184 2         11 $self->basecontext('Normal');
185 2         14 $self->keywordscase(0);
186 2         9 $self->initialize;
187 2         6 bless ($self, $class);
188 2         13 return $self;
189             }
190              
191             sub language {
192 0     0 0 0 return 'AVR Assembler';
193             }
194              
195             sub parseCommentar1 {
196 0     0 0 0 my ($self, $text) = @_;
197             # attribute => 'Comment'
198             # char => '*'
199             # char1 => '/'
200             # context => '#pop'
201             # type => 'Detect2Chars'
202 0 0       0 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
203 0         0 return 1
204             }
205 0         0 return 0;
206             };
207              
208             sub parseCommentar2 {
209 2262     2262 0 5890 my ($self, $text) = @_;
210 2262         10850 return 0;
211             };
212              
213             sub parseNormal {
214 712     712 0 1810 my ($self, $text) = @_;
215             # String => '[A-Za-z0-9_.$]+:'
216             # attribute => 'Label'
217             # context => '#stay'
218             # firstNonSpace => 'true'
219             # type => 'RegExpr'
220 712 100       3615 if ($self->testRegExpr($text, '[A-Za-z0-9_.$]+:', 0, 0, 0, undef, 1, '#stay', 'Label')) {
221 8         27 return 1
222             }
223             # String => 'keywords'
224             # attribute => 'Keyword'
225             # context => '#stay'
226             # type => 'keyword'
227 704 100       9617 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
228 36         146 return 1
229             }
230             # attribute => 'Octal'
231             # context => '#stay'
232             # type => 'HlCOct'
233 668 50       2805 if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
234 0         0 return 1
235             }
236             # attribute => 'Hex'
237             # context => '#stay'
238             # type => 'HlCHex'
239 668 50       3510 if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
240 0         0 return 1
241             }
242             # String => '0[bB][01]+'
243             # attribute => 'Binary'
244             # context => '#stay'
245             # type => 'RegExpr'
246 668 50       6551 if ($self->testRegExpr($text, '0[bB][01]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
247 0         0 return 1
248             }
249             # attribute => 'Decimal'
250             # context => '#stay'
251             # type => 'Int'
252 668 100       3086 if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
253 4         15 return 1
254             }
255             # String => '0[fFeEdD][-+]?[0-9]*\.?[0-9]*[eE]?[-+]?[0-9]+'
256             # attribute => 'Float'
257             # context => '#stay'
258             # type => 'RegExpr'
259 664 50       3199 if ($self->testRegExpr($text, '0[fFeEdD][-+]?[0-9]*\\.?[0-9]*[eE]?[-+]?[0-9]+', 0, 0, 0, undef, 0, '#stay', 'Float')) {
260 0         0 return 1
261             }
262             # String => '[A-Za-z_.$][A-Za-z0-9_.$]*'
263             # attribute => 'Normal Text'
264             # context => '#stay'
265             # type => 'RegExpr'
266 664 100       2490 if ($self->testRegExpr($text, '[A-Za-z_.$][A-Za-z0-9_.$]*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
267 72         320 return 1
268             }
269             # String => ''(\\x[0-9a-fA-F][0-9a-fA-F]?|\\[0-7]?[0-7]?[0-7]?|\\.|.)'
270             # attribute => 'Char'
271             # context => '#stay'
272             # type => 'RegExpr'
273 592 50       3134 if ($self->testRegExpr($text, '\'(\\\\x[0-9a-fA-F][0-9a-fA-F]?|\\\\[0-7]?[0-7]?[0-7]?|\\\\.|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
274 0         0 return 1
275             }
276             # attribute => 'String'
277             # char => '"'
278             # context => 'String'
279             # type => 'DetectChar'
280 592 100       2908 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
281 2         8 return 1
282             }
283             # attribute => 'Comment'
284             # char => '/'
285             # char1 => '*'
286             # context => 'Commentar 1'
287             # type => 'Detect2Chars'
288 590 50       2300 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Commentar 1', 'Comment')) {
289 0         0 return 1
290             }
291             # attribute => 'Comment'
292             # char => '@'
293             # context => 'Commentar 2'
294             # type => 'DetectChar'
295 590 50       2239 if ($self->testDetectChar($text, '@', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
296 0         0 return 1
297             }
298             # attribute => 'Comment'
299             # char => ';'
300             # context => 'Commentar 2'
301             # type => 'DetectChar'
302 590 100       1867 if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, 'Commentar 2', 'Comment')) {
303 80         346 return 1
304             }
305             # String => '!#%&*()+,-<=>?/:[]^{|}~'
306             # attribute => 'Symbol'
307             # context => '#stay'
308             # type => 'AnyChar'
309 510 100       2116 if ($self->testAnyChar($text, '!#%&*()+,-<=>?/:[]^{|}~', 0, 0, undef, 0, '#stay', 'Symbol')) {
310 20         75 return 1
311             }
312             # String => '^#'
313             # attribute => 'Preprocessor'
314             # context => 'Preprocessor'
315             # type => 'RegExpr'
316 490 50       5639 if ($self->testRegExpr($text, '^#', 0, 0, 0, undef, 0, 'Preprocessor', 'Preprocessor')) {
317 0         0 return 1
318             }
319 490         1502 return 0;
320             };
321              
322             sub parsePreprocessor {
323 0     0 0 0 my ($self, $text) = @_;
324 0         0 return 0;
325             };
326              
327             sub parseSomeContext {
328 0     0 0 0 my ($self, $text) = @_;
329 0         0 return 0;
330             };
331              
332             sub parseString {
333 24     24 0 65 my ($self, $text) = @_;
334             # attribute => 'String'
335             # context => 'Some Context'
336             # type => 'LineContinue'
337 24 50       74 if ($self->testLineContinue($text, 0, undef, 0, 'Some Context', 'String')) {
338 0         0 return 1
339             }
340             # attribute => 'String Char'
341             # context => '#stay'
342             # type => 'HlCStringChar'
343 24 50       92 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
344 0         0 return 1
345             }
346             # attribute => 'String'
347             # char => '"'
348             # context => '#pop'
349             # type => 'DetectChar'
350 24 100       69 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
351 2         7 return 1
352             }
353 22         48 return 0;
354             };
355              
356              
357             1;
358              
359             __END__