Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Objective_Caml.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 our $VERSION = '0.06';
16
17 use strict;
18 use warnings;
19 use base('Syntax::Highlight::Engine::Kate::Template');
20
21 sub new {
22    my $proto = shift;
23    my $class = ref($proto) || $proto;
24    my $self = $class->SUPER::new(@_);
25    $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    $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    $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    $self->listAdd('revised syntax keywords',
116       'declare',
117       'value',
118       'where',
119    );
120    $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    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
139    $self->basecontext('Normal');
140    $self->keywordscase(0);
141    $self->initialize;
142    bless ($self, $class);
143    return $self;
144 }
145
146 sub language {
147    return 'Objective Caml';
148 }
149
150 sub parseCamlp4QuotationConstant {
151    my ($self, $text) = @_;
152    # attribute => 'Camlp4 Quotation'
153    # char => '>'
154    # char1 => '>'
155    # context => '#pop'
156    # type => 'Detect2Chars'
157    if ($self->testDetect2Chars($text, '>', '>', 0, 0, 0, undef, 0, '#pop', 'Camlp4 Quotation')) {
158       return 1
159    }
160    # attribute => 'Camlp4 Quotation'
161    # char => '<'
162    # char1 => '<'
163    # context => 'Camlp4 Quotation Constant'
164    # type => 'Detect2Chars'
165    if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
166       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    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')) {
173       return 1
174    }
175    # String => '\\(\\|>>|<<)'
176    # attribute => 'Escaped characters'
177    # context => '#stay'
178    # type => 'RegExpr'
179    if ($self->testRegExpr($text, '\\\\(\\\\|>>|<<)', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
180       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    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')) {
187       return 1
188    }
189    return 0;
190 };
191
192 sub parseMultilineComment {
193    my ($self, $text) = @_;
194    # attribute => 'Comment'
195    # char => '*'
196    # char1 => ')'
197    # context => '#pop'
198    # endRegion => 'comment'
199    # type => 'Detect2Chars'
200    if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
201       return 1
202    }
203    # attribute => 'Comment'
204    # beginRegion => 'comment'
205    # char => '('
206    # char1 => '*'
207    # context => 'Multiline Comment'
208    # type => 'Detect2Chars'
209    if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
210       return 1
211    }
212    return 0;
213 };
214
215 sub parseNormal {
216    my ($self, $text) = @_;
217    # attribute => 'Comment'
218    # beginRegion => 'comment'
219    # char => '('
220    # char1 => '*'
221    # context => 'Multiline Comment'
222    # type => 'Detect2Chars'
223    if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
224       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    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')) {
232       return 1
233    }
234    # attribute => 'String'
235    # char => '"'
236    # context => 'String Constant'
237    # type => 'DetectChar'
238    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String Constant', 'String')) {
239       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    if ($self->testRegExpr($text, '\'((\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})|[^\'])\'', 0, 0, 0, undef, 0, '#stay', 'Character')) {
246       return 1
247    }
248    # attribute => 'Camlp4 Quotation'
249    # char => '<'
250    # char1 => '<'
251    # context => 'Camlp4 Quotation Constant'
252    # type => 'Detect2Chars'
253    if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
254       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    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')) {
261       return 1
262    }
263    # String => 'keywords'
264    # attribute => 'Keyword'
265    # context => '#stay'
266    # type => 'keyword'
267    if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
268       return 1
269    }
270    # String => 'revised syntax keywords'
271    # attribute => 'Revised Syntax Keyword'
272    # context => '#stay'
273    # type => 'keyword'
274    if ($self->testKeyword($text, 'revised syntax keywords', 0, undef, 0, '#stay', 'Revised Syntax Keyword')) {
275       return 1
276    }
277    # String => 'core types'
278    # attribute => 'Core Data Type'
279    # context => '#stay'
280    # type => 'keyword'
281    if ($self->testKeyword($text, 'core types', 0, undef, 0, '#stay', 'Core Data Type')) {
282       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    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')) {
289       return 1
290    }
291    # String => '-?0[xX][0-9A-Fa-f_]+'
292    # attribute => 'Hexadecimal'
293    # context => '#stay'
294    # type => 'RegExpr'
295    if ($self->testRegExpr($text, '-?0[xX][0-9A-Fa-f_]+', 0, 0, 0, undef, 0, '#stay', 'Hexadecimal')) {
296       return 1
297    }
298    # String => '-?0[oO][0-7_]+'
299    # attribute => 'Octal'
300    # context => '#stay'
301    # type => 'RegExpr'
302    if ($self->testRegExpr($text, '-?0[oO][0-7_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
303       return 1
304    }
305    # String => '-?0[bB][01_]+'
306    # attribute => 'Binary'
307    # context => '#stay'
308    # type => 'RegExpr'
309    if ($self->testRegExpr($text, '-?0[bB][01_]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
310       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    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')) {
317       return 1
318    }
319    # String => '-?[0-9][0-9_]*'
320    # attribute => 'Decimal'
321    # context => '#stay'
322    # type => 'RegExpr'
323    if ($self->testRegExpr($text, '-?[0-9][0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
324       return 1
325    }
326    return 0;
327 };
328
329 sub parseStringConstant {
330    my ($self, $text) = @_;
331    # attribute => 'String'
332    # char => '"'
333    # context => '#pop'
334    # type => 'DetectChar'
335    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
336       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    if ($self->testRegExpr($text, '(\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
343       return 1
344    }
345    # String => '\\$'
346    # attribute => 'Escaped characters'
347    # context => '#stay'
348    # type => 'RegExpr'
349    if ($self->testRegExpr($text, '\\\\$', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
350       return 1
351    }
352    return 0;
353 };
354
355
356 1;
357
358 __END__
359
360 =head1 NAME
361
362 Syntax::Highlight::Engine::Kate::Objective_Caml - a Plugin for Objective Caml syntax highlighting
363
364 =head1 SYNOPSIS
365
366  require Syntax::Highlight::Engine::Kate::Objective_Caml;
367  my $sh = new Syntax::Highlight::Engine::Kate::Objective_Caml([
368  ]);
369
370 =head1 DESCRIPTION
371
372 Syntax::Highlight::Engine::Kate::Objective_Caml is a  plugin module that provides syntax highlighting
373 for Objective Caml to the Syntax::Haghlight::Engine::Kate highlighting engine.
374
375 This code is generated from the syntax definition files used
376 by the Kate project.
377 It works quite fine, but can use refinement and optimization.
378
379 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
380
381 =cut
382
383 =head1 AUTHOR
384
385 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
386
387 =cut
388
389 =head1 BUGS
390
391 Unknown. If you find any, please contact the author
392
393 =cut
394