File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Pascal.pm
Criterion Covered Total %
statement 24 83 28.9
branch 0 44 0.0
condition 1 3 33.3
subroutine 4 12 33.3
pod 0 9 0.0
total 29 151 19.2


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 'pascal.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.20
9             #kate version 2.3
10             #generated: Sun Feb 3 22:02:05 2008, localtime
11              
12             package Syntax::Highlight::Engine::Kate::Pascal;
13              
14             our $VERSION = '0.14';
15              
16 1     1   698 use strict;
  1         3  
  1         30  
17 1     1   5 use warnings;
  1         2  
  1         31  
18 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         944  
19              
20             sub new {
21 1     1 0 571 my $proto = shift;
22 1   33     6 my $class = ref($proto) || $proto;
23 1         8 my $self = $class->SUPER::new(@_);
24 1         11 $self->attributes({
25             'Alert' => 'Alert',
26             'Comment' => 'Comment',
27             'Directive' => 'Others',
28             'ISO/Delphi Extended' => 'Function',
29             'Keyword' => 'Keyword',
30             'Normal Text' => 'Normal',
31             'Number' => 'DecVal',
32             'String' => 'String',
33             'Type' => 'DataType',
34             });
35 1         7 $self->listAdd('ISO/Delphi Extended',
36             'as',
37             'bindable',
38             'constructor',
39             'destructor',
40             'except',
41             'export',
42             'finally',
43             'implementation',
44             'import',
45             'inherited',
46             'inline',
47             'interface',
48             'is',
49             'module',
50             'on',
51             'only',
52             'otherwise',
53             'private',
54             'property',
55             'protected',
56             'public',
57             'qualified',
58             'raise',
59             'restricted',
60             'shl',
61             'shr',
62             'threadvar',
63             'try',
64             );
65 1         4 $self->listAdd('attention',
66             '###',
67             'FIXME',
68             'TODO',
69             );
70 1         5 $self->listAdd('keywords',
71             'and',
72             'array',
73             'asm',
74             'at',
75             'automated',
76             'break',
77             'case',
78             'const',
79             'continue',
80             'dispinterface',
81             'dispose',
82             'div',
83             'do',
84             'downto',
85             'else',
86             'exit',
87             'false',
88             'file',
89             'finalization',
90             'for',
91             'function',
92             'goto',
93             'if',
94             'in',
95             'initialization',
96             'label',
97             'library',
98             'mod',
99             'new',
100             'nil',
101             'not',
102             'of',
103             'operator',
104             'or',
105             'packed',
106             'procedure',
107             'program',
108             'published',
109             'record',
110             'repeat',
111             'resourcestring',
112             'self',
113             'set',
114             'then',
115             'to',
116             'true',
117             'type',
118             'unit',
119             'until',
120             'uses',
121             'var',
122             'while',
123             'with',
124             'xor',
125             );
126 1         5 $self->listAdd('types',
127             'AnsiChar',
128             'AnsiString',
129             'Boolean',
130             'Byte',
131             'ByteBool',
132             'Cardinal',
133             'Char',
134             'Comp',
135             'Currency',
136             'Double',
137             'Extended',
138             'File',
139             'Int64',
140             'Integer',
141             'LongBool',
142             'LongInt',
143             'LongWord',
144             'Pointer',
145             'Real',
146             'Real48',
147             'ShortInt',
148             'ShortString',
149             'Single',
150             'SmallInt',
151             'String',
152             'Text',
153             'Variant',
154             'WideChar',
155             'WideString',
156             'Word',
157             'WordBool',
158             );
159 1         15 $self->contextdata({
160             'Comment1' => {
161             callback => \&parseComment1,
162             attribute => 'Comment',
163             },
164             'Comment2' => {
165             callback => \&parseComment2,
166             attribute => 'Comment',
167             },
168             'Comment3' => {
169             callback => \&parseComment3,
170             attribute => 'Comment',
171             lineending => '#pop',
172             },
173             'Normal' => {
174             callback => \&parseNormal,
175             attribute => 'Normal Text',
176             },
177             'Prep1' => {
178             callback => \&parsePrep1,
179             attribute => 'Directive',
180             lineending => '#pop',
181             },
182             'Prep2' => {
183             callback => \&parsePrep2,
184             attribute => 'Directive',
185             lineending => '#pop',
186             },
187             'String' => {
188             callback => \&parseString,
189             attribute => 'String',
190             lineending => '#pop',
191             },
192             });
193 1         6 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
194 1         4 $self->basecontext('Normal');
195 1         5 $self->keywordscase(0);
196 1         4 $self->initialize;
197 1         2 bless ($self, $class);
198 1         3 return $self;
199             }
200              
201             sub language {
202 0     0 0   return 'Pascal';
203             }
204              
205             sub parseComment1 {
206 0     0 0   my ($self, $text) = @_;
207             # String => 'attention'
208             # attribute => 'Alert'
209             # context => '#stay'
210             # type => 'keyword'
211 0 0         if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
212 0           return 1
213             }
214             # attribute => 'Comment'
215             # char => '}'
216             # context => '#pop'
217             # endRegion => 'Region2'
218             # type => 'DetectChar'
219 0 0         if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
220 0           return 1
221             }
222 0           return 0;
223             };
224              
225             sub parseComment2 {
226 0     0 0   my ($self, $text) = @_;
227             # String => 'attention'
228             # attribute => 'Alert'
229             # context => '#stay'
230             # type => 'keyword'
231 0 0         if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
232 0           return 1
233             }
234             # attribute => 'Comment'
235             # char => '*'
236             # char1 => ')'
237             # context => '#pop'
238             # endRegion => 'Region3'
239             # type => 'Detect2Chars'
240 0 0         if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
241 0           return 1
242             }
243 0           return 0;
244             };
245              
246             sub parseComment3 {
247 0     0 0   my ($self, $text) = @_;
248             # String => 'attention'
249             # attribute => 'Alert'
250             # context => '#stay'
251             # type => 'keyword'
252 0 0         if ($self->testKeyword($text, 'attention', 0, undef, 0, '#stay', 'Alert')) {
253 0           return 1
254             }
255 0           return 0;
256             };
257              
258             sub parseNormal {
259 0     0 0   my ($self, $text) = @_;
260             # String => '\b(begin|case|record)(?=(\{[^}]*(\}|$)|\(\*.*(\*\)|$))*([\s]|$|//))'
261             # attribute => 'Keyword'
262             # beginRegion => 'Region1'
263             # context => '#stay'
264             # insensitive => 'true'
265             # type => 'RegExpr'
266 0 0         if ($self->testRegExpr($text, '\\b(begin|case|record)(?=(\\{[^}]*(\\}|$)|\\(\\*.*(\\*\\)|$))*([\\s]|$|//))', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
267 0           return 1
268             }
269             # String => '\b((object|class)(?=(\(.*\))?(\{[^}]*(\}|$)|\(\*.*(\*\)|$))*;?([\s]|$|//))|try(?=(\{[^}]*(\}|$)|\(\*.*(\*\)|$))*([\s]|$|//)))'
270             # attribute => 'ISO/Delphi Extended'
271             # beginRegion => 'Region1'
272             # context => '#stay'
273             # insensitive => 'true'
274             # type => 'RegExpr'
275 0 0         if ($self->testRegExpr($text, '\\b((object|class)(?=(\\(.*\\))?(\\{[^}]*(\\}|$)|\\(\\*.*(\\*\\)|$))*;?([\\s]|$|//))|try(?=(\\{[^}]*(\\}|$)|\\(\\*.*(\\*\\)|$))*([\\s]|$|//)))', 1, 0, 0, undef, 0, '#stay', 'ISO/Delphi Extended')) {
276 0           return 1
277             }
278             # String => '\bend(?=((\{[^}]*(\}|$)|\(\*.*(\*\)|$))*)([.;\s]|$)|//|$)'
279             # attribute => 'Keyword'
280             # context => '#stay'
281             # endRegion => 'Region1'
282             # insensitive => 'true'
283             # type => 'RegExpr'
284 0 0         if ($self->testRegExpr($text, '\\bend(?=((\\{[^}]*(\\}|$)|\\(\\*.*(\\*\\)|$))*)([.;\\s]|$)|//|$)', 1, 0, 0, undef, 0, '#stay', 'Keyword')) {
285 0           return 1
286             }
287             # String => 'keywords'
288             # attribute => 'Keyword'
289             # context => '#stay'
290             # type => 'keyword'
291 0 0         if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
292 0           return 1
293             }
294             # String => 'ISO/Delphi Extended'
295             # attribute => 'ISO/Delphi Extended'
296             # context => '#stay'
297             # type => 'keyword'
298 0 0         if ($self->testKeyword($text, 'ISO/Delphi Extended', 0, undef, 0, '#stay', 'ISO/Delphi Extended')) {
299 0           return 1
300             }
301             # String => 'types'
302             # attribute => 'Type'
303             # context => '#stay'
304             # type => 'keyword'
305 0 0         if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Type')) {
306 0           return 1
307             }
308             # attribute => 'Number'
309             # context => '#stay'
310             # type => 'Float'
311 0 0         if ($self->testFloat($text, 0, undef, 0, '#stay', 'Number')) {
312 0           return 1
313             }
314             # attribute => 'Number'
315             # context => '#stay'
316             # type => 'Int'
317 0 0         if ($self->testInt($text, 0, undef, 0, '#stay', 'Number')) {
318 0           return 1
319             }
320             # attribute => 'String'
321             # char => '''
322             # context => 'String'
323             # type => 'DetectChar'
324 0 0         if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'String', 'String')) {
325 0           return 1
326             }
327             # String => '(*$'
328             # attribute => 'Directive'
329             # context => 'Prep1'
330             # type => 'StringDetect'
331 0 0         if ($self->testStringDetect($text, '(*$', 0, 0, 0, undef, 0, 'Prep1', 'Directive')) {
332 0           return 1
333             }
334             # attribute => 'Directive'
335             # char => '{'
336             # char1 => '$'
337             # context => 'Prep2'
338             # type => 'Detect2Chars'
339 0 0         if ($self->testDetect2Chars($text, '{', '$', 0, 0, 0, undef, 0, 'Prep2', 'Directive')) {
340 0           return 1
341             }
342             # attribute => 'Comment'
343             # beginRegion => 'Region2'
344             # char => '{'
345             # context => 'Comment1'
346             # type => 'DetectChar'
347 0 0         if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Comment1', 'Comment')) {
348 0           return 1
349             }
350             # attribute => 'Comment'
351             # beginRegion => 'Region3'
352             # char => '('
353             # char1 => '*'
354             # context => 'Comment2'
355             # type => 'Detect2Chars'
356 0 0         if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Comment2', 'Comment')) {
357 0           return 1
358             }
359             # attribute => 'Comment'
360             # char => '/'
361             # char1 => '/'
362             # context => 'Comment3'
363             # type => 'Detect2Chars'
364 0 0         if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment3', 'Comment')) {
365 0           return 1
366             }
367 0           return 0;
368             };
369              
370             sub parsePrep1 {
371 0     0 0   my ($self, $text) = @_;
372             # attribute => 'Directive'
373             # char => '*'
374             # char1 => ')'
375             # context => '#pop'
376             # type => 'Detect2Chars'
377 0 0         if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Directive')) {
378 0           return 1
379             }
380 0           return 0;
381             };
382              
383             sub parsePrep2 {
384 0     0 0   my ($self, $text) = @_;
385             # attribute => 'Directive'
386             # char => '}'
387             # context => '#pop'
388             # type => 'DetectChar'
389 0 0         if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Directive')) {
390 0           return 1
391             }
392 0           return 0;
393             };
394              
395             sub parseString {
396 0     0 0   my ($self, $text) = @_;
397             # attribute => 'String'
398             # char => '''
399             # context => '#pop'
400             # type => 'DetectChar'
401 0 0         if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) {
402 0           return 1
403             }
404 0           return 0;
405             };
406              
407              
408             1;
409              
410             __END__