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 'debiancontrol.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 0.82 |
9 | #kate version 2.4 |
10 | #generated: Sun Feb 3 22:02:04 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::Debian_Control; |
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 | 'Email' => 'Others', |
26 | 'Keyword' => 'Keyword', |
27 | 'Normal Text' => 'Normal', |
28 | 'Value' => 'DataType', |
29 | 'Variable' => 'Others', |
30 | 'Version' => 'DecVal', |
31 | }); |
32 | $self->contextdata({ |
33 | 'Constrain' => { |
34 | callback => \&parseConstrain, |
35 | attribute => 'Version', |
36 | }, |
37 | 'DependencyField' => { |
38 | callback => \&parseDependencyField, |
39 | attribute => 'Value', |
40 | lineending => '#pop', |
41 | }, |
42 | 'Field' => { |
43 | callback => \&parseField, |
44 | attribute => 'Value', |
45 | lineending => '#pop', |
46 | }, |
47 | 'Variable' => { |
48 | callback => \&parseVariable, |
49 | attribute => 'Variable', |
50 | lineending => '#pop', |
51 | }, |
52 | 'noname' => { |
53 | callback => \&parsenoname, |
54 | attribute => 'Normal Text', |
55 | }, |
56 | }); |
57 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
58 | $self->basecontext('noname'); |
59 | $self->keywordscase(0); |
60 | $self->initialize; |
61 | bless ($self, $class); |
62 | return $self; |
63 | } |
64 | |
65 | sub language { |
66 | return 'Debian Control'; |
67 | } |
68 | |
69 | sub parseConstrain { |
70 | my ($self, $text) = @_; |
71 | # attribute => 'Keyword' |
72 | # char => '$' |
73 | # char1 => '{' |
74 | # context => 'Variable' |
75 | # type => 'Detect2Chars' |
76 | if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, 'Variable', 'Keyword')) { |
77 | return 1 |
78 | } |
79 | # String => '[!<=>]' |
80 | # attribute => 'Keyword' |
81 | # context => '#stay' |
82 | # type => 'RegExpr' |
83 | if ($self->testRegExpr($text, '[!<=>]', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
84 | return 1 |
85 | } |
86 | # attribute => 'Keyword' |
87 | # char => ')' |
88 | # context => '#pop' |
89 | # type => 'DetectChar' |
90 | if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
91 | return 1 |
92 | } |
93 | # attribute => 'Keyword' |
94 | # char => ']' |
95 | # context => '#pop' |
96 | # type => 'DetectChar' |
97 | if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
98 | return 1 |
99 | } |
100 | return 0; |
101 | }; |
102 | |
103 | sub parseDependencyField { |
104 | my ($self, $text) = @_; |
105 | # String => '<.*@.*>' |
106 | # attribute => 'Email' |
107 | # context => '#stay' |
108 | # type => 'RegExpr' |
109 | if ($self->testRegExpr($text, '<.*@.*>', 0, 0, 0, undef, 0, '#stay', 'Email')) { |
110 | return 1 |
111 | } |
112 | # attribute => 'Keyword' |
113 | # char => '$' |
114 | # char1 => '{' |
115 | # context => 'Variable' |
116 | # type => 'Detect2Chars' |
117 | if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, 'Variable', 'Keyword')) { |
118 | return 1 |
119 | } |
120 | # String => '[,\|]' |
121 | # attribute => 'Keyword' |
122 | # context => '#stay' |
123 | # type => 'RegExpr' |
124 | if ($self->testRegExpr($text, '[,\\|]', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
125 | return 1 |
126 | } |
127 | # attribute => 'Keyword' |
128 | # char => '(' |
129 | # context => 'Constrain' |
130 | # type => 'DetectChar' |
131 | if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, 'Constrain', 'Keyword')) { |
132 | return 1 |
133 | } |
134 | # attribute => 'Keyword' |
135 | # char => '[' |
136 | # context => 'Constrain' |
137 | # type => 'DetectChar' |
138 | if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Constrain', 'Keyword')) { |
139 | return 1 |
140 | } |
141 | return 0; |
142 | }; |
143 | |
144 | sub parseField { |
145 | my ($self, $text) = @_; |
146 | # String => '<.*@.*>' |
147 | # attribute => 'Email' |
148 | # context => '#stay' |
149 | # type => 'RegExpr' |
150 | if ($self->testRegExpr($text, '<.*@.*>', 0, 0, 0, undef, 0, '#stay', 'Email')) { |
151 | return 1 |
152 | } |
153 | # attribute => 'Keyword' |
154 | # char => '$' |
155 | # char1 => '{' |
156 | # context => 'Variable' |
157 | # type => 'Detect2Chars' |
158 | if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, 'Variable', 'Keyword')) { |
159 | return 1 |
160 | } |
161 | return 0; |
162 | }; |
163 | |
164 | sub parseVariable { |
165 | my ($self, $text) = @_; |
166 | # attribute => 'Keyword' |
167 | # char => '}' |
168 | # context => '#pop' |
169 | # type => 'DetectChar' |
170 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
171 | return 1 |
172 | } |
173 | return 0; |
174 | }; |
175 | |
176 | sub parsenoname { |
177 | my ($self, $text) = @_; |
178 | # String => 'Depends:' |
179 | # attribute => 'Keyword' |
180 | # context => 'DependencyField' |
181 | # type => 'StringDetect' |
182 | if ($self->testStringDetect($text, 'Depends:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
183 | return 1 |
184 | } |
185 | # String => 'Recommends:' |
186 | # attribute => 'Keyword' |
187 | # context => 'DependencyField' |
188 | # type => 'StringDetect' |
189 | if ($self->testStringDetect($text, 'Recommends:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
190 | return 1 |
191 | } |
192 | # String => 'Suggests:' |
193 | # attribute => 'Keyword' |
194 | # context => 'DependencyField' |
195 | # type => 'StringDetect' |
196 | if ($self->testStringDetect($text, 'Suggests:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
197 | return 1 |
198 | } |
199 | # String => 'Conflicts:' |
200 | # attribute => 'Keyword' |
201 | # context => 'DependencyField' |
202 | # type => 'StringDetect' |
203 | if ($self->testStringDetect($text, 'Conflicts:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
204 | return 1 |
205 | } |
206 | # String => 'Provides:' |
207 | # attribute => 'Keyword' |
208 | # context => 'DependencyField' |
209 | # type => 'StringDetect' |
210 | if ($self->testStringDetect($text, 'Provides:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
211 | return 1 |
212 | } |
213 | # String => 'Replaces:' |
214 | # attribute => 'Keyword' |
215 | # context => 'DependencyField' |
216 | # type => 'StringDetect' |
217 | if ($self->testStringDetect($text, 'Replaces:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
218 | return 1 |
219 | } |
220 | # String => 'Enhances:' |
221 | # attribute => 'Keyword' |
222 | # context => 'DependencyField' |
223 | # type => 'StringDetect' |
224 | if ($self->testStringDetect($text, 'Enhances:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
225 | return 1 |
226 | } |
227 | # String => 'Pre-Depends:' |
228 | # attribute => 'Keyword' |
229 | # context => 'DependencyField' |
230 | # type => 'StringDetect' |
231 | if ($self->testStringDetect($text, 'Pre-Depends:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
232 | return 1 |
233 | } |
234 | # String => 'Build-Depends:' |
235 | # attribute => 'Keyword' |
236 | # context => 'DependencyField' |
237 | # type => 'StringDetect' |
238 | if ($self->testStringDetect($text, 'Build-Depends:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
239 | return 1 |
240 | } |
241 | # String => 'Build-Depends-Indep:' |
242 | # attribute => 'Keyword' |
243 | # context => 'DependencyField' |
244 | # type => 'StringDetect' |
245 | if ($self->testStringDetect($text, 'Build-Depends-Indep:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
246 | return 1 |
247 | } |
248 | # String => 'Build-Conflicts:' |
249 | # attribute => 'Keyword' |
250 | # context => 'DependencyField' |
251 | # type => 'StringDetect' |
252 | if ($self->testStringDetect($text, 'Build-Conflicts:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
253 | return 1 |
254 | } |
255 | # String => 'Build-Conflicts-Indep:' |
256 | # attribute => 'Keyword' |
257 | # context => 'DependencyField' |
258 | # type => 'StringDetect' |
259 | if ($self->testStringDetect($text, 'Build-Conflicts-Indep:', 0, 0, 0, undef, 0, 'DependencyField', 'Keyword')) { |
260 | return 1 |
261 | } |
262 | # String => '[^ ]*:' |
263 | # attribute => 'Keyword' |
264 | # column => '0' |
265 | # context => 'Field' |
266 | # minimal => 'true' |
267 | # type => 'RegExpr' |
268 | if ($self->testRegExpr($text, '[^ ]*?:', 0, 0, 0, 0, 0, 'Field', 'Keyword')) { |
269 | return 1 |
270 | } |
271 | # attribute => 'Value' |
272 | # char => ' ' |
273 | # column => '0' |
274 | # context => 'Field' |
275 | # type => 'DetectChar' |
276 | if ($self->testDetectChar($text, ' ', 0, 0, 0, 0, 0, 'Field', 'Value')) { |
277 | return 1 |
278 | } |
279 | return 0; |
280 | }; |
281 | |
282 | |
283 | 1; |
284 | |
285 | __END__ |
286 | |
287 | =head1 NAME |
288 | |
289 | Syntax::Highlight::Engine::Kate::Debian_Control - a Plugin for Debian Control syntax highlighting |
290 | |
291 | =head1 SYNOPSIS |
292 | |
293 | require Syntax::Highlight::Engine::Kate::Debian_Control; |
294 | my $sh = new Syntax::Highlight::Engine::Kate::Debian_Control([ |
295 | ]); |
296 | |
297 | =head1 DESCRIPTION |
298 | |
299 | Syntax::Highlight::Engine::Kate::Debian_Control is a plugin module that provides syntax highlighting |
300 | for Debian Control to the Syntax::Haghlight::Engine::Kate highlighting engine. |
301 | |
302 | This code is generated from the syntax definition files used |
303 | by the Kate project. |
304 | It works quite fine, but can use refinement and optimization. |
305 | |
306 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
307 | |
308 | =cut |
309 | |
310 | =head1 AUTHOR |
311 | |
312 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
313 | |
314 | =cut |
315 | |
316 | =head1 BUGS |
317 | |
318 | Unknown. If you find any, please contact the author |
319 | |
320 | =cut |
321 | |