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 'modula-2.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.1 |
10 | #generated: Sun Feb 3 22:02:05 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::Modulaminus2; |
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 | 'Directive' => 'Others', |
27 | 'Keyword' => 'Keyword', |
28 | 'Normal Text' => 'Normal', |
29 | 'Number' => 'DecVal', |
30 | 'String' => 'String', |
31 | 'Type' => 'DataType', |
32 | }); |
33 | $self->listAdd('directives', |
34 | 'ALLOCATE', |
35 | 'ASSEMBLER', |
36 | 'Accessible', |
37 | 'Append', |
38 | 'Assign', |
39 | 'CAPS', |
40 | 'Close', |
41 | 'Concat', |
42 | 'Copy', |
43 | 'DEALLOCATE', |
44 | 'Delete', |
45 | 'Done', |
46 | 'EOF', |
47 | 'EmptyString', |
48 | 'Erase', |
49 | 'GetArgs', |
50 | 'GetCard', |
51 | 'GetChar', |
52 | 'GetEnv', |
53 | 'GetInt', |
54 | 'GetLongReal', |
55 | 'GetReal', |
56 | 'GetString', |
57 | 'Insert', |
58 | 'Length', |
59 | 'Open', |
60 | 'OpenInput', |
61 | 'OpenOutput', |
62 | 'PutBf', |
63 | 'PutCard', |
64 | 'PutChar', |
65 | 'PutInt', |
66 | 'PutLn', |
67 | 'PutLongReal', |
68 | 'PutReal', |
69 | 'PutString', |
70 | 'Read', |
71 | 'ReadCard', |
72 | 'ReadInt', |
73 | 'ReadLongReal', |
74 | 'ReadReal', |
75 | 'ReadString', |
76 | 'ResetClock', |
77 | 'SIZE', |
78 | 'StrEq', |
79 | 'SystemTime', |
80 | 'UserTime', |
81 | 'Write', |
82 | 'WriteBf', |
83 | 'WriteCard', |
84 | 'WriteInt', |
85 | 'WriteLn', |
86 | 'WriteLongReal', |
87 | 'WriteReal', |
88 | 'WriteString', |
89 | 'compare', |
90 | 'pos', |
91 | ); |
92 | $self->listAdd('keywords', |
93 | 'ABS', |
94 | 'AND', |
95 | 'ARRAY', |
96 | 'ASM', |
97 | 'BEGIN', |
98 | 'BITSET', |
99 | 'BY', |
100 | 'CAP', |
101 | 'CASE', |
102 | 'CHR', |
103 | 'CONST', |
104 | 'DEC', |
105 | 'DEFINITION', |
106 | 'DIV', |
107 | 'DO', |
108 | 'ELSE', |
109 | 'ELSIF', |
110 | 'END', |
111 | 'EXCL', |
112 | 'EXIT', |
113 | 'EXPORT', |
114 | 'FALSE', |
115 | 'FOR', |
116 | 'FOREIGN', |
117 | 'FROM', |
118 | 'HALT', |
119 | 'HIGH', |
120 | 'IF', |
121 | 'IMPLEMENTATION', |
122 | 'IMPORT', |
123 | 'IN', |
124 | 'INC', |
125 | 'INCL', |
126 | 'IOTRANSFER', |
127 | 'LOOP', |
128 | 'MAX', |
129 | 'MIN', |
130 | 'MOD', |
131 | 'MODULE', |
132 | 'NEWPROCESS', |
133 | 'NIL', |
134 | 'NOT', |
135 | 'ODD', |
136 | 'OF', |
137 | 'OR', |
138 | 'ORD', |
139 | 'PROC', |
140 | 'PROCEDURE', |
141 | 'QUALIFIED', |
142 | 'RECORD', |
143 | 'REPEAT', |
144 | 'RETURN', |
145 | 'SET', |
146 | 'THEN', |
147 | 'TO', |
148 | 'TRANSFER', |
149 | 'TRUE', |
150 | 'TRUNC', |
151 | 'TYPE', |
152 | 'UNTIL', |
153 | 'VAL', |
154 | 'VAR', |
155 | 'WHILE', |
156 | 'WITH', |
157 | ); |
158 | $self->listAdd('types', |
159 | 'ADDRESS', |
160 | 'ADR', |
161 | 'BOOLEAN', |
162 | 'CARDINAL', |
163 | 'CHAR', |
164 | 'File', |
165 | 'INTEGER', |
166 | 'LONGINT', |
167 | 'LONGREAL', |
168 | 'POINTER', |
169 | 'REAL', |
170 | 'SHORTCARD', |
171 | 'SHORTINT', |
172 | ); |
173 | $self->contextdata({ |
174 | 'Comment2' => { |
175 | callback => \&parseComment2, |
176 | attribute => 'Comment', |
177 | }, |
178 | 'Comment3' => { |
179 | callback => \&parseComment3, |
180 | attribute => 'Comment', |
181 | lineending => '#pop', |
182 | }, |
183 | 'Normal' => { |
184 | callback => \&parseNormal, |
185 | attribute => 'Normal Text', |
186 | }, |
187 | 'Prep1' => { |
188 | callback => \&parsePrep1, |
189 | attribute => 'Directive', |
190 | }, |
191 | 'String1' => { |
192 | callback => \&parseString1, |
193 | attribute => 'String', |
194 | lineending => '#pop', |
195 | }, |
196 | 'String2' => { |
197 | callback => \&parseString2, |
198 | attribute => 'String', |
199 | lineending => '#pop', |
200 | }, |
201 | }); |
202 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
203 | $self->basecontext('Normal'); |
204 | $self->keywordscase(0); |
205 | $self->initialize; |
206 | bless ($self, $class); |
207 | return $self; |
208 | } |
209 | |
210 | sub language { |
211 | return 'Modula-2'; |
212 | } |
213 | |
214 | sub parseComment2 { |
215 | my ($self, $text) = @_; |
216 | # attribute => 'Comment' |
217 | # char => '*' |
218 | # char1 => ')' |
219 | # context => '#pop' |
220 | # type => 'Detect2Chars' |
221 | if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
222 | return 1 |
223 | } |
224 | return 0; |
225 | }; |
226 | |
227 | sub parseComment3 { |
228 | my ($self, $text) = @_; |
229 | return 0; |
230 | }; |
231 | |
232 | sub parseNormal { |
233 | my ($self, $text) = @_; |
234 | # String => 'keywords' |
235 | # attribute => 'Keyword' |
236 | # context => '#stay' |
237 | # type => 'keyword' |
238 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
239 | return 1 |
240 | } |
241 | # String => 'directives' |
242 | # attribute => 'Directive' |
243 | # context => '#stay' |
244 | # type => 'keyword' |
245 | if ($self->testKeyword($text, 'directives', 0, undef, 0, '#stay', 'Directive')) { |
246 | return 1 |
247 | } |
248 | # String => 'types' |
249 | # attribute => 'Type' |
250 | # context => '#stay' |
251 | # type => 'keyword' |
252 | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Type')) { |
253 | return 1 |
254 | } |
255 | # attribute => 'Number' |
256 | # context => '#stay' |
257 | # type => 'Float' |
258 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Number')) { |
259 | return 1 |
260 | } |
261 | # attribute => 'Number' |
262 | # context => '#stay' |
263 | # type => 'Int' |
264 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Number')) { |
265 | return 1 |
266 | } |
267 | # attribute => 'String' |
268 | # char => '"' |
269 | # context => 'String1' |
270 | # type => 'DetectChar' |
271 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String1', 'String')) { |
272 | return 1 |
273 | } |
274 | # attribute => 'String' |
275 | # char => ''' |
276 | # context => 'String2' |
277 | # type => 'DetectChar' |
278 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String2', 'String')) { |
279 | return 1 |
280 | } |
281 | # String => '(*$' |
282 | # attribute => 'Directive' |
283 | # context => 'Prep1' |
284 | # type => 'StringDetect' |
285 | if ($self->testStringDetect($text, '(*$', 0, 0, 0, undef, 0, 'Prep1', 'Directive')) { |
286 | return 1 |
287 | } |
288 | # attribute => 'Comment' |
289 | # char => '(' |
290 | # char1 => '*' |
291 | # context => 'Comment2' |
292 | # type => 'Detect2Chars' |
293 | if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Comment2', 'Comment')) { |
294 | return 1 |
295 | } |
296 | return 0; |
297 | }; |
298 | |
299 | sub parsePrep1 { |
300 | my ($self, $text) = @_; |
301 | # String => '$*)' |
302 | # attribute => 'Directive' |
303 | # context => 'Prep1' |
304 | # type => 'StringDetect' |
305 | if ($self->testStringDetect($text, '$*)', 0, 0, 0, undef, 0, 'Prep1', 'Directive')) { |
306 | return 1 |
307 | } |
308 | return 0; |
309 | }; |
310 | |
311 | sub parseString1 { |
312 | my ($self, $text) = @_; |
313 | # attribute => 'String' |
314 | # char => '"' |
315 | # context => '#pop' |
316 | # type => 'DetectChar' |
317 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
318 | return 1 |
319 | } |
320 | return 0; |
321 | }; |
322 | |
323 | sub parseString2 { |
324 | my ($self, $text) = @_; |
325 | # attribute => 'String' |
326 | # char => ''' |
327 | # context => '#pop' |
328 | # type => 'DetectChar' |
329 | if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
330 | return 1 |
331 | } |
332 | return 0; |
333 | }; |
334 | |
335 | |
336 | 1; |
337 | |
338 | __END__ |
339 | |
340 | =head1 NAME |
341 | |
342 | Syntax::Highlight::Engine::Kate::Modulaminus2 - a Plugin for Modula-2 syntax highlighting |
343 | |
344 | =head1 SYNOPSIS |
345 | |
346 | require Syntax::Highlight::Engine::Kate::Modulaminus2; |
347 | my $sh = new Syntax::Highlight::Engine::Kate::Modulaminus2([ |
348 | ]); |
349 | |
350 | =head1 DESCRIPTION |
351 | |
352 | Syntax::Highlight::Engine::Kate::Modulaminus2 is a plugin module that provides syntax highlighting |
353 | for Modula-2 to the Syntax::Haghlight::Engine::Kate highlighting engine. |
354 | |
355 | This code is generated from the syntax definition files used |
356 | by the Kate project. |
357 | It works quite fine, but can use refinement and optimization. |
358 | |
359 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
360 | |
361 | =cut |
362 | |
363 | =head1 AUTHOR |
364 | |
365 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
366 | |
367 | =cut |
368 | |
369 | =head1 BUGS |
370 | |
371 | Unknown. If you find any, please contact the author |
372 | |
373 | =cut |
374 | |