Commit | Line | Data |
3fea05b9 |
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 'm3u.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 author Jan Janssen (medhefgo@web.de) |
10 | #generated: Sun Feb 3 22:02:05 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::M3U; |
13 | |
14 | our $VERSION = '0.06'; |
15 | |
16 | use strict; |
17 | use warnings; |
18 | use base('Syntax::Highlight::Engine::Kate::Template'); |
19 | |
20 | sub new { |
21 | my $proto = shift; |
22 | my $class = ref($proto) || $proto; |
23 | my $self = $class->SUPER::new(@_); |
24 | $self->attributes({ |
25 | 'Comment' => 'Comment', |
26 | 'Descr' => 'String', |
27 | 'EXTINF' => 'Others', |
28 | 'Lenght' => 'DecVal', |
29 | 'M3USpec' => 'Keyword', |
30 | 'Normal Text' => 'Normal', |
31 | }); |
32 | $self->contextdata({ |
33 | 'FindEXTINF' => { |
34 | callback => \&parseFindEXTINF, |
35 | attribute => 'Normal Text', |
36 | }, |
37 | 'M3U' => { |
38 | callback => \&parseM3U, |
39 | attribute => 'Normal Text', |
40 | }, |
41 | }); |
42 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
43 | $self->basecontext('M3U'); |
44 | $self->keywordscase(1); |
45 | $self->initialize; |
46 | bless ($self, $class); |
47 | return $self; |
48 | } |
49 | |
50 | sub language { |
51 | return 'M3U'; |
52 | } |
53 | |
54 | sub parseFindEXTINF { |
55 | my ($self, $text) = @_; |
56 | # String => ':\d+' |
57 | # attribute => 'Lenght' |
58 | # type => 'RegExpr' |
59 | if ($self->testRegExpr($text, ':\\d+', 0, 0, 0, undef, 0, '#stay', 'Lenght')) { |
60 | return 1 |
61 | } |
62 | # String => ',.*$' |
63 | # attribute => 'Descr' |
64 | # context => '#pop' |
65 | # type => 'RegExpr' |
66 | if ($self->testRegExpr($text, ',.*$', 0, 0, 0, undef, 0, '#pop', 'Descr')) { |
67 | return 1 |
68 | } |
69 | return 0; |
70 | }; |
71 | |
72 | sub parseM3U { |
73 | my ($self, $text) = @_; |
74 | # String => '#EXTM3U' |
75 | # attribute => 'M3USpec' |
76 | # column => '0' |
77 | # context => '#pop' |
78 | # type => 'StringDetect' |
79 | if ($self->testStringDetect($text, '#EXTM3U', 0, 0, 0, 0, 0, '#pop', 'M3USpec')) { |
80 | return 1 |
81 | } |
82 | # String => '#EXTINF' |
83 | # attribute => 'EXTINF' |
84 | # column => '0' |
85 | # context => 'FindEXTINF' |
86 | # type => 'StringDetect' |
87 | if ($self->testStringDetect($text, '#EXTINF', 0, 0, 0, 0, 0, 'FindEXTINF', 'EXTINF')) { |
88 | return 1 |
89 | } |
90 | # String => '#.*$' |
91 | # attribute => 'Comment' |
92 | # firstNonSpace => 'true' |
93 | # type => 'RegExpr' |
94 | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 1, '#stay', 'Comment')) { |
95 | return 1 |
96 | } |
97 | return 0; |
98 | }; |
99 | |
100 | |
101 | 1; |
102 | |
103 | __END__ |
104 | |
105 | =head1 NAME |
106 | |
107 | Syntax::Highlight::Engine::Kate::M3U - a Plugin for M3U syntax highlighting |
108 | |
109 | =head1 SYNOPSIS |
110 | |
111 | require Syntax::Highlight::Engine::Kate::M3U; |
112 | my $sh = new Syntax::Highlight::Engine::Kate::M3U([ |
113 | ]); |
114 | |
115 | =head1 DESCRIPTION |
116 | |
117 | Syntax::Highlight::Engine::Kate::M3U is a plugin module that provides syntax highlighting |
118 | for M3U to the Syntax::Haghlight::Engine::Kate highlighting engine. |
119 | |
120 | This code is generated from the syntax definition files used |
121 | by the Kate project. |
122 | It works quite fine, but can use refinement and optimization. |
123 | |
124 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
125 | |
126 | =cut |
127 | |
128 | =head1 AUTHOR |
129 | |
130 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
131 | |
132 | =cut |
133 | |
134 | =head1 BUGS |
135 | |
136 | Unknown. If you find any, please contact the author |
137 | |
138 | =cut |
139 | |