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 'sml.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.06 |
9 | #kate version 2.1 |
10 | #kate author Christoph Cullmann (cullmann@kde.org) |
11 | #generated: Sun Feb 3 22:02:06 2008, localtime |
12 | |
13 | package Syntax::Highlight::Engine::Kate::SML; |
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 | 'Comment' => 'Comment', |
27 | 'Data Type' => 'DataType', |
28 | 'Decimal' => 'DecVal', |
29 | 'Float' => 'Float', |
30 | 'Keyword' => 'Keyword', |
31 | 'Normal Text' => 'Normal', |
32 | 'Notice' => 'String', |
33 | 'String' => 'String', |
34 | 'String Char' => 'Char', |
35 | }); |
36 | $self->listAdd('keywords', |
37 | 'abstype', |
38 | 'and', |
39 | 'andalso', |
40 | 'as', |
41 | 'case', |
42 | 'datatype', |
43 | 'do', |
44 | 'else', |
45 | 'end', |
46 | 'eqtype', |
47 | 'exception', |
48 | 'false', |
49 | 'fn', |
50 | 'fun', |
51 | 'functor', |
52 | 'handle', |
53 | 'if', |
54 | 'in', |
55 | 'include', |
56 | 'infix', |
57 | 'infixr', |
58 | 'let', |
59 | 'local', |
60 | 'nonfix', |
61 | 'of', |
62 | 'op', |
63 | 'open', |
64 | 'orelse', |
65 | 'raise', |
66 | 'rec', |
67 | 'sharing', |
68 | 'sig', |
69 | 'signature', |
70 | 'struct', |
71 | 'structure', |
72 | 'then', |
73 | 'true', |
74 | 'type', |
75 | 'val', |
76 | 'where', |
77 | 'while', |
78 | 'with', |
79 | 'withtype', |
80 | ); |
81 | $self->listAdd('types', |
82 | 'array', |
83 | 'bool', |
84 | 'char', |
85 | 'int', |
86 | 'list', |
87 | 'option', |
88 | 'order', |
89 | 'real', |
90 | 'ref', |
91 | 'string', |
92 | 'substring', |
93 | 'unit', |
94 | 'vector', |
95 | 'word', |
96 | ); |
97 | $self->contextdata({ |
98 | 'Multiline/Inline Comment' => { |
99 | callback => \&parseMultilineInlineComment, |
100 | attribute => 'Comment', |
101 | }, |
102 | 'Normal' => { |
103 | callback => \&parseNormal, |
104 | attribute => 'Normal Text', |
105 | }, |
106 | 'String' => { |
107 | callback => \&parseString, |
108 | attribute => 'String', |
109 | }, |
110 | }); |
111 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
112 | $self->basecontext('Normal'); |
113 | $self->keywordscase(0); |
114 | $self->initialize; |
115 | bless ($self, $class); |
116 | return $self; |
117 | } |
118 | |
119 | sub language { |
120 | return 'SML'; |
121 | } |
122 | |
123 | sub parseMultilineInlineComment { |
124 | my ($self, $text) = @_; |
125 | # attribute => 'Comment' |
126 | # char => '*' |
127 | # char1 => ')' |
128 | # context => '#pop' |
129 | # type => 'Detect2Chars' |
130 | if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
131 | return 1 |
132 | } |
133 | return 0; |
134 | }; |
135 | |
136 | sub parseNormal { |
137 | my ($self, $text) = @_; |
138 | # attribute => 'Comment' |
139 | # char => '(' |
140 | # char1 => '*' |
141 | # context => 'Multiline/Inline Comment' |
142 | # type => 'Detect2Chars' |
143 | if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline/Inline Comment', 'Comment')) { |
144 | return 1 |
145 | } |
146 | # attribute => 'String' |
147 | # char => '"' |
148 | # context => 'String' |
149 | # type => 'DetectChar' |
150 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
151 | return 1 |
152 | } |
153 | # String => 'keywords' |
154 | # attribute => 'Keyword' |
155 | # context => '#stay' |
156 | # type => 'keyword' |
157 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
158 | return 1 |
159 | } |
160 | # String => 'types' |
161 | # attribute => 'Data Type' |
162 | # context => '#stay' |
163 | # type => 'keyword' |
164 | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) { |
165 | return 1 |
166 | } |
167 | # attribute => 'Float' |
168 | # context => '#stay' |
169 | # items => 'ARRAY(0x18342d0)' |
170 | # type => 'Float' |
171 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
172 | # String => 'fF' |
173 | # attribute => 'Float' |
174 | # context => '#stay' |
175 | # type => 'AnyChar' |
176 | if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) { |
177 | return 1 |
178 | } |
179 | } |
180 | # attribute => 'Decimal' |
181 | # context => '#stay' |
182 | # type => 'HlCHex' |
183 | if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Decimal')) { |
184 | return 1 |
185 | } |
186 | # attribute => 'Decimal' |
187 | # context => '#stay' |
188 | # type => 'Int' |
189 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
190 | return 1 |
191 | } |
192 | return 0; |
193 | }; |
194 | |
195 | sub parseString { |
196 | my ($self, $text) = @_; |
197 | # attribute => 'String Char' |
198 | # context => '#stay' |
199 | # type => 'HlCStringChar' |
200 | if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
201 | return 1 |
202 | } |
203 | # attribute => 'String' |
204 | # char => '"' |
205 | # context => '#pop' |
206 | # type => 'DetectChar' |
207 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
208 | return 1 |
209 | } |
210 | return 0; |
211 | }; |
212 | |
213 | |
214 | 1; |
215 | |
216 | __END__ |
217 | |
218 | =head1 NAME |
219 | |
220 | Syntax::Highlight::Engine::Kate::SML - a Plugin for SML syntax highlighting |
221 | |
222 | =head1 SYNOPSIS |
223 | |
224 | require Syntax::Highlight::Engine::Kate::SML; |
225 | my $sh = new Syntax::Highlight::Engine::Kate::SML([ |
226 | ]); |
227 | |
228 | =head1 DESCRIPTION |
229 | |
230 | Syntax::Highlight::Engine::Kate::SML is a plugin module that provides syntax highlighting |
231 | for SML to the Syntax::Haghlight::Engine::Kate highlighting engine. |
232 | |
233 | This code is generated from the syntax definition files used |
234 | by the Kate project. |
235 | It works quite fine, but can use refinement and optimization. |
236 | |
237 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
238 | |
239 | =cut |
240 | |
241 | =head1 AUTHOR |
242 | |
243 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
244 | |
245 | =cut |
246 | |
247 | =head1 BUGS |
248 | |
249 | Unknown. If you find any, please contact the author |
250 | |
251 | =cut |
252 | |