Kate/Objective_Caml.pm

filter: Statementstmt 29.7% 25 / 84 Branchbran 0.0% 0 / 50 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 6 totaltotal 19.4% 30 / 154 SCAR 60.3
CC
27
Cov
19%
parseNormal
272.0
parseCamlp4QuotationConstant
42.0
parseStringConstant
20.0
CRAP 414.7
« Kate/TaskJuggler.pm ↑ Summary Kate/Apache_Configuration.pm »
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 'ocaml.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7  
8 #kate xml version 1.04
9 #kate version 2.4
10 #kate author Glyn Webster (glyn@wave.co.nz)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
12  
13 package Syntax::Highlight::Engine::Kate::Objective_Caml;
14  
15 1 our $VERSION = '0.14';
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use base('Syntax::Highlight::Engine::Kate::Template');
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 sub new {
22 1 ▶ my $proto = shift;
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
23 1 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
24 1 my $self = $class->SUPER::new(@_);
25 1 $self->attributes({
26 'Binary' => 'BaseN',
27 'Camlp4 Quotation' => 'String',
28 'Character' => 'Char',
29 'Comment' => 'Comment',
30 'Core Data Type' => 'DataType',
31 'Decimal' => 'DecVal',
32 'Directive' => 'Others',
33 'Escaped characters' => 'Char',
34 'Float' => 'Float',
35 'Hexadecimal' => 'BaseN',
36 'Identifier' => 'Normal',
37 'Keyword' => 'Keyword',
38 'Normal Text' => 'Normal',
39 'Octal' => 'BaseN',
40 'Revised Syntax Keyword' => 'Normal',
41 'String' => 'String',
42 });
43 1 $self->listAdd('core types',
44 'array',
45 'bool',
46 'char',
47 'exn',
48 'format',
49 'int',
50 'lazy_t',
51 'list',
52 'option',
53 'real',
54 'ref',
55 'string',
56 'unit',
57 );
58 1 $self->listAdd('keywords',
59 'and',
60 'as',
61 'asr',
62 'assert',
63 'begin',
64 'class',
65 'closed',
66 'constraint',
67 'do',
68 'done',
69 'downto',
70 'else',
71 'end',
72 'exception',
73 'external',
74 'false',
75 'for',
76 'fun',
77 'function',
78 'functor',
79 'if',
80 'in',
81 'include',
82 'inherit',
83 'land',
84 'lazy',
85 'let',
86 'lor',
87 'lsl',
88 'lsr',
89 'lxor',
90 'match',
91 'method',
92 'mod',
93 'module',
94 'mutable',
95 'new',
96 'of',
97 'open',
98 'or',
99 'parser',
100 'private',
101 'rec',
102 'sig',
103 'struct',
104 'then',
105 'to',
106 'true',
107 'try',
108 'type',
109 'val',
110 'virtual',
111 'when',
112 'while',
113 'with',
114 );
115 1 $self->listAdd('revised syntax keywords',
116 'declare',
117 'value',
118 'where',
119 );
120 1 $self->contextdata({
121 'Camlp4 Quotation Constant' => {
122 callback => \&parseCamlp4QuotationConstant,
123 attribute => 'Camlp4 Quotation',
124 },
125 'Multiline Comment' => {
126 callback => \&parseMultilineComment,
127 attribute => 'Comment',
128 },
129 'Normal' => {
130 callback => \&parseNormal,
131 attribute => 'Normal Text',
132 },
133 'String Constant' => {
134 callback => \&parseStringConstant,
135 attribute => 'String',
136 },
137 });
138 1 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
139 1 $self->basecontext('Normal');
140 1 $self->keywordscase(0);
141 1 $self->initialize;
142 1 bless ($self, $class);
143 1 return $self;
144 }
145  
146 sub language {
147 0 ▶ return 'Objective Caml';
Subroutine language: not called CC=1 SCAR=6.9
Pod undocumented
148 }
149  
150 sub parseCamlp4QuotationConstant {
151 0 ▶ my ($self, $text) = @_;
Subroutine parseCamlp4QuotationConstant: not called CC=6 SCAR=37.4
Pod undocumented
152 # attribute => 'Camlp4 Quotation'
153 # char => '>'
154 # char1 => '>'
155 # context => '#pop'
156 # type => 'Detect2Chars'
157 0 ▶ if ($self->testDetect2Chars($text, '>', '>', 0, 0, 0, undef, 0, '#pop', 'Camlp4 Quotation')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, ">", ">", 0, 0, 0, undef, 0, "#pop", "Camlp4 Quotation")) 0 0 0
158 0 return 1
159 }
160 # attribute => 'Camlp4 Quotation'
161 # char => '<'
162 # char1 => '<'
163 # context => 'Camlp4 Quotation Constant'
164 # type => 'Detect2Chars'
165 0 ▶ if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "<", "<", 0, 0, 0, undef, 0, "Camlp4 Quotation Constant", "Camlp4 Quotation")) 0 0 0
166 0 return 1
167 }
168 # String => '<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<'
169 # attribute => 'Camlp4 Quotation'
170 # context => 'Camlp4 Quotation Constant'
171 # type => 'RegExpr'
172 0 ▶ if ($self->testRegExpr($text, '<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_']*<", 0, 0, 0, undef, 0, "Camlp4 Quotation Constant", "Camlp4 Quotation")) 0 0 0
173 0 return 1
174 }
175 # String => '\\(\\|>>|<<)'
176 # attribute => 'Escaped characters'
177 # context => '#stay'
178 # type => 'RegExpr'
179 0 ▶ if ($self->testRegExpr($text, '\\\\(\\\\|>>|<<)', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\(\\\\|>>|<<)", 0, 0, 0, undef, 0, "#stay", "Escaped characters")) 0 0 0
180 0 return 1
181 }
182 # String => '\\<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<'
183 # attribute => 'Escaped characters'
184 # context => '#stay'
185 # type => 'RegExpr'
186 0 ▶ if ($self->testRegExpr($text, '\\\\<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_']*<", 0, 0, 0, undef, 0, "#stay", "Escaped characters")) 0 0 0
187 0 return 1
188 }
189 0 return 0;
190 };
191  
192 sub parseMultilineComment {
193 0 ▶ my ($self, $text) = @_;
Subroutine parseMultilineComment: not called CC=3 SCAR=24.8
Pod undocumented
194 # attribute => 'Comment'
195 # char => '*'
196 # char1 => ')'
197 # context => '#pop'
198 # endRegion => 'comment'
199 # type => 'Detect2Chars'
200 0 ▶ if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "*", ")", 0, 0, 0, undef, 0, "#pop", "Comment")) 0 0 0
201 0 return 1
202 }
203 # attribute => 'Comment'
204 # beginRegion => 'comment'
205 # char => '('
206 # char1 => '*'
207 # context => 'Multiline Comment'
208 # type => 'Detect2Chars'
209 0 ▶ if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "(", "*", 0, 0, 0, undef, 0, "Multiline Comment", "Comment")) 0 0 0
210 0 return 1
211 }
212 0 return 0;
213 };
214  
215 sub parseNormal {
216 0 ▶ my ($self, $text) = @_;
Subroutine parseNormal: not called CC=16 SCAR=56.1
Pod undocumented
217 # attribute => 'Comment'
218 # beginRegion => 'comment'
219 # char => '('
220 # char1 => '*'
221 # context => 'Multiline Comment'
222 # type => 'Detect2Chars'
223 0 ▶ if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "(", "*", 0, 0, 0, undef, 0, "Multiline Comment", "Comment")) 0 0 0
224 0 return 1
225 }
226 # String => '#[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*.*$'
227 # attribute => 'Directive'
228 # context => '#stay'
229 # firstNonSpace => 'true'
230 # type => 'RegExpr'
231 0 ▶ if ($self->testRegExpr($text, '#[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*.*$', 0, 0, 0, undef, 1, '#stay', 'Directive')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "#[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_']*.*\$", 0, 0, 0, undef, 1, "#stay", "Directive")) 0 0 0
232 0 return 1
233 }
234 # attribute => 'String'
235 # char => '"'
236 # context => 'String Constant'
237 # type => 'DetectChar'
238 0 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String Constant', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "String Constant", "String")) 0 0 0
239 0 return 1
240 }
241 # String => ''((\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})|[^'])''
242 # attribute => 'Character'
243 # context => '#stay'
244 # type => 'RegExpr'
245 0 ▶ if ($self->testRegExpr($text, '\'((\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})|[^\'])\'', 0, 0, 0, undef, 0, '#stay', 'Character')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "'((\\\\[ntbr'\"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})|[^'])'", 0, 0, 0, undef, 0, "#stay", "Character")) 0 0 0
246 0 return 1
247 }
248 # attribute => 'Camlp4 Quotation'
249 # char => '<'
250 # char1 => '<'
251 # context => 'Camlp4 Quotation Constant'
252 # type => 'Detect2Chars'
253 0 ▶ if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetect2Chars($text, "<", "<", 0, 0, 0, undef, 0, "Camlp4 Quotation Constant", "Camlp4 Quotation")) 0 0 0
254 0 return 1
255 }
256 # String => '<:[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*<'
257 # attribute => 'Camlp4 Quotation'
258 # context => 'Camlp4 Quotation Constant'
259 # type => 'RegExpr'
260 0 ▶ if ($self->testRegExpr($text, '<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "<:[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_']*<", 0, 0, 0, undef, 0, "Camlp4 Quotation Constant", "Camlp4 Quotation")) 0 0 0
261 0 return 1
262 }
263 # String => 'keywords'
264 # attribute => 'Keyword'
265 # context => '#stay'
266 # type => 'keyword'
267 0 ▶ if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "keywords", 0, undef, 0, "#stay", "Keyword")) 0 0 0
268 0 return 1
269 }
270 # String => 'revised syntax keywords'
271 # attribute => 'Revised Syntax Keyword'
272 # context => '#stay'
273 # type => 'keyword'
274 0 ▶ if ($self->testKeyword($text, 'revised syntax keywords', 0, undef, 0, '#stay', 'Revised Syntax Keyword')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "revised syntax keywords", 0, undef, 0, "#stay", "Revised Syntax Keyword")) 0 0 0
275 0 return 1
276 }
277 # String => 'core types'
278 # attribute => 'Core Data Type'
279 # context => '#stay'
280 # type => 'keyword'
281 0 ▶ if ($self->testKeyword($text, 'core types', 0, undef, 0, '#stay', 'Core Data Type')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "core types", 0, undef, 0, "#stay", "Core Data Type")) 0 0 0
282 0 return 1
283 }
284 # String => '[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*'
285 # attribute => 'Identifier'
286 # context => '#stay'
287 # type => 'RegExpr'
288 0 ▶ if ($self->testRegExpr($text, '[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_\']*', 0, 0, 0, undef, 0, '#stay', 'Identifier')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "[A-Za-z\\300-\\326\\330-\\366\\370-\\377_][A-Za-z\\300-\\326\\330-\\366\\370-\\3770-9_']*", 0, 0, 0, undef, 0, "#stay", "Identifier")) 0 0 0
289 0 return 1
290 }
291 # String => '-?0[xX][0-9A-Fa-f_]+'
292 # attribute => 'Hexadecimal'
293 # context => '#stay'
294 # type => 'RegExpr'
295 0 ▶ if ($self->testRegExpr($text, '-?0[xX][0-9A-Fa-f_]+', 0, 0, 0, undef, 0, '#stay', 'Hexadecimal')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "-?0[xX][0-9A-Fa-f_]+", 0, 0, 0, undef, 0, "#stay", "Hexadecimal")) 0 0 0
296 0 return 1
297 }
298 # String => '-?0[oO][0-7_]+'
299 # attribute => 'Octal'
300 # context => '#stay'
301 # type => 'RegExpr'
302 0 ▶ if ($self->testRegExpr($text, '-?0[oO][0-7_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "-?0[oO][0-7_]+", 0, 0, 0, undef, 0, "#stay", "Octal")) 0 0 0
303 0 return 1
304 }
305 # String => '-?0[bB][01_]+'
306 # attribute => 'Binary'
307 # context => '#stay'
308 # type => 'RegExpr'
309 0 ▶ if ($self->testRegExpr($text, '-?0[bB][01_]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "-?0[bB][01_]+", 0, 0, 0, undef, 0, "#stay", "Binary")) 0 0 0
310 0 return 1
311 }
312 # String => '-?[0-9][0-9_]*(\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)'
313 # attribute => 'Float'
314 # context => '#stay'
315 # type => 'RegExpr'
316 0 ▶ if ($self->testRegExpr($text, '-?[0-9][0-9_]*(\\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)', 0, 0, 0, undef, 0, '#stay', 'Float')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "-?[0-9][0-9_]*(\\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)", 0, 0, 0, undef, 0, "#stay", "Float")) 0 0 0
317 0 return 1
318 }
319 # String => '-?[0-9][0-9_]*'
320 # attribute => 'Decimal'
321 # context => '#stay'
322 # type => 'RegExpr'
323 0 ▶ if ($self->testRegExpr($text, '-?[0-9][0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "-?[0-9][0-9_]*", 0, 0, 0, undef, 0, "#stay", "Decimal")) 0 0 0
324 0 return 1
325 }
326 0 return 0;
327 };
328  
329 sub parseStringConstant {
330 0 ▶ my ($self, $text) = @_;
Subroutine parseStringConstant: not called CC=4 SCAR=30.0
Pod undocumented
331 # attribute => 'String'
332 # char => '"'
333 # context => '#pop'
334 # type => 'DetectChar'
335 0 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "#pop", "String")) 0 0 0
336 0 return 1
337 }
338 # String => '(\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})'
339 # attribute => 'Escaped characters'
340 # context => '#stay'
341 # type => 'RegExpr'
342 0 ▶ if ($self->testRegExpr($text, '(\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "(\\\\[ntbr'\"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})", 0, 0, 0, undef, 0, "#stay", "Escaped characters")) 0 0 0
343 0 return 1
344 }
345 # String => '\\$'
346 # attribute => 'Escaped characters'
347 # context => '#stay'
348 # type => 'RegExpr'
349 0 ▶ if ($self->testRegExpr($text, '\\\\$', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\\$", 0, 0, 0, undef, 0, "#stay", "Escaped characters")) 0 0 0
350 0 return 1
351 }
352 0 return 0;
353 };
354  
355  
356 1 1;
357  
358 __END__
« Kate/TaskJuggler.pm ↑ Summary Kate/Apache_Configuration.pm »