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.
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
10 #kate author Glyn Webster (glyn@wave.co.nz)
11 #generated: Sun Feb 3 22:02:05 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Objective_Caml;
15 our $VERSION = '0.06';
19 use base('Syntax::Highlight::Engine::Kate::Template');
23 my $class = ref($proto) || $proto;
24 my $self = $class->SUPER::new(@_);
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',
35 'Hexadecimal' => 'BaseN',
36 'Identifier' => 'Normal',
37 'Keyword' => 'Keyword',
38 'Normal Text' => 'Normal',
40 'Revised Syntax Keyword' => 'Normal',
43 $self->listAdd('core types',
58 $self->listAdd('keywords',
115 $self->listAdd('revised syntax keywords',
121 'Camlp4 Quotation Constant' => {
122 callback => \&parseCamlp4QuotationConstant,
123 attribute => 'Camlp4 Quotation',
125 'Multiline Comment' => {
126 callback => \&parseMultilineComment,
127 attribute => 'Comment',
130 callback => \&parseNormal,
131 attribute => 'Normal Text',
133 'String Constant' => {
134 callback => \&parseStringConstant,
135 attribute => 'String',
138 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
139 $self->basecontext('Normal');
140 $self->keywordscase(0);
142 bless ($self, $class);
147 return 'Objective Caml';
150 sub parseCamlp4QuotationConstant {
151 my ($self, $text) = @_;
152 # attribute => 'Camlp4 Quotation'
156 # type => 'Detect2Chars'
157 if ($self->testDetect2Chars($text, '>', '>', 0, 0, 0, undef, 0, '#pop', 'Camlp4 Quotation')) {
160 # attribute => 'Camlp4 Quotation'
163 # context => 'Camlp4 Quotation Constant'
164 # type => 'Detect2Chars'
165 if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
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'
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')) {
175 # String => '\\(\\|>>|<<)'
176 # attribute => 'Escaped characters'
179 if ($self->testRegExpr($text, '\\\\(\\\\|>>|<<)', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
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'
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')) {
192 sub parseMultilineComment {
193 my ($self, $text) = @_;
194 # attribute => 'Comment'
198 # endRegion => 'comment'
199 # type => 'Detect2Chars'
200 if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
203 # attribute => 'Comment'
204 # beginRegion => 'comment'
207 # context => 'Multiline Comment'
208 # type => 'Detect2Chars'
209 if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
216 my ($self, $text) = @_;
217 # attribute => 'Comment'
218 # beginRegion => 'comment'
221 # context => 'Multiline Comment'
222 # type => 'Detect2Chars'
223 if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline Comment', 'Comment')) {
226 # String => '#[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*.*$'
227 # attribute => 'Directive'
229 # firstNonSpace => 'true'
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')) {
234 # attribute => 'String'
236 # context => 'String Constant'
237 # type => 'DetectChar'
238 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String Constant', 'String')) {
241 # String => ''((\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})|[^'])''
242 # attribute => 'Character'
245 if ($self->testRegExpr($text, '\'((\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})|[^\'])\'', 0, 0, 0, undef, 0, '#stay', 'Character')) {
248 # attribute => 'Camlp4 Quotation'
251 # context => 'Camlp4 Quotation Constant'
252 # type => 'Detect2Chars'
253 if ($self->testDetect2Chars($text, '<', '<', 0, 0, 0, undef, 0, 'Camlp4 Quotation Constant', 'Camlp4 Quotation')) {
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'
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')) {
263 # String => 'keywords'
264 # attribute => 'Keyword'
267 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
270 # String => 'revised syntax keywords'
271 # attribute => 'Revised Syntax Keyword'
274 if ($self->testKeyword($text, 'revised syntax keywords', 0, undef, 0, '#stay', 'Revised Syntax Keyword')) {
277 # String => 'core types'
278 # attribute => 'Core Data Type'
281 if ($self->testKeyword($text, 'core types', 0, undef, 0, '#stay', 'Core Data Type')) {
284 # String => '[A-Za-z\300-\326\330-\366\370-\377_][A-Za-z\300-\326\330-\366\370-\3770-9_']*'
285 # attribute => 'Identifier'
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')) {
291 # String => '-?0[xX][0-9A-Fa-f_]+'
292 # attribute => 'Hexadecimal'
295 if ($self->testRegExpr($text, '-?0[xX][0-9A-Fa-f_]+', 0, 0, 0, undef, 0, '#stay', 'Hexadecimal')) {
298 # String => '-?0[oO][0-7_]+'
299 # attribute => 'Octal'
302 if ($self->testRegExpr($text, '-?0[oO][0-7_]+', 0, 0, 0, undef, 0, '#stay', 'Octal')) {
305 # String => '-?0[bB][01_]+'
306 # attribute => 'Binary'
309 if ($self->testRegExpr($text, '-?0[bB][01_]+', 0, 0, 0, undef, 0, '#stay', 'Binary')) {
312 # String => '-?[0-9][0-9_]*(\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)'
313 # attribute => 'Float'
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')) {
319 # String => '-?[0-9][0-9_]*'
320 # attribute => 'Decimal'
323 if ($self->testRegExpr($text, '-?[0-9][0-9_]*', 0, 0, 0, undef, 0, '#stay', 'Decimal')) {
329 sub parseStringConstant {
330 my ($self, $text) = @_;
331 # attribute => 'String'
334 # type => 'DetectChar'
335 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
338 # String => '(\\[ntbr'"\\]|\\[0-9]{3}|\\x[0-9A-Fa-f]{2})'
339 # attribute => 'Escaped characters'
342 if ($self->testRegExpr($text, '(\\\\[ntbr\'"\\\\]|\\\\[0-9]{3}|\\\\x[0-9A-Fa-f]{2})', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
346 # attribute => 'Escaped characters'
349 if ($self->testRegExpr($text, '\\\\$', 0, 0, 0, undef, 0, '#stay', 'Escaped characters')) {
362 Syntax::Highlight::Engine::Kate::Objective_Caml - a Plugin for Objective Caml syntax highlighting
366 require Syntax::Highlight::Engine::Kate::Objective_Caml;
367 my $sh = new Syntax::Highlight::Engine::Kate::Objective_Caml([
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.
375 This code is generated from the syntax definition files used
377 It works quite fine, but can use refinement and optimization.
379 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
385 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
391 Unknown. If you find any, please contact the author