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 '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.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1050
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
18
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
19
|
1
|
|
|
1
|
|
7
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
629
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
664
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
9
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
89
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
19
|
$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
|
1
|
|
|
|
|
12
|
$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
|
1
|
|
|
|
|
4
|
$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
|
1
|
|
|
|
|
17
|
$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
|
1
|
|
|
|
|
11
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
112
|
1
|
|
|
|
|
5
|
$self->basecontext('Normal'); |
113
|
1
|
|
|
|
|
9
|
$self->keywordscase(0); |
114
|
1
|
|
|
|
|
5
|
$self->initialize; |
115
|
1
|
|
|
|
|
5
|
bless ($self, $class); |
116
|
1
|
|
|
|
|
3
|
return $self; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub language { |
120
|
0
|
|
|
0
|
0
|
|
return 'SML'; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub parseMultilineInlineComment { |
124
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
125
|
|
|
|
|
|
|
# attribute => 'Comment' |
126
|
|
|
|
|
|
|
# char => '*' |
127
|
|
|
|
|
|
|
# char1 => ')' |
128
|
|
|
|
|
|
|
# context => '#pop' |
129
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
130
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '*', ')', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
131
|
0
|
|
|
|
|
|
return 1 |
132
|
|
|
|
|
|
|
} |
133
|
0
|
|
|
|
|
|
return 0; |
134
|
|
|
|
|
|
|
}; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub parseNormal { |
137
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
138
|
|
|
|
|
|
|
# attribute => 'Comment' |
139
|
|
|
|
|
|
|
# char => '(' |
140
|
|
|
|
|
|
|
# char1 => '*' |
141
|
|
|
|
|
|
|
# context => 'Multiline/Inline Comment' |
142
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
143
|
0
|
0
|
|
|
|
|
if ($self->testDetect2Chars($text, '(', '*', 0, 0, 0, undef, 0, 'Multiline/Inline Comment', 'Comment')) { |
144
|
0
|
|
|
|
|
|
return 1 |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
# attribute => 'String' |
147
|
|
|
|
|
|
|
# char => '"' |
148
|
|
|
|
|
|
|
# context => 'String' |
149
|
|
|
|
|
|
|
# type => 'DetectChar' |
150
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
151
|
0
|
|
|
|
|
|
return 1 |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
# String => 'keywords' |
154
|
|
|
|
|
|
|
# attribute => 'Keyword' |
155
|
|
|
|
|
|
|
# context => '#stay' |
156
|
|
|
|
|
|
|
# type => 'keyword' |
157
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
158
|
0
|
|
|
|
|
|
return 1 |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
# String => 'types' |
161
|
|
|
|
|
|
|
# attribute => 'Data Type' |
162
|
|
|
|
|
|
|
# context => '#stay' |
163
|
|
|
|
|
|
|
# type => 'keyword' |
164
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) { |
165
|
0
|
|
|
|
|
|
return 1 |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
# attribute => 'Float' |
168
|
|
|
|
|
|
|
# context => '#stay' |
169
|
|
|
|
|
|
|
# items => 'ARRAY(0x18342d0)' |
170
|
|
|
|
|
|
|
# type => 'Float' |
171
|
0
|
0
|
|
|
|
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
172
|
|
|
|
|
|
|
# String => 'fF' |
173
|
|
|
|
|
|
|
# attribute => 'Float' |
174
|
|
|
|
|
|
|
# context => '#stay' |
175
|
|
|
|
|
|
|
# type => 'AnyChar' |
176
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, 'fF', 0, 0, undef, 0, '#stay', 'Float')) { |
177
|
0
|
|
|
|
|
|
return 1 |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
# attribute => 'Decimal' |
181
|
|
|
|
|
|
|
# context => '#stay' |
182
|
|
|
|
|
|
|
# type => 'HlCHex' |
183
|
0
|
0
|
|
|
|
|
if ($self->testHlCHex($text, 0, undef, 0, '#stay', 'Decimal')) { |
184
|
0
|
|
|
|
|
|
return 1 |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
# attribute => 'Decimal' |
187
|
|
|
|
|
|
|
# context => '#stay' |
188
|
|
|
|
|
|
|
# type => 'Int' |
189
|
0
|
0
|
|
|
|
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
190
|
0
|
|
|
|
|
|
return 1 |
191
|
|
|
|
|
|
|
} |
192
|
0
|
|
|
|
|
|
return 0; |
193
|
|
|
|
|
|
|
}; |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub parseString { |
196
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
197
|
|
|
|
|
|
|
# attribute => 'String Char' |
198
|
|
|
|
|
|
|
# context => '#stay' |
199
|
|
|
|
|
|
|
# type => 'HlCStringChar' |
200
|
0
|
0
|
|
|
|
|
if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { |
201
|
0
|
|
|
|
|
|
return 1 |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
# attribute => 'String' |
204
|
|
|
|
|
|
|
# char => '"' |
205
|
|
|
|
|
|
|
# context => '#pop' |
206
|
|
|
|
|
|
|
# type => 'DetectChar' |
207
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
208
|
0
|
|
|
|
|
|
return 1 |
209
|
|
|
|
|
|
|
} |
210
|
0
|
|
|
|
|
|
return 0; |
211
|
|
|
|
|
|
|
}; |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
1; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
__END__ |