PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.2
Code Block Pro – Beautiful Syntax Highlighting v1.27.2
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / matlab.tmLanguage.json

matlab.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.27.2, at build/shiki/languages/matlab.tmLanguage.json

1,131 lines 36.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "fileTypes": ["m"],
3 "keyEquivalent": "^~M",
4 "name": "matlab",
5 "patterns": [
6 {
7 "comment": "This and #all_after_command_dual are split out so #command_dual can be excluded in things like (), {}, []",
8 "include": "#all_before_command_dual"
9 },
10 {
11 "include": "#command_dual"
12 },
13 {
14 "include": "#all_after_command_dual"
15 }
16 ],
17 "repository": {
18 "all_before_command_dual": {
19 "patterns": [
20 {
21 "include": "#classdef"
22 },
23 {
24 "include": "#function"
25 },
26 {
27 "include": "#blocks"
28 },
29 {
30 "include": "#control_statements"
31 },
32 {
33 "include": "#global_persistent"
34 },
35 {
36 "include": "#parens"
37 },
38 {
39 "include": "#square_brackets"
40 },
41 {
42 "include": "#indexing_curly_brackets"
43 },
44 {
45 "include": "#curly_brackets"
46 }
47 ]
48 },
49 "all_after_command_dual": {
50 "patterns": [
51 {
52 "include": "#string"
53 },
54 {
55 "include": "#line_continuation"
56 },
57 {
58 "include": "#comments"
59 },
60 {
61 "include": "#conjugate_transpose"
62 },
63 {
64 "include": "#transpose"
65 },
66 {
67 "include": "#constants"
68 },
69 {
70 "include": "#variables"
71 },
72 {
73 "include": "#numbers"
74 },
75 {
76 "include": "#operators"
77 }
78 ]
79 },
80 "blocks": {
81 "patterns": [
82 {
83 "begin": "\\s*(?:^|[\\s,;])(for)\\b",
84 "beginCaptures": {
85 "1": {
86 "name": "keyword.control.for.matlab"
87 }
88 },
89 "end": "\\s*(?:^|[\\s,;])(end)\\b",
90 "endCaptures": {
91 "1": {
92 "name": "keyword.control.end.for.matlab"
93 }
94 },
95 "name": "meta.for.matlab",
96 "patterns": [
97 {
98 "include": "$self"
99 }
100 ]
101 },
102 {
103 "begin": "\\s*(?:^|[\\s,;])(if)\\b",
104 "beginCaptures": {
105 "1": {
106 "name": "keyword.control.if.matlab"
107 }
108 },
109 "end": "\\s*(?:^|[\\s,;])(end)\\b",
110 "endCaptures": {
111 "1": {
112 "name": "keyword.control.end.if.matlab"
113 },
114 "2": {
115 "patterns": [
116 {
117 "include": "$self"
118 }
119 ]
120 }
121 },
122 "name": "meta.if.matlab",
123 "patterns": [
124 {
125 "captures": {
126 "2": {
127 "name": "keyword.control.elseif.matlab"
128 },
129 "3": {
130 "patterns": [
131 {
132 "include": "$self"
133 }
134 ]
135 }
136 },
137 "end": "^",
138 "match": "(\\s*)(?:^|[\\s,;])(elseif)\\b(.*)$\\n?",
139 "name": "meta.elseif.matlab"
140 },
141 {
142 "captures": {
143 "2": {
144 "name": "keyword.control.else.matlab"
145 },
146 "3": {
147 "patterns": [
148 {
149 "include": "$self"
150 }
151 ]
152 }
153 },
154 "end": "^",
155 "match": "(\\s*)(?:^|[\\s,;])(else)\\b(.*)?$\\n?",
156 "name": "meta.else.matlab"
157 },
158 {
159 "include": "$self"
160 }
161 ]
162 },
163 {
164 "begin": "\\s*(?:^|[\\s,;])(parfor)\\b",
165 "beginCaptures": {
166 "1": {
167 "name": "keyword.control.for.matlab"
168 }
169 },
170 "end": "\\s*(?:^|[\\s,;])(end)\\b",
171 "endCaptures": {
172 "1": {
173 "name": "keyword.control.end.for.matlab"
174 }
175 },
176 "name": "meta.parfor.matlab",
177 "patterns": [
178 {
179 "begin": "\\G(?!$)",
180 "end": "$\\n?",
181 "name": "meta.parfor-quantity.matlab",
182 "patterns": [
183 {
184 "include": "$self"
185 }
186 ]
187 },
188 {
189 "include": "$self"
190 }
191 ]
192 },
193 {
194 "begin": "\\s*(?:^|[\\s,;])(spmd)\\b",
195 "beginCaptures": {
196 "1": {
197 "name": "keyword.control.spmd.matlab"
198 }
199 },
200 "end": "\\s*(?:^|[\\s,;])(end)\\b",
201 "endCaptures": {
202 "1": {
203 "name": "keyword.control.end.spmd.matlab"
204 }
205 },
206 "name": "meta.spmd.matlab",
207 "patterns": [
208 {
209 "begin": "\\G(?!$)",
210 "end": "$\\n?",
211 "name": "meta.spmd-statement.matlab",
212 "patterns": [
213 {
214 "include": "$self"
215 }
216 ]
217 },
218 {
219 "include": "$self"
220 }
221 ]
222 },
223 {
224 "begin": "\\s*(?:^|[\\s,;])(switch)\\b",
225 "beginCaptures": {
226 "1": {
227 "name": "keyword.control.switch.matlab"
228 }
229 },
230 "end": "\\s*(?:^|[\\s,;])(end)\\b",
231 "endCaptures": {
232 "1": {
233 "name": "keyword.control.end.switch.matlab"
234 }
235 },
236 "name": "meta.switch.matlab",
237 "patterns": [
238 {
239 "captures": {
240 "2": {
241 "name": "keyword.control.case.matlab"
242 },
243 "3": {
244 "patterns": [
245 {
246 "include": "$self"
247 }
248 ]
249 }
250 },
251 "end": "^",
252 "match": "(\\s*)(?:^|[\\s,;])(case)\\b(.*)$\\n?",
253 "name": "meta.case.matlab"
254 },
255 {
256 "captures": {
257 "2": {
258 "name": "keyword.control.otherwise.matlab"
259 },
260 "3": {
261 "patterns": [
262 {
263 "include": "$self"
264 }
265 ]
266 }
267 },
268 "end": "^",
269 "match": "(\\s*)(?:^|[\\s,;])(otherwise)\\b(.*)?$\\n?",
270 "name": "meta.otherwise.matlab"
271 },
272 {
273 "include": "$self"
274 }
275 ]
276 },
277 {
278 "begin": "\\s*(?:^|[\\s,;])(try)\\b",
279 "beginCaptures": {
280 "1": {
281 "name": "keyword.control.try.matlab"
282 }
283 },
284 "end": "\\s*(?:^|[\\s,;])(end)\\b",
285 "endCaptures": {
286 "1": {
287 "name": "keyword.control.end.try.matlab"
288 }
289 },
290 "name": "meta.try.matlab",
291 "patterns": [
292 {
293 "captures": {
294 "2": {
295 "name": "keyword.control.catch.matlab"
296 },
297 "3": {
298 "patterns": [
299 {
300 "include": "$self"
301 }
302 ]
303 }
304 },
305 "end": "^",
306 "match": "(\\s*)(?:^|[\\s,;])(catch)\\b(.*)?$\\n?",
307 "name": "meta.catch.matlab"
308 },
309 {
310 "include": "$self"
311 }
312 ]
313 },
314 {
315 "begin": "\\s*(?:^|[\\s,;])(while)\\b",
316 "beginCaptures": {
317 "1": {
318 "name": "keyword.control.while.matlab"
319 }
320 },
321 "end": "\\s*(?:^|[\\s,;])(end)\\b",
322 "endCaptures": {
323 "1": {
324 "name": "keyword.control.end.while.matlab"
325 }
326 },
327 "name": "meta.while.matlab",
328 "patterns": [
329 {
330 "include": "$self"
331 }
332 ]
333 }
334 ]
335 },
336 "classdef": {
337 "patterns": [
338 {
339 "begin": "(?x)\n\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t(classdef)\n\t\t\t\t\t\t\t\\b\\s*\n\t\t\t\t\t\t\t(.*)\n\t\t\t\t\t",
340 "beginCaptures": {
341 "2": {
342 "name": "storage.type.class.matlab"
343 },
344 "3": {
345 "patterns": [
346 {
347 "match": "(?x)\n\t\t\t\t\t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\t \\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t([a-zA-Z][a-zA-Z0-9_]*)\t\t\t# Class name\n\t\t\t\t\t\t\t\t\t\t\t(?:\t\t\t\t\t\t\t\t# Optional inheritance\n\t\t\t\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t\t\t\t(<)\n\t\t\t\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t\t\t\t([^%]*)\n\t\t\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\\s*($|(?=(%|...)).*)\n\t\t\t\t\t\t\t\t\t",
348 "captures": {
349 "1": {
350 "patterns": [
351 {
352 "match": "[a-zA-Z][a-zA-Z0-9_]*",
353 "name": "variable.parameter.class.matlab"
354 },
355 {
356 "begin": "=\\s*",
357 "end": ",|(?=\\))",
358 "patterns": [
359 {
360 "match": "true|false",
361 "name": "constant.language.boolean.matlab"
362 },
363 {
364 "include": "#string"
365 }
366 ]
367 }
368 ]
369 },
370 "2": {
371 "name": "meta.class-declaration.matlab"
372 },
373 "3": {
374 "name": "entity.name.section.class.matlab"
375 },
376 "4": {
377 "name": "keyword.operator.other.matlab"
378 },
379 "5": {
380 "patterns": [
381 {
382 "match": "[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*",
383 "name": "entity.other.inherited-class.matlab"
384 },
385 {
386 "match": "&",
387 "name": "keyword.operator.other.matlab"
388 }
389 ]
390 },
391 "6": {
392 "patterns": [
393 {
394 "include": "$self"
395 }
396 ]
397 }
398 }
399 }
400 ]
401 }
402 },
403 "end": "\\s*(?:^|[\\s,;])(end)\\b",
404 "endCaptures": {
405 "1": {
406 "name": "keyword.control.end.class.matlab"
407 }
408 },
409 "name": "meta.class.matlab",
410 "patterns": [
411 {
412 "begin": "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t\t\t(properties)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\t\t\t\t\t\t",
413 "beginCaptures": {
414 "2": {
415 "name": "keyword.control.properties.matlab"
416 },
417 "3": {
418 "patterns": [
419 {
420 "match": "[a-zA-Z][a-zA-Z0-9_]*",
421 "name": "variable.parameter.properties.matlab"
422 },
423 {
424 "begin": "=\\s*",
425 "end": ",|(?=\\))",
426 "patterns": [
427 {
428 "match": "true|false",
429 "name": "constant.language.boolean.matlab"
430 },
431 {
432 "match": "public|protected|private",
433 "name": "constant.language.access.matlab"
434 }
435 ]
436 }
437 ]
438 }
439 },
440 "end": "\\s*(?:^|[\\s,;])(end)\\b",
441 "endCaptures": {
442 "1": {
443 "name": "keyword.control.end.properties.matlab"
444 }
445 },
446 "name": "meta.properties.matlab",
447 "patterns": [
448 {
449 "include": "#validators"
450 },
451 {
452 "include": "$self"
453 }
454 ]
455 },
456 {
457 "begin": "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t\t\t(methods)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\t\t\t\t\t\t",
458 "beginCaptures": {
459 "2": {
460 "name": "keyword.control.methods.matlab"
461 },
462 "3": {
463 "patterns": [
464 {
465 "match": "[a-zA-Z][a-zA-Z0-9_]*",
466 "name": "variable.parameter.methods.matlab"
467 },
468 {
469 "begin": "=\\s*",
470 "end": ",|(?=\\))",
471 "patterns": [
472 {
473 "match": "true|false",
474 "name": "constant.language.boolean.matlab"
475 },
476 {
477 "match": "public|protected|private",
478 "name": "constant.language.access.matlab"
479 }
480 ]
481 }
482 ]
483 }
484 },
485 "end": "\\s*(?:^|[\\s,;])(end)\\b",
486 "endCaptures": {
487 "1": {
488 "name": "keyword.control.end.methods.matlab"
489 }
490 },
491 "name": "meta.methods.matlab",
492 "patterns": [
493 {
494 "include": "$self"
495 }
496 ]
497 },
498 {
499 "begin": "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t\t\t(events)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\t\t\t\t\t\t",
500 "beginCaptures": {
501 "2": {
502 "name": "keyword.control.events.matlab"
503 },
504 "3": {
505 "patterns": [
506 {
507 "match": "[a-zA-Z][a-zA-Z0-9_]*",
508 "name": "variable.parameter.events.matlab"
509 },
510 {
511 "begin": "=\\s*",
512 "end": ",|(?=\\))",
513 "patterns": [
514 {
515 "match": "true|false",
516 "name": "constant.language.boolean.matlab"
517 },
518 {
519 "match": "public|protected|private",
520 "name": "constant.language.access.matlab"
521 }
522 ]
523 }
524 ]
525 }
526 },
527 "end": "\\s*(?:^|[\\s,;])(end)\\b",
528 "endCaptures": {
529 "1": {
530 "name": "keyword.control.end.events.matlab"
531 }
532 },
533 "name": "meta.events.matlab",
534 "patterns": [
535 {
536 "include": "$self"
537 }
538 ]
539 },
540 {
541 "begin": "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t\t\t(enumeration)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\t\t\t\t\t\t",
542 "beginCaptures": {
543 "2": {
544 "name": "keyword.control.enumeration.matlab"
545 }
546 },
547 "end": "\\s*(?:^|[\\s,;])(end)\\b",
548 "endCaptures": {
549 "1": {
550 "name": "keyword.control.end.enumeration.matlab"
551 }
552 },
553 "name": "meta.enumeration.matlab",
554 "patterns": [
555 {
556 "include": "$self"
557 }
558 ]
559 },
560 {
561 "include": "$self"
562 }
563 ]
564 }
565 ]
566 },
567 "command_dual": {
568 "captures": {
569 "1": {
570 "name": "string.interpolated.matlab"
571 },
572 "2": {
573 "name": "variable.other.command.matlab"
574 },
575 "28": {
576 "name": "comment.line.percentage.matlab"
577 }
578 },
579 "comment": " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18 19 20 21 22 23 24 25 26 27 28",
580 "match": "^\\s*((?# A> )([b-df-hk-moq-zA-HJ-MO-Z]\\w*|a|an|a([A-Za-mo-z0-9_]\\w*|n[A-Za-rt-z0-9_]\\w*|ns\\w+)|e|ep|e([A-Za-oq-z0-9_]\\w*|p[A-Za-rt-z0-9_]\\w*|ps\\w+)|in|i([A-Za-mo-z0-9_]\\w*|n[A-Za-eg-z0-9_]\\w*|nf\\w+)|I|In|I([A-Za-mo-z0-9_]\\w*|n[A-Za-eg-z0-9_]\\w*|nf\\w+)|j\\w+|N|Na|N([A-Zb-z0-9_]\\w*|a[A-MO-Za-z0-9_]\\w*|aN\\w+)|n|na|nar|narg|nargi|nargo|nargou|n([A-Zb-z0-9_]\\w*|a([A-Za-mo-qs-z0-9_]\\w*|n\\w+|r([A-Za-fh-z0-9_]\\w*|g([A-Za-hj-nq-z0-9_]\\w*|i([A-Za-mo-z0-9_]\\w*|n\\w+)|o([A-Za-tv-z0-9_]\\w*|u([A-Za-su-z]\\w*|t\\w+))))))|p|p[A-Za-hj-z0-9_]\\w*|pi\\w+)(?# <A )\\s+(((?# B> )([^\\s;,%()=.{&|~<>:+\\-*/\\\\@^'\"]|(?=')|(?=\"))(?# <B )|(?# C> )(\\.\\^|\\.\\*|\\./|\\.\\\\|\\.'|\\.\\(|&&|==|\\|\\||&(?=[^&])|\\|(?=[^\\|])|~=|<=|>=|~(?!=)|<(?!=)|>(?!=)|:|\\+|-|\\*|/|\\\\|@|\\^)(?# <C )(?# D> )([^\\s]|\\s*(?=%)|\\s+$|\\s+(,|;|\\)|}|\\]|&|\\||<|>|=|:|\\*|/|\\\\|\\^|@|(\\.[^\\d.]|\\.\\.[^.])))(?# <D )|(?# E> )(\\.[^^*/\\\\'(\\sA-Za-z])(?# <E ))(?# F> )([^%]|'[^']*'|\"[^\"]*\")*(?# <F )|(?# X> )(\\.(?=\\s)|\\.[A-Za-z]|(?={))(?# <X )(?# Y> )([^(=\\'\"%]|==|'[^']*'|\"[^\"]*\"|\\(|\\([^)%]*\\)|\\[|\\[[^\\]%]*\\]|{|{[^}%]*})*(\\.\\.\\.[^%]*)?((?=%)|$)(?# <Y )))(%.*)?$"
581 },
582 "comment_block": {
583 "begin": "(^[\\s]*)%\\{[^\\n\\S]*+\\n",
584 "beginCaptures": {
585 "1": {
586 "name": "punctuation.definition.comment.matlab"
587 }
588 },
589 "end": "^[\\s]*%\\}[^\\n\\S]*+(?:\\n|$)",
590 "name": "comment.block.percentage.matlab",
591 "patterns": [
592 {
593 "include": "#comment_block"
594 },
595 {
596 "match": "^[^\\n]*\\n"
597 }
598 ]
599 },
600 "comments": {
601 "patterns": [
602 {
603 "begin": "(^[ \\t]+)?(?=%%\\s)",
604 "beginCaptures": {
605 "1": {
606 "name": "punctuation.whitespace.comment.leading.matlab"
607 }
608 },
609 "end": "(?!\\G)",
610 "patterns": [
611 {
612 "begin": "%%",
613 "beginCaptures": {
614 "0": {
615 "name": "punctuation.definition.comment.matlab"
616 }
617 },
618 "end": "\\n",
619 "name": "comment.line.double-percentage.matlab",
620 "patterns": [
621 {
622 "begin": "\\G[^\\S\\n]*(?![\\n\\s])",
623 "contentName": "meta.cell.matlab",
624 "end": "(?=\\n)"
625 }
626 ]
627 }
628 ]
629 },
630 {
631 "include": "#comment_block"
632 },
633 {
634 "begin": "(^[ \\t]+)?(?=%)",
635 "beginCaptures": {
636 "1": {
637 "name": "punctuation.whitespace.comment.leading.matlab"
638 }
639 },
640 "end": "(?!\\G)",
641 "patterns": [
642 {
643 "begin": "%",
644 "beginCaptures": {
645 "0": {
646 "name": "punctuation.definition.comment.matlab"
647 }
648 },
649 "end": "\\n",
650 "name": "comment.line.percentage.matlab"
651 }
652 ]
653 }
654 ]
655 },
656 "control_statements": {
657 "captures": {
658 "1": {
659 "name": "keyword.control.matlab"
660 }
661 },
662 "match": "\\s*(?:^|[\\s,;])(break|continue|return)\\b",
663 "name": "meta.control.matlab"
664 },
665 "function": {
666 "patterns": [
667 {
668 "begin": "(?x)\n\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t(function)\n\t\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t\t(?:\t\t\t\t\t\t\t\t\t\t\t\t\t# Optional\n\t\t\t\t\t\t\t\t(?:\n\t\t\t\t\t\t\t\t\t(\\[) ([^\\]]*) (\\])\n\t\t\t\t\t\t\t\t | ([a-zA-Z][a-zA-Z0-9_]*)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\\s* = \\s*\n\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t([a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*)\t# Function name\n\t\t\t\t\t\t\t\\s*\t\t\t\t\t\t\t\t\t\t\t\t\t# Trailing space\n\t\t\t\t\t\t",
669 "beginCaptures": {
670 "2": {
671 "name": "storage.type.function.matlab"
672 },
673 "3": {
674 "name": "punctuation.definition.arguments.begin.matlab"
675 },
676 "4": {
677 "patterns": [
678 {
679 "match": "\\w+",
680 "name": "variable.parameter.output.matlab"
681 }
682 ]
683 },
684 "5": {
685 "name": "punctuation.definition.arguments.end.matlab"
686 },
687 "6": {
688 "name": "variable.parameter.output.function.matlab"
689 },
690 "7": {
691 "name": "entity.name.function.matlab"
692 }
693 },
694 "end": "\\s*(?:^|[\\s,;])(end)\\b(\\s*\\n)?",
695 "endCaptures": {
696 "1": {
697 "name": "keyword.control.end.function.matlab"
698 }
699 },
700 "name": "meta.function.matlab",
701 "patterns": [
702 {
703 "begin": "\\G\\(",
704 "end": "\\)",
705 "name": "meta.arguments.function.matlab",
706 "patterns": [
707 {
708 "include": "#line_continuation"
709 },
710 {
711 "match": "\\w+",
712 "name": "variable.parameter.input.matlab"
713 }
714 ]
715 },
716 {
717 "begin": "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\t\t\t\t\t\t\t\t\t(arguments)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\t\t\t\t\t\t",
718 "beginCaptures": {
719 "2": {
720 "name": "keyword.control.arguments.matlab"
721 },
722 "3": {
723 "patterns": [
724 {
725 "match": "[a-zA-Z][a-zA-Z0-9_]*",
726 "name": "variable.parameter.arguments.matlab"
727 }
728 ]
729 }
730 },
731 "end": "\\s*(?:^|[\\s,;])(end)\\b",
732 "endCaptures": {
733 "1": {
734 "name": "keyword.control.end.arguments.matlab"
735 }
736 },
737 "name": "meta.arguments.matlab",
738 "patterns": [
739 {
740 "include": "#validators"
741 },
742 {
743 "include": "$self"
744 }
745 ]
746 },
747 {
748 "include": "$self"
749 }
750 ]
751 }
752 ]
753 },
754 "global_persistent": {
755 "captures": {
756 "1": {
757 "name": "keyword.control.globalpersistent.matlab"
758 }
759 },
760 "match": "^\\s*(global|persistent)\\b",
761 "name": "meta.globalpersistent.matlab"
762 },
763 "parens": {
764 "begin": "\\(",
765 "end": "(\\)|(?<!\\.\\.\\.).\\n)",
766 "comment": "We don't include $self here to avoid matching command syntax inside (), [], {}",
767 "patterns": [
768 {
769 "include": "#end_in_parens"
770 },
771 {
772 "include": "#all_before_command_dual"
773 },
774 {
775 "include": "#all_after_command_dual"
776 },
777 {
778 "comment": "These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written",
779 "include": "#block_keywords"
780 }
781 ]
782 },
783 "square_brackets": {
784 "begin": "\\[",
785 "end": "\\]",
786 "comment": "We don't include $self here to avoid matching command syntax inside (), [], {}",
787 "patterns": [
788 {
789 "include": "#all_before_command_dual"
790 },
791 {
792 "include": "#all_after_command_dual"
793 },
794 {
795 "comment": "These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written",
796 "include": "#block_keywords"
797 }
798 ]
799 },
800 "curly_brackets": {
801 "begin": "\\{",
802 "end": "\\}",
803 "comment": "We don't include $self here to avoid matching command syntax inside (), [], {}",
804 "patterns": [
805 {
806 "include": "#end_in_parens"
807 },
808 {
809 "include": "#all_before_command_dual"
810 },
811 {
812 "include": "#all_after_command_dual"
813 },
814 {
815 "include": "#end_in_parens"
816 },
817 {
818 "comment": "These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written",
819 "include": "#block_keywords"
820 }
821 ]
822 },
823 "indexing_curly_brackets": {
824 "Comment": "Match identifier{idx, idx, } and stop at newline without ... This helps with partially written code like x{idx ",
825 "begin": "([a-zA-Z][a-zA-Z0-9_\\.]*\\s*)\\{",
826 "beginCaptures": {
827 "1": {
828 "patterns": [
829 {
830 "include": "$self"
831 }
832 ]
833 }
834 },
835 "end": "(\\}|(?<!\\.\\.\\.).\\n)",
836 "comment": "We don't include $self here to avoid matching command syntax inside (), [], {}",
837 "patterns": [
838 {
839 "include": "#end_in_parens"
840 },
841 {
842 "include": "#all_before_command_dual"
843 },
844 {
845 "include": "#all_after_command_dual"
846 },
847 {
848 "include": "#end_in_parens"
849 },
850 {
851 "comment": "These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written",
852 "include": "#block_keywords"
853 }
854 ]
855 },
856 "line_continuation": {
857 "captures": {
858 "1": {
859 "name": "keyword.operator.symbols.matlab"
860 },
861 "2": {
862 "name": "comment.line.continuation.matlab"
863 }
864 },
865 "comment": "Line continuations",
866 "match": "(\\.\\.\\.)(.*)$",
867 "name": "meta.linecontinuation.matlab"
868 },
869 "string": {
870 "patterns": [
871 {
872 "captures": {
873 "1": {
874 "name": "string.interpolated.matlab"
875 },
876 "2": {
877 "name": "punctuation.definition.string.begin.matlab"
878 }
879 },
880 "comment": "Shell command",
881 "match": "^\\s*((!).*$\\n?)"
882 },
883 {
884 "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)'",
885 "beginCaptures": {
886 "0": {
887 "name": "punctuation.definition.string.begin.matlab"
888 }
889 },
890 "comment": "Character vector literal (single-quoted)",
891 "end": "'(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\s|;|:|,))",
892 "endCaptures": {
893 "0": {
894 "name": "punctuation.definition.string.end.matlab"
895 }
896 },
897 "name": "string.quoted.single.matlab",
898 "patterns": [
899 {
900 "match": "''",
901 "name": "constant.character.escape.matlab"
902 },
903 {
904 "match": "'(?=.)",
905 "name": "invalid.illegal.unescaped-quote.matlab"
906 },
907 {
908 "comment": "Operator symbols",
909 "match": "((\\%([\\+\\-0]?\\d{0,3}(\\.\\d{1,3})?)(c|d|e|E|f|g|G|s|((b|t)?(o|u|x|X))))|\\%\\%|\\\\(b|f|n|r|t|\\\\))",
910 "name": "constant.character.escape.matlab"
911 }
912 ]
913 },
914 {
915 "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)\"",
916 "beginCaptures": {
917 "0": {
918 "name": "punctuation.definition.string.begin.matlab"
919 }
920 },
921 "comment": "String literal (double-quoted)",
922 "end": "\"(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\||\\s|;|:|,))",
923 "endCaptures": {
924 "0": {
925 "name": "punctuation.definition.string.end.matlab"
926 }
927 },
928 "name": "string.quoted.double.matlab",
929 "patterns": [
930 {
931 "match": "\"\"",
932 "name": "constant.character.escape.matlab"
933 },
934 {
935 "match": "\"(?=.)",
936 "name": "invalid.illegal.unescaped-quote.matlab"
937 }
938 ]
939 }
940 ]
941 },
942 "conjugate_transpose": {
943 "match": "((?<=[^\\s])|(?<=\\])|(?<=\\))|(?<=\\}))'",
944 "name": "keyword.operator.transpose.matlab"
945 },
946 "transpose": {
947 "match": "\\.'",
948 "name": "keyword.operator.transpose.matlab"
949 },
950 "constants": {
951 "comment": "MATLAB Constants",
952 "match": "(?<!\\.)\\b(eps|false|Inf|inf|intmax|intmin|namelengthmax|NaN|nan|on|off|realmax|realmin|true|pi)\\b",
953 "name": "constant.language.matlab"
954 },
955 "variables": {
956 "comment": "MATLAB variables",
957 "match": "(?<!\\.)\\b(nargin|nargout|varargin|varargout)\\b",
958 "name": "variable.other.function.matlab"
959 },
960 "end_in_parens": {
961 "comment": "end as operator symbol",
962 "match": "\\bend\\b",
963 "name": "keyword.operator.symbols.matlab"
964 },
965 "numbers": {
966 "comment": "Valid numbers: 1, .1, 1.1, .1e1, 1.1e1, 1e1, 1i, 1j, 1e2j",
967 "match": "(?<=[\\s\\-\\+\\*\\/\\\\=:\\[\\(\\{,]|^)\\d*\\.?\\d+([eE][+-]?\\d)?([0-9&&[^\\.]])*(i|j)?\\b",
968 "name": "constant.numeric.matlab"
969 },
970 "operators": {
971 "comment": "Operator symbols",
972 "match": "(?<=\\s)(==|~=|>|>=|<|<=|&|&&|:|\\||\\|\\||\\+|-|\\*|\\.\\*|/|\\./|\\\\|\\.\\\\|\\^|\\.\\^)(?=\\s)",
973 "name": "keyword.operator.symbols.matlab"
974 },
975 "validators": {
976 "comment": "Property and argument validation. Match an identifier allowing . and ?.",
977 "begin": "\\s*[;]?\\s*([a-zA-Z][a-zA-Z0-9_\\.\\?]*)",
978 "end": "([;\\n%=].*)",
979 "endCaptures": {
980 "1": {
981 "patterns": [
982 {
983 "comment": "Match comments",
984 "match": "([%].*)",
985 "captures": {
986 "1": {
987 "patterns": [
988 {
989 "include": "$self"
990 }
991 ]
992 }
993 }
994 },
995 {
996 "comment": "Handle things like arg = val; nextArg",
997 "match": "(=[^;]*)",
998 "captures": {
999 "1": {
1000 "patterns": [
1001 {
1002 "include": "$self"
1003 }
1004 ]
1005 }
1006 }
1007 },
1008 {
1009 "comment": "End of property/argument patterns which start a new property/argument. Look for beginning of identifier after semicolon. Otherwise treat as regular code.",
1010 "match": "([\\n;]\\s*[a-zA-Z].*)",
1011 "captures": {
1012 "1": {
1013 "patterns": [
1014 {
1015 "include": "#validators"
1016 }
1017 ]
1018 }
1019 }
1020 },
1021 {
1022 "include": "$self"
1023 }
1024 ]
1025 }
1026 },
1027 "patterns": [
1028 {
1029 "include": "#line_continuation"
1030 },
1031 {
1032 "comment": "Size declaration",
1033 "match": "\\s*(\\([^\\)]*\\))",
1034 "name": "storage.type.matlab"
1035 },
1036 {
1037 "comment": "Type declaration",
1038 "match": "([a-zA-Z][a-zA-Z0-9_\\.]*)",
1039 "name": "storage.type.matlab"
1040 },
1041 {
1042 "include": "#braced_validator_list"
1043 }
1044 ]
1045 },
1046 "braced_validator_list": {
1047 "comment": "Validator functions. Treated as a recursive group to permit nested brackets, quotes, etc.",
1048 "begin": "\\s*({)\\s*",
1049 "beginCaptures": {
1050 "1": {
1051 "name": "storage.type.matlab"
1052 }
1053 },
1054 "end": "(})",
1055 "endCaptures": {
1056 "1": {
1057 "name": "storage.type.matlab"
1058 }
1059 },
1060 "patterns": [
1061 {
1062 "include": "#braced_validator_list"
1063 },
1064 {
1065 "include": "#validator_strings"
1066 },
1067 {
1068 "include": "#line_continuation"
1069 },
1070 {
1071 "match": "([^{}}'\"\\.]+)",
1072 "captures": {
1073 "1": {
1074 "name": "storage.type.matlab"
1075 }
1076 }
1077 },
1078 {
1079 "match": "\\.",
1080 "name": "storage.type.matlab"
1081 }
1082 ]
1083 },
1084 "validator_strings": {
1085 "comment": "Simplified string patterns nested inside validator functions which don't change scopes of matches.",
1086 "patterns": [
1087 {
1088 "patterns": [
1089 {
1090 "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)'",
1091 "comment": "Character vector literal (single-quoted)",
1092 "end": "'(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\s|;|:|,))",
1093 "name": "storage.type.matlab",
1094 "patterns": [
1095 {
1096 "match": "''"
1097 },
1098 {
1099 "match": "'(?=.)"
1100 },
1101 {
1102 "match": "([^']+)"
1103 }
1104 ]
1105 },
1106 {
1107 "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)\"",
1108 "comment": "String literal (double-quoted)",
1109 "end": "\"(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\||\\s|;|:|,))",
1110 "name": "storage.type.matlab",
1111 "patterns": [
1112 {
1113 "match": "\"\""
1114 },
1115 {
1116 "match": "\"(?=.)"
1117 },
1118 {
1119 "match": "[^\"]+"
1120 }
1121 ]
1122 }
1123 ]
1124 }
1125 ]
1126 }
1127 },
1128 "scopeName": "source.matlab",
1129 "uuid": "48F8858B-72FF-11D9-BFEE-000D93589AF6"
1130 }
1131