Changeset View
Changeset View
Standalone View
Standalone View
data/syntax/matlab.xml
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 2 | <!-- | |||
---|---|---|---|---|---|
52 | 25-Jan-09 Addedd basic support for OOP (Matlab 2008) (by Leonardo Finetti) | 52 | 25-Jan-09 Addedd basic support for OOP (Matlab 2008) (by Leonardo Finetti) | ||
53 | 53 | | |||
54 | Author: Stefan Stoll, Swiss Federal Institute of Technology, Zurich | 54 | Author: Stefan Stoll, Swiss Federal Institute of Technology, Zurich | ||
55 | Co-author: Leonardo Finetti, www.finex.org | 55 | Co-author: Leonardo Finetti, www.finex.org | ||
56 | --> | 56 | --> | ||
57 | 57 | | |||
58 | <!DOCTYPE language SYSTEM "language.dtd"> | 58 | <!DOCTYPE language SYSTEM "language.dtd"> | ||
59 | 59 | | |||
60 | <language name="Matlab" version="2" kateversion="2.2" section="Scientific" extensions="*.m;*.M" mimetype="text/mfile" casesensitive="1"> | 60 | <language name="Matlab" version="3" kateversion="5.0" section="Scientific" extensions="*.m;*.M" mimetype="text/mfile" casesensitive="1"> | ||
61 | <highlighting> | 61 | <highlighting> | ||
62 | 62 | | |||
63 | <!-- Reserved keywords in MATLAB --> | 63 | <!-- Reserved keywords in MATLAB --> | ||
64 | <list name="KeywordsList"> | 64 | <list name="KeywordsList"> | ||
65 | <item>break</item> | 65 | <item>break</item> | ||
66 | <item>case</item> | 66 | <item>case</item> | ||
67 | <item>catch</item> | 67 | <item>catch</item> | ||
68 | <item>classdef</item> | 68 | <item>classdef</item> | ||
Show All 24 Lines | 92 | <context name="_normal" attribute="Normal Text" lineEndContext="#stay"> | |||
93 | 93 | | |||
94 | <!-- Look-ahead for adjoint ' after variable, number literal, closing braces and .' --> | 94 | <!-- Look-ahead for adjoint ' after variable, number literal, closing braces and .' --> | ||
95 | <RegExpr context="_adjoint" attribute="Variable" String="[a-zA-Z]\w*(?=')" /> | 95 | <RegExpr context="_adjoint" attribute="Variable" String="[a-zA-Z]\w*(?=')" /> | ||
96 | <RegExpr context="_adjoint" attribute="Number" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?(?=')" /> | 96 | <RegExpr context="_adjoint" attribute="Number" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?(?=')" /> | ||
97 | <RegExpr context="_adjoint" attribute="Delimiter" String="[\)\]}](?=')" /> | 97 | <RegExpr context="_adjoint" attribute="Delimiter" String="[\)\]}](?=')" /> | ||
98 | <RegExpr context="_adjoint" attribute="Operator" String="\.'(?=')" /> | 98 | <RegExpr context="_adjoint" attribute="Operator" String="\.'(?=')" /> | ||
99 | 99 | | |||
100 | <!-- If ' is not the adjoint operator, it starts a string or an unterminated string --> | 100 | <!-- If ' is not the adjoint operator, it starts a string or an unterminated string --> | ||
101 | <RegExpr context="#stay" attribute="String" String="'[^']*(''[^']*)*'(?=[^']|$)" /> | 101 | <RegExpr context="#stay" attribute="CharVector" String="'[^']*(''[^']*)*'(?=[^']|$)" /> | ||
102 | <RegExpr context="#stay" attribute="Incomplete String" String="'[^']*(''[^']*)*" /> | 102 | <RegExpr context="#stay" attribute="Incomplete CharVector" String="'[^']*(''[^']*)*" /> | ||
103 | <RegExpr context="#stay" attribute="String" String=""[^"]*(""[^"]*)*"(?=[^"]|$)" /> | ||||
104 | <RegExpr context="#stay" attribute="Incomplete String" String=""[^"]*(""[^"]*)*" /> | ||||
103 | 105 | | |||
104 | <!-- Handling of keywords, comments, system commands, identifiers, numbers and braces --> | 106 | <!-- Handling of keywords, comments, system commands, identifiers, numbers and braces --> | ||
105 | <keyword context="#stay" attribute="Keyword" String="KeywordsList" /> | 107 | <keyword context="#stay" attribute="Keyword" String="KeywordsList" /> | ||
106 | <RegExpr context="#stay" attribute="Comment" String="%.*$" /> | 108 | <RegExpr context="#stay" attribute="Comment" String="%.*$" /> | ||
107 | <RegExpr context="#stay" attribute="System" String="!.*$" /> | 109 | <RegExpr context="#stay" attribute="System" String="!.*$" /> | ||
108 | <RegExpr context="#stay" attribute="Variable" String="[a-zA-Z]\w*" /> | 110 | <RegExpr context="#stay" attribute="Variable" String="[a-zA-Z]\w*" /> | ||
109 | <RegExpr context="#stay" attribute="Number" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?" /> | 111 | <RegExpr context="#stay" attribute="Number" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?" /> | ||
110 | <AnyChar context="#stay" attribute="Delimiter" String="()[]{}"/> | 112 | <AnyChar context="#stay" attribute="Delimiter" String="()[]{}"/> | ||
Show All 20 Lines | |||||
131 | <context name="_adjoint" attribute="Operator" lineEndContext="#pop"> | 133 | <context name="_adjoint" attribute="Operator" lineEndContext="#pop"> | ||
132 | <RegExpr context="#pop" attribute="Operator" String="'+" /> | 134 | <RegExpr context="#pop" attribute="Operator" String="'+" /> | ||
133 | </context> | 135 | </context> | ||
134 | 136 | | |||
135 | </contexts> | 137 | </contexts> | ||
136 | 138 | | |||
137 | <itemDatas> | 139 | <itemDatas> | ||
138 | <itemData name="Normal Text" defStyleNum="dsNormal" /> | 140 | <itemData name="Normal Text" defStyleNum="dsNormal" /> | ||
139 | <itemData name="Variable" defStyleNum="dsNormal" /> | 141 | <itemData name="Variable" defStyleNum="dsVariable" /> | ||
140 | <itemData name="Operator" defStyleNum="dsNormal"/> | 142 | <itemData name="Operator" defStyleNum="dsOperator"/> | ||
141 | <itemData name="Number" defStyleNum="dsFloat" /> | 143 | <itemData name="Number" defStyleNum="dsFloat" /> | ||
142 | <itemData name="Delimiter" defStyleNum="dsNormal" /> | 144 | <itemData name="Delimiter" defStyleNum="dsNormal" /> | ||
143 | <itemData name="String" defStyleNum="dsString" color="#b20000"/> | 145 | <itemData name="CharVector" defStyleNum="dsSpecialString" /> | ||
144 | <itemData name="System" defStyleNum="dsBaseN" color="#b28c00"/> | 146 | <itemData name="String" defStyleNum="dsString" /> | ||
145 | <itemData name="Incomplete String" defStyleNum="dsChar" color="#a020f0"/> | 147 | <itemData name="System" defStyleNum="dsBaseN" /> | ||
146 | <itemData name="Keyword" defStyleNum="dsNormal" color="#0000ff"/> | 148 | <itemData name="Incomplete CharVector" defStyleNum="dsError" /> | ||
147 | <itemData name="Comment" defStyleNum="dsComment" color="#009900"/> | 149 | <itemData name="Incomplete String" defStyleNum="dsError" /> | ||
150 | <itemData name="Keyword" defStyleNum="dsKeyword" /> | ||||
151 | <itemData name="Comment" defStyleNum="dsComment" /> | ||||
148 | </itemDatas> | 152 | </itemDatas> | ||
149 | <!-- MATLAB 6.5 default color scheme | | |||
150 | keywords #0000ff | | |||
151 | comments #228b22 | | |||
152 | strings #b20000 | | |||
153 | unterminated strings #a020f0 | | |||
154 | system commands #b28c00 | | |||
155 | errors #ff0000 | | |||
156 | all others #000000 | | |||
157 | --> | | |||
158 | 153 | | |||
159 | </highlighting> | 154 | </highlighting> | ||
160 | 155 | | |||
161 | <general> | 156 | <general> | ||
162 | <comments> | 157 | <comments> | ||
163 | <comment name="singleLine" start="% " /> | 158 | <comment name="singleLine" start="% " /> | ||
164 | </comments> | 159 | </comments> | ||
165 | <keywords casesensitive="1" weakDeliminator=""/> | 160 | <keywords casesensitive="1" weakDeliminator=""/> | ||
166 | </general> | 161 | </general> | ||
167 | 162 | | |||
168 | </language> | 163 | </language> | ||
169 | <!-- | | |||
170 | %%===================================================== | | |||
171 | % MATLAB test code for Kate/Kwrite syntax highlighting | | |||
172 | %%===================================================== | | |||
173 | | ||||
174 | % Numbers _____________________________________________ | | |||
175 | 5, 5.5, .1, 0.1, 0.4e5, 1.2e-5, 5i, 5.3i, 6j, .345+3i | | |||
176 | 5', 5.5', .1', 0.1', 0.4e5', 1.2e-5', 5i', 5.3i', 6j', .345+3i' | | |||
177 | | ||||
178 | % Operators ___________________________________________ | | |||
179 | % relational operators | | |||
180 | 'asdf'~=4, c<=4, d>=4, a<b, a>b, a==b, b||c, b&&c | | |||
181 | % elementwise arithmetic operators | | |||
182 | a.^b, a.*b a./b, 1:4:5 | | |||
183 | % single-character binary arithmetic | | |||
184 | a+3, a-3, a*2, a^3, a/3, a\3, a|b, a&b | | |||
185 | % unary operators | | |||
186 | a = ~g; g = @sfdgdsf(sdfsd,345); g.' + 1i.' - ('asdf').' | | |||
187 | % separators and delimiter | | |||
188 | (asd),[sadf];{asdf},;;,;;;() | | |||
189 | % continuation | | |||
190 | a = 1+ ... | | |||
191 | 2; | | |||
192 | | ||||
193 | % Strings and adjoint _________________________________ | | |||
194 | % incomplete strings | | |||
195 | 'string | | |||
196 | 'str'' | | |||
197 | 'str''ing | | |||
198 | % complete strings | | |||
199 | 'string' % simple string | | |||
200 | '''' % string containing ' | | |||
201 | 'str''ing' % one string containing ' | | |||
202 | 'string' 'string' % two strings | | |||
203 | 'asdf' 'asdf''' variable % two strings and a variable | | |||
204 | 'asdf''asdf'' fsgdfg' + (asdf)' - 'asdf'.' + []''''.';'' | | |||
205 | 'sadf'.' % string transpose | | |||
206 | % adjoint | | |||
207 | {'asdf'}' + 1 | | |||
208 | ('asdf')' + 1 | | |||
209 | ['asdf']' + 1 | | |||
210 | '' var''' % empty string, var with >1 adjoints | | |||
211 | [5]'*{5}'*('asd')'.'+(5)'*6'*asdf'*asdf'.' % many adjoints | | |||
212 | A'*B + 1 % adjoint | | |||
213 | A.'*B + 1 % transpose | | |||
214 | A.'.'*B + 1 % double transpose | | |||
215 | A'.' + 1 % adjoint, then transpose | | |||
216 | A.'' % transpose, then adjoint | | |||
217 | | ||||
218 | % System command ______________________________________ | | |||
219 | !hostname | | |||
220 | !cp * /tmp | | |||
221 | | ||||
222 | % Reserved keywords ___________________________________ | | |||
223 | function, persistent, global | | |||
224 | switch, case, otherwise | | |||
225 | if, else, elseif | | |||
226 | try, catch | | |||
227 | for, while, break, continue | | |||
228 | end, return | | |||
229 | function, FUNCTION, Function % case sensitive! | | |||
230 | --> | |