File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/ABC.pm
Criterion Covered Total %
statement 54 83 65.0
branch 26 46 56.5
condition 1 3 33.3
subroutine 8 13 61.5
pod 0 10 0.0
total 89 155 57.4


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 'abc.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.10
9             #kate version 2.4
10             #kate author Andrea Primiani (primiani@dag.it)
11             #generated: Sun Feb 3 22:02:04 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::ABC;
14              
15             our $VERSION = '0.14';
16              
17 1     1   454 use strict;
  1         2  
  1         23  
18 1     1   4 use warnings;
  1         2  
  1         20  
19 1     1   4 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         773  
20              
21             sub new {
22 2     2 0 425 my $proto = shift;
23 2   33     9 my $class = ref($proto) || $proto;
24 2         9 my $self = $class->SUPER::new(@_);
25 2         26 $self->attributes({
26             'Bar' => 'Char',
27             'Comment' => 'Comment',
28             'Decoration' => 'Float',
29             'Header' => 'Float',
30             'Lyrics' => 'DataType',
31             'Normal Text' => 'Normal',
32             'Notes' => 'Keyword',
33             'Preprocessor' => 'String',
34             'Sharp' => 'Normal',
35             'Slur' => 'DataType',
36             'String' => 'String',
37             'Tuplet' => 'DataType',
38             });
39 2         24 $self->contextdata({
40             'Bar' => {
41             callback => \&parseBar,
42             attribute => 'Bar',
43             lineending => '#pop',
44             },
45             'Comment' => {
46             callback => \&parseComment,
47             attribute => 'Comment',
48             lineending => '#pop',
49             },
50             'Header' => {
51             callback => \&parseHeader,
52             attribute => 'Header',
53             },
54             'Header2' => {
55             callback => \&parseHeader2,
56             attribute => 'Header',
57             lineending => '#pop',
58             },
59             'Lyrics' => {
60             callback => \&parseLyrics,
61             attribute => 'Lyrics',
62             lineending => '#pop',
63             },
64             'Normal' => {
65             callback => \&parseNormal,
66             attribute => 'Normal Text',
67             },
68             'Part' => {
69             callback => \&parsePart,
70             attribute => 'Header',
71             lineending => '#pop',
72             },
73             'Preprocessor' => {
74             callback => \&parsePreprocessor,
75             attribute => 'Preprocessor',
76             lineending => '#pop',
77             },
78             });
79 2         7 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
80 2         7 $self->basecontext('Normal');
81 2         7 $self->keywordscase(0);
82 2         4 $self->initialize;
83 2         3 bless ($self, $class);
84 2         9 return $self;
85             }
86              
87             sub language {
88 0     0 0 0 return 'ABC';
89             }
90              
91             sub parseBar {
92 46     46 0 72 my ($self, $text) = @_;
93             # attribute => 'Normal Text'
94             # char => '"'
95             # context => '#pop'
96             # type => 'DetectChar'
97 46 50       121 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
98 0         0 return 1
99             }
100             # String => '[A-Ga-gZz]'
101             # attribute => 'Normal Text'
102             # context => '#pop'
103             # type => 'RegExpr'
104 46 100       94 if ($self->testRegExpr($text, '[A-Ga-gZz]', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
105 40         82 return 1
106             }
107             # attribute => 'Normal Text'
108             # char => ' '
109             # context => '#pop'
110             # type => 'DetectChar'
111 6 50       16 if ($self->testDetectChar($text, ' ', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
112 0         0 return 1
113             }
114             # attribute => 'Decoration'
115             # char => '!'
116             # char1 => '!'
117             # context => '#stay'
118             # type => 'RangeDetect'
119 6 50       17 if ($self->testRangeDetect($text, '!', '!', 0, 0, undef, 0, '#stay', 'Decoration')) {
120 0         0 return 1
121             }
122             # String => '()'
123             # attribute => 'Slur'
124             # context => '#stay'
125             # type => 'AnyChar'
126 6 50       17 if ($self->testAnyChar($text, '()', 0, 0, undef, 0, '#stay', 'Slur')) {
127 0         0 return 1
128             }
129             # String => ':*\|*[1-9]|/*\|'
130             # attribute => 'Bar'
131             # context => '#pop'
132             # type => 'RegExpr'
133 6 100       15 if ($self->testRegExpr($text, ':*\\|*[1-9]|/*\\|', 0, 0, 0, undef, 0, '#pop', 'Bar')) {
134 4         8 return 1
135             }
136 2         6 return 0;
137             };
138              
139             sub parseComment {
140 114     114 0 156 my ($self, $text) = @_;
141 114         169 return 0;
142             };
143              
144             sub parseHeader {
145 0     0 0 0 my ($self, $text) = @_;
146             # String => 'K:.+'
147             # attribute => 'Header'
148             # column => '0'
149             # context => '#pop'
150             # endRegion => 'header'
151             # type => 'RegExpr'
152 0 0       0 if ($self->testRegExpr($text, 'K:.+', 0, 0, 0, 0, 0, '#pop', 'Header')) {
153 0         0 return 1
154             }
155             # attribute => 'Header'
156             # char => ']'
157             # context => '#pop'
158             # type => 'DetectChar'
159 0 0       0 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Header')) {
160 0         0 return 1
161             }
162 0         0 return 0;
163             };
164              
165             sub parseHeader2 {
166 98     98 0 129 my ($self, $text) = @_;
167 98         158 return 0;
168             };
169              
170             sub parseLyrics {
171 0     0 0 0 my ($self, $text) = @_;
172 0         0 return 0;
173             };
174              
175             sub parseNormal {
176 352     352 0 521 my ($self, $text) = @_;
177             # String => '\([23456789]:?[23456789]?:?[23456789]?'
178             # attribute => 'Tuplet'
179             # context => '#stay'
180             # type => 'RegExpr'
181 352 50       652 if ($self->testRegExpr($text, '\\([23456789]:?[23456789]?:?[23456789]?', 0, 0, 0, undef, 0, '#stay', 'Tuplet')) {
182 0         0 return 1
183             }
184             # attribute => 'String'
185             # char => '"'
186             # char1 => '"'
187             # context => '#stay'
188             # type => 'RangeDetect'
189 352 50       858 if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'String')) {
190 0         0 return 1
191             }
192             # attribute => 'Decoration'
193             # char => '!'
194             # char1 => '!'
195             # context => '#stay'
196             # type => 'RangeDetect'
197 352 50       797 if ($self->testRangeDetect($text, '!', '!', 0, 0, undef, 0, '#stay', 'Decoration')) {
198 0         0 return 1
199             }
200             # String => '\[[ABCGHILMNOQRSTUVZ]:'
201             # attribute => 'Header'
202             # context => 'Header'
203             # type => 'RegExpr'
204 352 50       808 if ($self->testRegExpr($text, '\\[[ABCGHILMNOQRSTUVZ]:', 0, 0, 0, undef, 0, 'Header', 'Header')) {
205 0         0 return 1
206             }
207             # String => '[ABCGHILMNOPQRSTUVZ]:'
208             # attribute => 'Header'
209             # context => 'Header2'
210             # type => 'RegExpr'
211 352 100       743 if ($self->testRegExpr($text, '[ABCGHILMNOPQRSTUVZ]:', 0, 0, 0, undef, 0, 'Header2', 'Header')) {
212 12         25 return 1
213             }
214             # attribute => 'Header'
215             # beginRegion => 'header'
216             # char => 'X'
217             # char1 => ':'
218             # column => '0'
219             # context => 'Header'
220             # type => 'Detect2Chars'
221 340 50       779 if ($self->testDetect2Chars($text, 'X', ':', 0, 0, 0, 0, 0, 'Header', 'Header')) {
222 0         0 return 1
223             }
224             # String => '|:['
225             # attribute => 'Bar'
226             # context => 'Bar'
227             # type => 'AnyChar'
228 340 100       707 if ($self->testAnyChar($text, '|:[', 0, 0, undef, 0, 'Bar', 'Bar')) {
229 44         99 return 1
230             }
231             # attribute => 'Bar'
232             # char => ']'
233             # context => '#stay'
234             # type => 'DetectChar'
235 296 50       567 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#stay', 'Bar')) {
236 0         0 return 1
237             }
238             # String => '()'
239             # attribute => 'Slur'
240             # context => '#stay'
241             # type => 'AnyChar'
242 296 50       550 if ($self->testAnyChar($text, '()', 0, 0, undef, 0, '#stay', 'Slur')) {
243 0         0 return 1
244             }
245             # String => '{}'
246             # attribute => 'Slur'
247             # context => '#stay'
248             # type => 'AnyChar'
249 296 50       554 if ($self->testAnyChar($text, '{}', 0, 0, undef, 0, '#stay', 'Slur')) {
250 0         0 return 1
251             }
252             # attribute => 'Lyrics'
253             # char => 'W'
254             # char1 => ':'
255             # context => 'Lyrics'
256             # type => 'Detect2Chars'
257 296 50       570 if ($self->testDetect2Chars($text, 'W', ':', 0, 0, 0, undef, 0, 'Lyrics', 'Lyrics')) {
258 0         0 return 1
259             }
260             # attribute => 'Lyrics'
261             # char => 'w'
262             # char1 => ':'
263             # context => 'Lyrics'
264             # type => 'Detect2Chars'
265 296 50       607 if ($self->testDetect2Chars($text, 'w', ':', 0, 0, 0, undef, 0, 'Lyrics', 'Lyrics')) {
266 0         0 return 1
267             }
268             # attribute => 'Preprocessor'
269             # char => '%'
270             # char1 => '%'
271             # context => 'Preprocessor'
272             # type => 'Detect2Chars'
273 296 50       592 if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Preprocessor', 'Preprocessor')) {
274 0         0 return 1
275             }
276             # attribute => 'Comment'
277             # char => '%'
278             # context => 'Comment'
279             # type => 'DetectChar'
280 296 100       587 if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
281 2         5 return 1
282             }
283             # String => '[_|\^]?[_|=|\^][A-Ga-g]'
284             # attribute => 'Sharp'
285             # context => '#stay'
286             # type => 'RegExpr'
287 294 50       604 if ($self->testRegExpr($text, '[_|\\^]?[_|=|\\^][A-Ga-g]', 0, 0, 0, undef, 0, '#stay', 'Sharp')) {
288 0         0 return 1
289             }
290 294         599 return 0;
291             };
292              
293             sub parsePart {
294 0     0 0   my ($self, $text) = @_;
295 0           return 0;
296             };
297              
298             sub parsePreprocessor {
299 0     0 0   my ($self, $text) = @_;
300 0           return 0;
301             };
302              
303              
304             1;
305              
306             __END__