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
13package Syntax::Highlight::Engine::Kate::ABC;
14
15our $VERSION = '0.14';
16
17use strict;
18use warnings;
19use base('Syntax::Highlight::Engine::Kate::Template');
20
21sub new {
22   my $proto = shift;
23   my $class = ref($proto) || $proto;
24   my $self = $class->SUPER::new(@_);
25   $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   $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   $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
80   $self->basecontext('Normal');
81   $self->keywordscase(0);
82   $self->initialize;
83   bless ($self, $class);
84   return $self;
85}
86
87sub language {
88   return 'ABC';
89}
90
91sub parseBar {
92   my ($self, $text) = @_;
93   # attribute => 'Normal Text'
94   # char => '"'
95   # context => '#pop'
96   # type => 'DetectChar'
97   if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
98      return 1
99   }
100   # String => '[A-Ga-gZz]'
101   # attribute => 'Normal Text'
102   # context => '#pop'
103   # type => 'RegExpr'
104   if ($self->testRegExpr($text, '[A-Ga-gZz]', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
105      return 1
106   }
107   # attribute => 'Normal Text'
108   # char => ' '
109   # context => '#pop'
110   # type => 'DetectChar'
111   if ($self->testDetectChar($text, ' ', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
112      return 1
113   }
114   # attribute => 'Decoration'
115   # char => '!'
116   # char1 => '!'
117   # context => '#stay'
118   # type => 'RangeDetect'
119   if ($self->testRangeDetect($text, '!', '!', 0, 0, undef, 0, '#stay', 'Decoration')) {
120      return 1
121   }
122   # String => '()'
123   # attribute => 'Slur'
124   # context => '#stay'
125   # type => 'AnyChar'
126   if ($self->testAnyChar($text, '()', 0, 0, undef, 0, '#stay', 'Slur')) {
127      return 1
128   }
129   # String => ':*\|*[1-9]|/*\|'
130   # attribute => 'Bar'
131   # context => '#pop'
132   # type => 'RegExpr'
133   if ($self->testRegExpr($text, ':*\\|*[1-9]|/*\\|', 0, 0, 0, undef, 0, '#pop', 'Bar')) {
134      return 1
135   }
136   return 0;
137};
138
139sub parseComment {
140   my ($self, $text) = @_;
141   return 0;
142};
143
144sub parseHeader {
145   my ($self, $text) = @_;
146   # String => 'K:.+'
147   # attribute => 'Header'
148   # column => '0'
149   # context => '#pop'
150   # endRegion => 'header'
151   # type => 'RegExpr'
152   if ($self->testRegExpr($text, 'K:.+', 0, 0, 0, 0, 0, '#pop', 'Header')) {
153      return 1
154   }
155   # attribute => 'Header'
156   # char => ']'
157   # context => '#pop'
158   # type => 'DetectChar'
159   if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Header')) {
160      return 1
161   }
162   return 0;
163};
164
165sub parseHeader2 {
166   my ($self, $text) = @_;
167   return 0;
168};
169
170sub parseLyrics {
171   my ($self, $text) = @_;
172   return 0;
173};
174
175sub parseNormal {
176   my ($self, $text) = @_;
177   # String => '\([23456789]:?[23456789]?:?[23456789]?'
178   # attribute => 'Tuplet'
179   # context => '#stay'
180   # type => 'RegExpr'
181   if ($self->testRegExpr($text, '\\([23456789]:?[23456789]?:?[23456789]?', 0, 0, 0, undef, 0, '#stay', 'Tuplet')) {
182      return 1
183   }
184   # attribute => 'String'
185   # char => '"'
186   # char1 => '"'
187   # context => '#stay'
188   # type => 'RangeDetect'
189   if ($self->testRangeDetect($text, '"', '"', 0, 0, undef, 0, '#stay', 'String')) {
190      return 1
191   }
192   # attribute => 'Decoration'
193   # char => '!'
194   # char1 => '!'
195   # context => '#stay'
196   # type => 'RangeDetect'
197   if ($self->testRangeDetect($text, '!', '!', 0, 0, undef, 0, '#stay', 'Decoration')) {
198      return 1
199   }
200   # String => '\[[ABCGHILMNOQRSTUVZ]:'
201   # attribute => 'Header'
202   # context => 'Header'
203   # type => 'RegExpr'
204   if ($self->testRegExpr($text, '\\[[ABCGHILMNOQRSTUVZ]:', 0, 0, 0, undef, 0, 'Header', 'Header')) {
205      return 1
206   }
207   # String => '[ABCGHILMNOPQRSTUVZ]:'
208   # attribute => 'Header'
209   # context => 'Header2'
210   # type => 'RegExpr'
211   if ($self->testRegExpr($text, '[ABCGHILMNOPQRSTUVZ]:', 0, 0, 0, undef, 0, 'Header2', 'Header')) {
212      return 1
213   }
214   # attribute => 'Header'
215   # beginRegion => 'header'
216   # char => 'X'
217   # char1 => ':'
218   # column => '0'
219   # context => 'Header'
220   # type => 'Detect2Chars'
221   if ($self->testDetect2Chars($text, 'X', ':', 0, 0, 0, 0, 0, 'Header', 'Header')) {
222      return 1
223   }
224   # String => '|:['
225   # attribute => 'Bar'
226   # context => 'Bar'
227   # type => 'AnyChar'
228   if ($self->testAnyChar($text, '|:[', 0, 0, undef, 0, 'Bar', 'Bar')) {
229      return 1
230   }
231   # attribute => 'Bar'
232   # char => ']'
233   # context => '#stay'
234   # type => 'DetectChar'
235   if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#stay', 'Bar')) {
236      return 1
237   }
238   # String => '()'
239   # attribute => 'Slur'
240   # context => '#stay'
241   # type => 'AnyChar'
242   if ($self->testAnyChar($text, '()', 0, 0, undef, 0, '#stay', 'Slur')) {
243      return 1
244   }
245   # String => '{}'
246   # attribute => 'Slur'
247   # context => '#stay'
248   # type => 'AnyChar'
249   if ($self->testAnyChar($text, '{}', 0, 0, undef, 0, '#stay', 'Slur')) {
250      return 1
251   }
252   # attribute => 'Lyrics'
253   # char => 'W'
254   # char1 => ':'
255   # context => 'Lyrics'
256   # type => 'Detect2Chars'
257   if ($self->testDetect2Chars($text, 'W', ':', 0, 0, 0, undef, 0, 'Lyrics', 'Lyrics')) {
258      return 1
259   }
260   # attribute => 'Lyrics'
261   # char => 'w'
262   # char1 => ':'
263   # context => 'Lyrics'
264   # type => 'Detect2Chars'
265   if ($self->testDetect2Chars($text, 'w', ':', 0, 0, 0, undef, 0, 'Lyrics', 'Lyrics')) {
266      return 1
267   }
268   # attribute => 'Preprocessor'
269   # char => '%'
270   # char1 => '%'
271   # context => 'Preprocessor'
272   # type => 'Detect2Chars'
273   if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Preprocessor', 'Preprocessor')) {
274      return 1
275   }
276   # attribute => 'Comment'
277   # char => '%'
278   # context => 'Comment'
279   # type => 'DetectChar'
280   if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) {
281      return 1
282   }
283   # String => '[_|\^]?[_|=|\^][A-Ga-g]'
284   # attribute => 'Sharp'
285   # context => '#stay'
286   # type => 'RegExpr'
287   if ($self->testRegExpr($text, '[_|\\^]?[_|=|\\^][A-Ga-g]', 0, 0, 0, undef, 0, '#stay', 'Sharp')) {
288      return 1
289   }
290   return 0;
291};
292
293sub parsePart {
294   my ($self, $text) = @_;
295   return 0;
296};
297
298sub parsePreprocessor {
299   my ($self, $text) = @_;
300   return 0;
301};
302
303
3041;
305
306__END__
307
308=head1 NAME
309
310Syntax::Highlight::Engine::Kate::ABC - a Plugin for ABC syntax highlighting
311
312=head1 SYNOPSIS
313
314 require Syntax::Highlight::Engine::Kate::ABC;
315 my $sh = new Syntax::Highlight::Engine::Kate::ABC([
316 ]);
317
318=head1 DESCRIPTION
319
320Syntax::Highlight::Engine::Kate::ABC is a  plugin module that provides syntax highlighting
321for ABC to the Syntax::Haghlight::Engine::Kate highlighting engine.
322
323This code is generated from the syntax definition files used
324by the Kate project.
325It works quite fine, but can use refinement and optimization.
326
327It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
328
329=head1 AUTHOR
330
331Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
332
333=head1 BUGS
334
335Unknown. If you find any, please contact the author