File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/MIPS_Assembler.pm
Criterion Covered Total %
statement 27 68 39.7
branch 0 36 0.0
condition 1 3 33.3
subroutine 4 7 57.1
pod 0 4 0.0
total 32 118 27.1


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 'mips.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 Dominik Haumann (dhdev@gmx.de)
11             #generated: Sun Feb 3 22:02:05 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::MIPS_Assembler;
14              
15             our $VERSION = '0.14';
16              
17 1     1   2139 use strict;
  1         2  
  1         25  
18 1     1   4 use warnings;
  1         2  
  1         23  
19 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         768  
20              
21             sub new {
22 1     1 0 539 my $proto = shift;
23 1   33     5 my $class = ref($proto) || $proto;
24 1         6 my $self = $class->SUPER::new(@_);
25 1         11 $self->attributes({
26             'Char' => 'Char',
27             'Comment' => 'Comment',
28             'Decimal' => 'DecVal',
29             'Float' => 'Float',
30             'Floating Point Register' => 'Float',
31             'Hardware Instruction' => 'Keyword',
32             'Hex' => 'BaseN',
33             'Label' => 'Others',
34             'Main Register' => 'DataType',
35             'Normal Text' => 'Normal',
36             'Octal' => 'BaseN',
37             'Other Register' => 'DataType',
38             'Pseudo Instruction' => 'Function',
39             'Region Marker' => 'RegionMarker',
40             'Section' => 'DataType',
41             'String' => 'String',
42             'Type' => 'Keyword',
43             });
44 1         6 $self->listAdd('fp',
45             '$f0',
46             '$f1',
47             '$f10',
48             '$f11',
49             '$f12',
50             '$f13',
51             '$f14',
52             '$f15',
53             '$f16',
54             '$f17',
55             '$f18',
56             '$f19',
57             '$f2',
58             '$f20',
59             '$f21',
60             '$f22',
61             '$f23',
62             '$f24',
63             '$f25',
64             '$f26',
65             '$f27',
66             '$f28',
67             '$f29',
68             '$f3',
69             '$f30',
70             '$f31',
71             '$f4',
72             '$f5',
73             '$f6',
74             '$f7',
75             '$f8',
76             '$f9',
77             );
78 1         5 $self->listAdd('hardware',
79             'abs.d',
80             'abs.s',
81             'add',
82             'add.d',
83             'add.s',
84             'addi',
85             'addiu',
86             'addu',
87             'and',
88             'andi',
89             'bc0f',
90             'bc0t',
91             'bc1f',
92             'bc1t',
93             'bc2f',
94             'bc2t',
95             'bc3f',
96             'bc3t',
97             'beq',
98             'bgez',
99             'bgezal',
100             'bgtz',
101             'blez',
102             'bltz',
103             'bltzal',
104             'bne',
105             'break',
106             'c.eq.d',
107             'c.eq.s',
108             'c.le.d',
109             'c.le.s',
110             'c.lt.d',
111             'c.lt.s',
112             'c.ole.d',
113             'c.ole.s',
114             'c.olt.d',
115             'c.olt.s',
116             'c.seq.d',
117             'c.seq.s',
118             'c.ueq.d',
119             'c.ueq.s',
120             'c.ule.d',
121             'c.ule.s',
122             'c.ult.d',
123             'c.ult.s',
124             'c.un.d',
125             'c.un.s',
126             'cvt.d.s',
127             'cvt.d.w',
128             'cvt.s.d',
129             'cvt.s.w',
130             'cvt.w.d',
131             'cvt.w.s',
132             'div.d',
133             'div.s',
134             'j',
135             'jal',
136             'jalr',
137             'jr',
138             'lb',
139             'lbu',
140             'lh',
141             'lhu',
142             'lui',
143             'lw',
144             'lwc0',
145             'lwc1',
146             'lwc2',
147             'lwc3',
148             'lwl',
149             'lwr',
150             'mfc0',
151             'mfc1',
152             'mfc2',
153             'mfc3',
154             'mfhi',
155             'mflo',
156             'mtc0',
157             'mtc1',
158             'mtc2',
159             'mtc3',
160             'mthi',
161             'mtlo',
162             'mul.d',
163             'mul.s',
164             'mult',
165             'multu',
166             'nor',
167             'or',
168             'ori',
169             'rfe',
170             'sb',
171             'sh',
172             'sll',
173             'sllv',
174             'slt',
175             'slti',
176             'sltiu',
177             'sra',
178             'srav',
179             'srl',
180             'srlv',
181             'sub',
182             'sub.d',
183             'sub.s',
184             'subu',
185             'sw',
186             'sw',
187             'swc0',
188             'swc1',
189             'swc2',
190             'swc3',
191             'swcl',
192             'swl',
193             'swl',
194             'swr',
195             'swr',
196             'syscall',
197             'xor',
198             'xori',
199             );
200 1         3 $self->listAdd('pseudo',
201             'abs',
202             'b',
203             'beqz',
204             'bge',
205             'bgeu',
206             'bgt',
207             'bgtu',
208             'ble',
209             'bleu',
210             'blt',
211             'bltu',
212             'bnez',
213             'div',
214             'divu',
215             'l.d',
216             'l.s',
217             'la',
218             'ld',
219             'li',
220             'li.d',
221             'li.s',
222             'mfc0.d',
223             'mfc1.d',
224             'mfc2.d',
225             'mfc3.d',
226             'mov.d',
227             'mov.s',
228             'move',
229             'mul',
230             'mulo',
231             'mulou',
232             'neg',
233             'neg.d',
234             'neg.s',
235             'negu',
236             'nop',
237             'not',
238             'rem',
239             'remu',
240             'rol',
241             'ror',
242             's.d',
243             's.s',
244             'sd',
245             'seq',
246             'sge',
247             'sgeu',
248             'sgt',
249             'sgtu',
250             'sle',
251             'sleu',
252             'sne',
253             'ulh',
254             'ulhu',
255             'ulw',
256             'ush',
257             'usw',
258             );
259 1         3 $self->listAdd('register1',
260             '$0',
261             '$1',
262             '$10',
263             '$11',
264             '$12',
265             '$13',
266             '$14',
267             '$15',
268             '$16',
269             '$17',
270             '$18',
271             '$19',
272             '$2',
273             '$20',
274             '$21',
275             '$22',
276             '$23',
277             '$24',
278             '$25',
279             '$26',
280             '$27',
281             '$28',
282             '$29',
283             '$3',
284             '$30',
285             '$31',
286             '$4',
287             '$5',
288             '$6',
289             '$7',
290             '$8',
291             '$9',
292             '$t0',
293             '$t1',
294             '$t2',
295             '$t3',
296             '$t4',
297             '$t5',
298             '$t6',
299             '$t7',
300             '$t8',
301             '$t9',
302             '$zero',
303             );
304 1         3 $self->listAdd('register2',
305             '$a0',
306             '$a1',
307             '$a2',
308             '$a3',
309             '$at',
310             '$fp',
311             '$gp',
312             '$k0',
313             '$k1',
314             '$ra',
315             '$s0',
316             '$s1',
317             '$s2',
318             '$s3',
319             '$s4',
320             '$s5',
321             '$s6',
322             '$s7',
323             '$sp',
324             '$v0',
325             '$v1',
326             );
327 1         3 $self->listAdd('section',
328             '.data',
329             '.kdata',
330             '.ktext',
331             '.text',
332             );
333 1         3 $self->listAdd('type',
334             '.align',
335             '.ascii',
336             '.asciiz',
337             '.byte',
338             '.double',
339             '.extern',
340             '.float',
341             '.globl',
342             '.half',
343             '.sdata',
344             '.set',
345             '.space',
346             '.word',
347             );
348 1         8 $self->contextdata({
349             'normal' => {
350             callback => \&parsenormal,
351             attribute => 'Normal Text',
352             },
353             'string' => {
354             callback => \&parsestring,
355             attribute => 'String',
356             },
357             });
358 1         6 $self->deliminators('\\s||\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\|\\.');
359 1         4 $self->basecontext('normal');
360 1         4 $self->keywordscase(0);
361 1         3 $self->initialize;
362 1         3 bless ($self, $class);
363 1         2 return $self;
364             }
365              
366             sub language {
367 0     0 0   return 'MIPS Assembler';
368             }
369              
370             sub parsenormal {
371 0     0 0   my ($self, $text) = @_;
372             # String => 'hardware'
373             # attribute => 'Hardware Instruction'
374             # context => '#stay'
375             # type => 'keyword'
376 0 0         if ($self->testKeyword($text, 'hardware', 0, undef, 0, '#stay', 'Hardware Instruction')) {
377 0           return 1
378             }
379             # String => 'pseudo'
380             # attribute => 'Pseudo Instruction'
381             # context => '#stay'
382             # type => 'keyword'
383 0 0         if ($self->testKeyword($text, 'pseudo', 0, undef, 0, '#stay', 'Pseudo Instruction')) {
384 0           return 1
385             }
386             # String => 'register1'
387             # attribute => 'Other Register'
388             # context => '#stay'
389             # type => 'keyword'
390 0 0         if ($self->testKeyword($text, 'register1', 0, undef, 0, '#stay', 'Other Register')) {
391 0           return 1
392             }
393             # String => 'register2'
394             # attribute => 'Main Register'
395             # context => '#stay'
396             # type => 'keyword'
397 0 0         if ($self->testKeyword($text, 'register2', 0, undef, 0, '#stay', 'Main Register')) {
398 0           return 1
399             }
400             # String => 'fp'
401             # attribute => 'Floating Point Register'
402             # context => '#stay'
403             # type => 'keyword'
404 0 0         if ($self->testKeyword($text, 'fp', 0, undef, 0, '#stay', 'Floating Point Register')) {
405 0           return 1
406             }
407             # String => 'section'
408             # attribute => 'Type'
409             # context => '#stay'
410             # type => 'keyword'
411 0 0         if ($self->testKeyword($text, 'section', 0, undef, 0, '#stay', 'Type')) {
412 0           return 1
413             }
414             # String => 'type'
415             # attribute => 'Section'
416             # context => '#stay'
417             # type => 'keyword'
418 0 0         if ($self->testKeyword($text, 'type', 0, undef, 0, '#stay', 'Section')) {
419 0           return 1
420             }
421             # String => '#\s*BEGIN.*$'
422             # attribute => 'Region Marker'
423             # beginRegion => 'region'
424             # context => '#stay'
425             # firstNonSpace => 'true'
426             # type => 'RegExpr'
427 0 0         if ($self->testRegExpr($text, '#\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) {
428 0           return 1
429             }
430             # String => '#\s*END.*$'
431             # attribute => 'Region Marker'
432             # context => '#stay'
433             # endRegion => 'region'
434             # firstNonSpace => 'true'
435             # type => 'RegExpr'
436 0 0         if ($self->testRegExpr($text, '#\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) {
437 0           return 1
438             }
439             # String => '#.*$'
440             # attribute => 'Comment'
441             # context => '#stay'
442             # type => 'RegExpr'
443 0 0         if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) {
444 0           return 1
445             }
446             # String => '[\w_\.]+:'
447             # attribute => 'Label'
448             # context => '#stay'
449             # firstNonSpace => 'true'
450             # type => 'RegExpr'
451 0 0         if ($self->testRegExpr($text, '[\\w_\\.]+:', 0, 0, 0, undef, 1, '#stay', 'Label')) {
452 0           return 1
453             }
454             # attribute => 'String'
455             # char => '"'
456             # context => 'string'
457             # type => 'DetectChar'
458 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
459 0           return 1
460             }
461             # attribute => 'Float'
462             # context => '#stay'
463             # type => 'Float'
464 0 0         if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) {
465 0           return 1
466             }
467             # attribute => 'Octal'
468             # context => '#stay'
469             # type => 'HlCOct'
470 0 0         if ($self->testHlCOct($text, 0, undef, 0, '#stay', 'Octal')) {
471 0           return 1
472             }
473             # attribute => 'Hex'
474             # context => '#stay'
475             # type => 'HlCHex'
476 0 0         if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Hex')) {
477 0           return 1
478             }
479             # attribute => 'Decimal'
480             # context => '#stay'
481             # type => 'Int'
482 0 0         if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) {
483 0           return 1
484             }
485 0           return 0;
486             };
487              
488             sub parsestring {
489 0     0 0   my ($self, $text) = @_;
490             # String => '\\.'
491             # attribute => 'Char'
492             # context => '#stay'
493             # type => 'RegExpr'
494 0 0         if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
495 0           return 1
496             }
497             # attribute => 'String'
498             # char => '"'
499             # context => '#pop'
500             # type => 'DetectChar'
501 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
502 0           return 1
503             }
504 0           return 0;
505             };
506              
507              
508             1;
509              
510             __END__