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 'matlab.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.20 |
9
|
|
|
|
|
|
|
#kate version 2.2 |
10
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Matlab; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
475
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
17
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
18
|
1
|
|
|
1
|
|
42
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
641
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
2
|
|
|
2
|
0
|
527
|
my $proto = shift; |
22
|
2
|
|
33
|
|
|
8
|
my $class = ref($proto) || $proto; |
23
|
2
|
|
|
|
|
11
|
my $self = $class->SUPER::new(@_); |
24
|
2
|
|
|
|
|
14
|
$self->attributes({ |
25
|
|
|
|
|
|
|
'Comment' => 'Comment', |
26
|
|
|
|
|
|
|
'Delimiter' => 'Normal', |
27
|
|
|
|
|
|
|
'Incomplete String' => 'Char', |
28
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
29
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
30
|
|
|
|
|
|
|
'Number' => 'Float', |
31
|
|
|
|
|
|
|
'Operator' => 'Normal', |
32
|
|
|
|
|
|
|
'String' => 'String', |
33
|
|
|
|
|
|
|
'System' => 'BaseN', |
34
|
|
|
|
|
|
|
'Variable' => 'Variable', |
35
|
|
|
|
|
|
|
}); |
36
|
2
|
|
|
|
|
8
|
$self->listAdd('KeywordsList', |
37
|
|
|
|
|
|
|
'break', |
38
|
|
|
|
|
|
|
'case', |
39
|
|
|
|
|
|
|
'catch', |
40
|
|
|
|
|
|
|
'continue', |
41
|
|
|
|
|
|
|
'else', |
42
|
|
|
|
|
|
|
'elseif', |
43
|
|
|
|
|
|
|
'end', |
44
|
|
|
|
|
|
|
'for', |
45
|
|
|
|
|
|
|
'function', |
46
|
|
|
|
|
|
|
'global', |
47
|
|
|
|
|
|
|
'if', |
48
|
|
|
|
|
|
|
'otherwise', |
49
|
|
|
|
|
|
|
'persistent', |
50
|
|
|
|
|
|
|
'return', |
51
|
|
|
|
|
|
|
'switch', |
52
|
|
|
|
|
|
|
'try', |
53
|
|
|
|
|
|
|
'while', |
54
|
|
|
|
|
|
|
); |
55
|
2
|
|
|
|
|
13
|
$self->contextdata({ |
56
|
|
|
|
|
|
|
'_adjoint' => { |
57
|
|
|
|
|
|
|
callback => \&parse_adjoint, |
58
|
|
|
|
|
|
|
attribute => 'Operator', |
59
|
|
|
|
|
|
|
lineending => '#pop', |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
'_normal' => { |
62
|
|
|
|
|
|
|
callback => \&parse_normal, |
63
|
|
|
|
|
|
|
attribute => 'Normal Text', |
64
|
|
|
|
|
|
|
lineending => '#pop', |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
}); |
67
|
2
|
|
|
|
|
7
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
68
|
2
|
|
|
|
|
8
|
$self->basecontext('_normal'); |
69
|
2
|
|
|
|
|
5
|
$self->keywordscase(0); |
70
|
2
|
|
|
|
|
5
|
$self->initialize; |
71
|
2
|
|
|
|
|
4
|
bless ($self, $class); |
72
|
2
|
|
|
|
|
7
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub language { |
76
|
0
|
|
|
0
|
0
|
0
|
return 'Matlab'; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub parse_adjoint { |
80
|
0
|
|
|
0
|
0
|
0
|
my ($self, $text) = @_; |
81
|
|
|
|
|
|
|
# String => ''+' |
82
|
|
|
|
|
|
|
# attribute => 'Operator' |
83
|
|
|
|
|
|
|
# context => '#pop' |
84
|
|
|
|
|
|
|
# type => 'RegExpr' |
85
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\'+', 0, 0, 0, undef, 0, '#pop', 'Operator')) { |
86
|
0
|
|
|
|
|
0
|
return 1 |
87
|
|
|
|
|
|
|
} |
88
|
0
|
|
|
|
|
0
|
return 0; |
89
|
|
|
|
|
|
|
}; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub parse_normal { |
92
|
58
|
|
|
58
|
0
|
85
|
my ($self, $text) = @_; |
93
|
|
|
|
|
|
|
# String => '[a-zA-Z]\w*(?=')' |
94
|
|
|
|
|
|
|
# attribute => 'Variable' |
95
|
|
|
|
|
|
|
# context => '_adjoint' |
96
|
|
|
|
|
|
|
# type => 'RegExpr' |
97
|
58
|
50
|
|
|
|
122
|
if ($self->testRegExpr($text, '[a-zA-Z]\\w*(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Variable')) { |
98
|
0
|
|
|
|
|
0
|
return 1 |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
# String => '(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?(?=')' |
101
|
|
|
|
|
|
|
# attribute => 'Number' |
102
|
|
|
|
|
|
|
# context => '_adjoint' |
103
|
|
|
|
|
|
|
# type => 'RegExpr' |
104
|
58
|
50
|
|
|
|
137
|
if ($self->testRegExpr($text, '(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Number')) { |
105
|
0
|
|
|
|
|
0
|
return 1 |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
# String => '[\)\]}](?=')' |
108
|
|
|
|
|
|
|
# attribute => 'Delimiter' |
109
|
|
|
|
|
|
|
# context => '_adjoint' |
110
|
|
|
|
|
|
|
# type => 'RegExpr' |
111
|
58
|
50
|
|
|
|
125
|
if ($self->testRegExpr($text, '[\\)\\]}](?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Delimiter')) { |
112
|
0
|
|
|
|
|
0
|
return 1 |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
# String => '\.'(?=')' |
115
|
|
|
|
|
|
|
# attribute => 'Operator' |
116
|
|
|
|
|
|
|
# context => '_adjoint' |
117
|
|
|
|
|
|
|
# type => 'RegExpr' |
118
|
58
|
50
|
|
|
|
125
|
if ($self->testRegExpr($text, '\\.\'(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Operator')) { |
119
|
0
|
|
|
|
|
0
|
return 1 |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
# String => ''[^']*(''[^']*)*'(?=[^']|$)' |
122
|
|
|
|
|
|
|
# attribute => 'String' |
123
|
|
|
|
|
|
|
# context => '#stay' |
124
|
|
|
|
|
|
|
# type => 'RegExpr' |
125
|
58
|
50
|
|
|
|
125
|
if ($self->testRegExpr($text, '\'[^\']*(\'\'[^\']*)*\'(?=[^\']|$)', 0, 0, 0, undef, 0, '#stay', 'String')) { |
126
|
0
|
|
|
|
|
0
|
return 1 |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
# String => ''[^']*(''[^']*)*' |
129
|
|
|
|
|
|
|
# attribute => 'Incomplete String' |
130
|
|
|
|
|
|
|
# context => '#stay' |
131
|
|
|
|
|
|
|
# type => 'RegExpr' |
132
|
58
|
50
|
|
|
|
144
|
if ($self->testRegExpr($text, '\'[^\']*(\'\'[^\']*)*', 0, 0, 0, undef, 0, '#stay', 'Incomplete String')) { |
133
|
0
|
|
|
|
|
0
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
# String => 'KeywordsList' |
136
|
|
|
|
|
|
|
# attribute => 'Keyword' |
137
|
|
|
|
|
|
|
# context => '#stay' |
138
|
|
|
|
|
|
|
# type => 'keyword' |
139
|
58
|
50
|
|
|
|
139
|
if ($self->testKeyword($text, 'KeywordsList', 0, undef, 0, '#stay', 'Keyword')) { |
140
|
0
|
|
|
|
|
0
|
return 1 |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
# String => '%.*$' |
143
|
|
|
|
|
|
|
# attribute => 'Comment' |
144
|
|
|
|
|
|
|
# context => '#stay' |
145
|
|
|
|
|
|
|
# type => 'RegExpr' |
146
|
58
|
50
|
|
|
|
119
|
if ($self->testRegExpr($text, '%.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { |
147
|
0
|
|
|
|
|
0
|
return 1 |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
# String => '!.*$' |
150
|
|
|
|
|
|
|
# attribute => 'System' |
151
|
|
|
|
|
|
|
# context => '#stay' |
152
|
|
|
|
|
|
|
# type => 'RegExpr' |
153
|
58
|
50
|
|
|
|
120
|
if ($self->testRegExpr($text, '!.*$', 0, 0, 0, undef, 0, '#stay', 'System')) { |
154
|
0
|
|
|
|
|
0
|
return 1 |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
# String => '[a-zA-Z]\w*' |
157
|
|
|
|
|
|
|
# attribute => 'Variable' |
158
|
|
|
|
|
|
|
# context => '#stay' |
159
|
|
|
|
|
|
|
# type => 'RegExpr' |
160
|
58
|
50
|
|
|
|
113
|
if ($self->testRegExpr($text, '[a-zA-Z]\\w*', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
161
|
0
|
|
|
|
|
0
|
return 1 |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
# String => '(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?' |
164
|
|
|
|
|
|
|
# attribute => 'Number' |
165
|
|
|
|
|
|
|
# context => '#stay' |
166
|
|
|
|
|
|
|
# type => 'RegExpr' |
167
|
58
|
50
|
|
|
|
134
|
if ($self->testRegExpr($text, '(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?', 0, 0, 0, undef, 0, '#stay', 'Number')) { |
168
|
0
|
|
|
|
|
0
|
return 1 |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
# String => '()[]{}' |
171
|
|
|
|
|
|
|
# attribute => 'Delimiter' |
172
|
|
|
|
|
|
|
# context => '#stay' |
173
|
|
|
|
|
|
|
# type => 'AnyChar' |
174
|
58
|
50
|
|
|
|
138
|
if ($self->testAnyChar($text, '()[]{}', 0, 0, undef, 0, '#stay', 'Delimiter')) { |
175
|
0
|
|
|
|
|
0
|
return 1 |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
# String => '...' |
178
|
|
|
|
|
|
|
# attribute => 'Operator' |
179
|
|
|
|
|
|
|
# context => '#stay' |
180
|
|
|
|
|
|
|
# type => 'StringDetect' |
181
|
58
|
50
|
|
|
|
125
|
if ($self->testStringDetect($text, '...', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
182
|
0
|
|
|
|
|
0
|
return 1 |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
# String => '==' |
185
|
|
|
|
|
|
|
# attribute => 'Operator' |
186
|
|
|
|
|
|
|
# context => '#stay' |
187
|
|
|
|
|
|
|
# type => 'StringDetect' |
188
|
58
|
100
|
|
|
|
108
|
if ($self->testStringDetect($text, '==', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
189
|
52
|
|
|
|
|
96
|
return 1 |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
# String => '~=' |
192
|
|
|
|
|
|
|
# attribute => 'Operator' |
193
|
|
|
|
|
|
|
# context => '#stay' |
194
|
|
|
|
|
|
|
# type => 'StringDetect' |
195
|
6
|
50
|
|
|
|
12
|
if ($self->testStringDetect($text, '~=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
196
|
0
|
|
|
|
|
0
|
return 1 |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
# String => '<=' |
199
|
|
|
|
|
|
|
# attribute => 'Operator' |
200
|
|
|
|
|
|
|
# context => '#stay' |
201
|
|
|
|
|
|
|
# type => 'StringDetect' |
202
|
6
|
50
|
|
|
|
11
|
if ($self->testStringDetect($text, '<=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
203
|
0
|
|
|
|
|
0
|
return 1 |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
# String => '>=' |
206
|
|
|
|
|
|
|
# attribute => 'Operator' |
207
|
|
|
|
|
|
|
# context => '#stay' |
208
|
|
|
|
|
|
|
# type => 'StringDetect' |
209
|
6
|
50
|
|
|
|
13
|
if ($self->testStringDetect($text, '>=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
210
|
0
|
|
|
|
|
0
|
return 1 |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
# String => '&&' |
213
|
|
|
|
|
|
|
# attribute => 'Operator' |
214
|
|
|
|
|
|
|
# context => '#stay' |
215
|
|
|
|
|
|
|
# type => 'StringDetect' |
216
|
6
|
50
|
|
|
|
11
|
if ($self->testStringDetect($text, '&&', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
217
|
0
|
|
|
|
|
0
|
return 1 |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
# String => '||' |
220
|
|
|
|
|
|
|
# attribute => 'Operator' |
221
|
|
|
|
|
|
|
# context => '#stay' |
222
|
|
|
|
|
|
|
# type => 'StringDetect' |
223
|
6
|
50
|
|
|
|
15
|
if ($self->testStringDetect($text, '||', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
224
|
0
|
|
|
|
|
0
|
return 1 |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
# String => '.*' |
227
|
|
|
|
|
|
|
# attribute => 'Operator' |
228
|
|
|
|
|
|
|
# context => '#stay' |
229
|
|
|
|
|
|
|
# type => 'StringDetect' |
230
|
6
|
50
|
|
|
|
15
|
if ($self->testStringDetect($text, '.*', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
231
|
0
|
|
|
|
|
0
|
return 1 |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
# String => '.^' |
234
|
|
|
|
|
|
|
# attribute => 'Operator' |
235
|
|
|
|
|
|
|
# context => '#stay' |
236
|
|
|
|
|
|
|
# type => 'StringDetect' |
237
|
6
|
50
|
|
|
|
16
|
if ($self->testStringDetect($text, '.^', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
238
|
0
|
|
|
|
|
0
|
return 1 |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
# String => './' |
241
|
|
|
|
|
|
|
# attribute => 'Operator' |
242
|
|
|
|
|
|
|
# context => '#stay' |
243
|
|
|
|
|
|
|
# type => 'StringDetect' |
244
|
6
|
50
|
|
|
|
12
|
if ($self->testStringDetect($text, './', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
245
|
0
|
|
|
|
|
0
|
return 1 |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
# String => '.'' |
248
|
|
|
|
|
|
|
# attribute => 'Operator' |
249
|
|
|
|
|
|
|
# context => '#stay' |
250
|
|
|
|
|
|
|
# type => 'StringDetect' |
251
|
6
|
50
|
|
|
|
11
|
if ($self->testStringDetect($text, '.\'', 0, 0, 0, undef, 0, '#stay', 'Operator')) { |
252
|
0
|
|
|
|
|
0
|
return 1 |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
# String => '*+-/\&|<>~^=,;:@' |
255
|
|
|
|
|
|
|
# attribute => 'Operator' |
256
|
|
|
|
|
|
|
# context => '#stay' |
257
|
|
|
|
|
|
|
# type => 'AnyChar' |
258
|
6
|
100
|
|
|
|
9
|
if ($self->testAnyChar($text, '*+-/\\&|<>~^=,;:@', 0, 0, undef, 0, '#stay', 'Operator')) { |
259
|
2
|
|
|
|
|
6
|
return 1 |
260
|
|
|
|
|
|
|
} |
261
|
4
|
|
|
|
|
9
|
return 0; |
262
|
|
|
|
|
|
|
}; |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
1; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
__END__ |