From b94418a91e09eaaab7f493b680115a75f1eee300 Mon Sep 17 00:00:00 2001 From: larsbrockmann Date: Mon, 9 Nov 2026 17:44:09 +0100 Subject: [PATCH] feat: add MATLAB syntax highlighting support Add the upstream TextMate grammar converted from plist to JSON for TextMateSharp. --- THIRD-PARTY-LICENSES.md | 9 +- src/Models/TextMateHelper.cs | 1 + src/Resources/Grammars/matlab.json | 1131 ++++++++++++++++++++++++++++ 3 files changed, 1140 insertions(+), 1 deletion(-) create mode 100644 src/Resources/Grammars/matlab.json diff --git a/THIRD-PARTY-LICENSES.md b/THIRD-PARTY-LICENSES.md index 4be26e4a12..f58b39362d 100644 --- a/THIRD-PARTY-LICENSES.md +++ b/THIRD-PARTY-LICENSES.md @@ -146,4 +146,11 @@ The project uses the following third-party libraries or assets - **Source**: https://github.com/jtbandes/swift-tmlanguage/blob/main/Swift.tmLanguage.json - **Commit**: abda279b567a0a7f35f81642c1b830f437f718d9 - **License**: MIT License -- **License Link**: https://github.com/jtbandes/swift-tmlanguage/blob/main/LICENSE.md \ No newline at end of file +- **License Link**: https://github.com/jtbandes/swift-tmlanguage/blob/main/LICENSE.md + +### MATLAB + +- **Source**: https://github.com/mathworks/MATLAB-Language-grammar/blob/40d9a0cd3b628f80cdcf948bbe1747a527ed5dd5/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage +- **Commit**: 40d9a0cd3b628f80cdcf948bbe1747a527ed5dd5 +- **License**: BSD 2-Clause License +- **License Link**: https://github.com/mathworks/MATLAB-Language-grammar/blob/40d9a0cd3b628f80cdcf948bbe1747a527ed5dd5/license.txt diff --git a/src/Models/TextMateHelper.cs b/src/Models/TextMateHelper.cs index bdddeb1b54..d669736733 100644 --- a/src/Models/TextMateHelper.cs +++ b/src/Models/TextMateHelper.cs @@ -22,6 +22,7 @@ public static class GrammarUtility private static readonly ExtraGrammar[] s_extraGrammars = [ new ExtraGrammar("source.toml", [".toml"], "toml.json"), + new ExtraGrammar("source.matlab", [".m"], "matlab.json"), new ExtraGrammar("source.kotlin", [".kotlin", ".kt", ".kts"], "kotlin.json"), new ExtraGrammar("source.hx", [".hx"], "haxe.json"), new ExtraGrammar("source.hxml", [".hxml"], "hxml.json"), diff --git a/src/Resources/Grammars/matlab.json b/src/Resources/Grammars/matlab.json new file mode 100644 index 0000000000..fe7543b9fa --- /dev/null +++ b/src/Resources/Grammars/matlab.json @@ -0,0 +1,1131 @@ +{ + "fileTypes": [ + "m" + ], + "keyEquivalent": "^~M", + "name": "MATLAB", + "patterns": [ + { + "comment": "This and #all_after_command_dual are split out so #command_dual can be excluded in things like (), {}, []", + "include": "#all_before_command_dual" + }, + { + "include": "#command_dual" + }, + { + "include": "#all_after_command_dual" + } + ], + "repository": { + "all_before_command_dual": { + "patterns": [ + { + "include": "#classdef" + }, + { + "include": "#function" + }, + { + "include": "#blocks" + }, + { + "include": "#control_statements" + }, + { + "include": "#global_persistent" + }, + { + "include": "#parens" + }, + { + "include": "#square_brackets" + }, + { + "include": "#indexing_curly_brackets" + }, + { + "include": "#curly_brackets" + } + ] + }, + "all_after_command_dual": { + "patterns": [ + { + "include": "#string" + }, + { + "include": "#line_continuation" + }, + { + "include": "#comments" + }, + { + "include": "#conjugate_transpose" + }, + { + "include": "#transpose" + }, + { + "include": "#constants" + }, + { + "include": "#variables" + }, + { + "include": "#numbers" + }, + { + "include": "#operators" + } + ] + }, + "blocks": { + "patterns": [ + { + "begin": "\\s*(?:^|[\\s,;])(for)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.for.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.for.matlab" + } + }, + "name": "meta.for.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(if)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.if.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.if.matlab" + }, + "2": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "name": "meta.if.matlab", + "patterns": [ + { + "captures": { + "2": { + "name": "keyword.control.elseif.matlab" + }, + "3": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "end": "^", + "match": "(\\s*)(?:^|[\\s,;])(elseif)\\b(.*)$\\n?", + "name": "meta.elseif.matlab" + }, + { + "captures": { + "2": { + "name": "keyword.control.else.matlab" + }, + "3": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "end": "^", + "match": "(\\s*)(?:^|[\\s,;])(else)\\b(.*)?$\\n?", + "name": "meta.else.matlab" + }, + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(parfor)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.for.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.for.matlab" + } + }, + "name": "meta.parfor.matlab", + "patterns": [ + { + "begin": "\\G(?!$)", + "end": "$\\n?", + "name": "meta.parfor-quantity.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(spmd)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.spmd.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.spmd.matlab" + } + }, + "name": "meta.spmd.matlab", + "patterns": [ + { + "begin": "\\G(?!$)", + "end": "$\\n?", + "name": "meta.spmd-statement.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(switch)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.switch.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.switch.matlab" + } + }, + "name": "meta.switch.matlab", + "patterns": [ + { + "captures": { + "2": { + "name": "keyword.control.case.matlab" + }, + "3": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "end": "^", + "match": "(\\s*)(?:^|[\\s,;])(case)\\b(.*)$\\n?", + "name": "meta.case.matlab" + }, + { + "captures": { + "2": { + "name": "keyword.control.otherwise.matlab" + }, + "3": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "end": "^", + "match": "(\\s*)(?:^|[\\s,;])(otherwise)\\b(.*)?$\\n?", + "name": "meta.otherwise.matlab" + }, + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(try)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.try.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.try.matlab" + } + }, + "name": "meta.try.matlab", + "patterns": [ + { + "captures": { + "2": { + "name": "keyword.control.catch.matlab" + }, + "3": { + "patterns": [ + { + "include": "$self" + } + ] + } + }, + "end": "^", + "match": "(\\s*)(?:^|[\\s,;])(catch)\\b(.*)?$\\n?", + "name": "meta.catch.matlab" + }, + { + "include": "$self" + } + ] + }, + { + "begin": "\\s*(?:^|[\\s,;])(while)\\b", + "beginCaptures": { + "1": { + "name": "keyword.control.while.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.while.matlab" + } + }, + "name": "meta.while.matlab", + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + "classdef": { + "patterns": [ + { + "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", + "beginCaptures": { + "2": { + "name": "storage.type.class.matlab" + }, + "3": { + "patterns": [ + { + "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", + "captures": { + "1": { + "patterns": [ + { + "match": "[a-zA-Z][a-zA-Z0-9_]*", + "name": "variable.parameter.class.matlab" + }, + { + "begin": "=\\s*", + "end": ",|(?=\\))", + "patterns": [ + { + "match": "true|false", + "name": "constant.language.boolean.matlab" + }, + { + "include": "#string" + } + ] + } + ] + }, + "2": { + "name": "meta.class-declaration.matlab" + }, + "3": { + "name": "entity.name.section.class.matlab" + }, + "4": { + "name": "keyword.operator.other.matlab" + }, + "5": { + "patterns": [ + { + "match": "[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)*", + "name": "entity.other.inherited-class.matlab" + }, + { + "match": "&", + "name": "keyword.operator.other.matlab" + } + ] + }, + "6": { + "patterns": [ + { + "include": "$self" + } + ] + } + } + } + ] + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.class.matlab" + } + }, + "name": "meta.class.matlab", + "patterns": [ + { + "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", + "beginCaptures": { + "2": { + "name": "keyword.control.properties.matlab" + }, + "3": { + "patterns": [ + { + "match": "[a-zA-Z][a-zA-Z0-9_]*", + "name": "variable.parameter.properties.matlab" + }, + { + "begin": "=\\s*", + "end": ",|(?=\\))", + "patterns": [ + { + "match": "true|false", + "name": "constant.language.boolean.matlab" + }, + { + "match": "public|protected|private", + "name": "constant.language.access.matlab" + } + ] + } + ] + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.properties.matlab" + } + }, + "name": "meta.properties.matlab", + "patterns": [ + { + "include": "#validators" + }, + { + "include": "$self" + } + ] + }, + { + "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", + "beginCaptures": { + "2": { + "name": "keyword.control.methods.matlab" + }, + "3": { + "patterns": [ + { + "match": "[a-zA-Z][a-zA-Z0-9_]*", + "name": "variable.parameter.methods.matlab" + }, + { + "begin": "=\\s*", + "end": ",|(?=\\))", + "patterns": [ + { + "match": "true|false", + "name": "constant.language.boolean.matlab" + }, + { + "match": "public|protected|private", + "name": "constant.language.access.matlab" + } + ] + } + ] + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.methods.matlab" + } + }, + "name": "meta.methods.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "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", + "beginCaptures": { + "2": { + "name": "keyword.control.events.matlab" + }, + "3": { + "patterns": [ + { + "match": "[a-zA-Z][a-zA-Z0-9_]*", + "name": "variable.parameter.events.matlab" + }, + { + "begin": "=\\s*", + "end": ",|(?=\\))", + "patterns": [ + { + "match": "true|false", + "name": "constant.language.boolean.matlab" + }, + { + "match": "public|protected|private", + "name": "constant.language.access.matlab" + } + ] + } + ] + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.events.matlab" + } + }, + "name": "meta.events.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "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", + "beginCaptures": { + "2": { + "name": "keyword.control.enumeration.matlab" + } + }, + "end": "\\s*(?:^|[\\s,;])(end)\\b", + "endCaptures": { + "1": { + "name": "keyword.control.end.enumeration.matlab" + } + }, + "name": "meta.enumeration.matlab", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "$self" + } + ] + } + ] + }, + "command_dual": { + "captures": { + "1": { + "name": "string.interpolated.matlab" + }, + "2": { + "name": "variable.other.command.matlab" + }, + "28": { + "name": "comment.line.percentage.matlab" + } + }, + "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", + "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+)(?# )([^\\s;,%()=.{&|~<>:+\\-*/\\\\@^'\"]|(?=')|(?=\"))(?# )(\\.\\^|\\.\\*|\\./|\\.\\\\|\\.'|\\.\\(|&&|==|\\|\\||&(?=[^&])|\\|(?=[^\\|])|~=|<=|>=|~(?!=)|<(?!=)|>(?!=)|:|\\+|-|\\*|/|\\\\|@|\\^)(?# )([^\\s]|\\s*(?=%)|\\s+$|\\s+(,|;|\\)|}|\\]|&|\\||<|>|=|:|\\*|/|\\\\|\\^|@|(\\.[^\\d.]|\\.\\.[^.])))(?# )(\\.[^^*/\\\\'(\\sA-Za-z])(?# )([^%]|'[^']*'|\"[^\"]*\")*(?# )(\\.(?=\\s)|\\.[A-Za-z]|(?={))(?# )([^(=\\'\"%]|==|'[^']*'|\"[^\"]*\"|\\(|\\([^)%]*\\)|\\[|\\[[^\\]%]*\\]|{|{[^}%]*})*(\\.\\.\\.[^%]*)?((?=%)|$)(?# |&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.matlab" + } + }, + "comment": "Character vector literal (single-quoted)", + "end": "'(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\s|;|:|,))", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.matlab" + } + }, + "name": "string.quoted.single.matlab", + "patterns": [ + { + "match": "''", + "name": "constant.character.escape.matlab" + }, + { + "match": "'(?=.)", + "name": "invalid.illegal.unescaped-quote.matlab" + }, + { + "comment": "Operator symbols", + "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|\\\\))", + "name": "constant.character.escape.matlab" + } + ] + }, + { + "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.matlab" + } + }, + "comment": "String literal (double-quoted)", + "end": "\"(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\||\\s|;|:|,))", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.matlab" + } + }, + "name": "string.quoted.double.matlab", + "patterns": [ + { + "match": "\"\"", + "name": "constant.character.escape.matlab" + }, + { + "match": "\"(?=.)", + "name": "invalid.illegal.unescaped-quote.matlab" + } + ] + } + ] + }, + "conjugate_transpose": { + "match": "((?<=[^\\s])|(?<=\\])|(?<=\\))|(?<=\\}))'", + "name": "keyword.operator.transpose.matlab" + }, + "transpose": { + "match": "\\.'", + "name": "keyword.operator.transpose.matlab" + }, + "constants": { + "comment": "MATLAB Constants", + "match": "(?|>=|<|<=|&|&&|:|\\||\\|\\||\\+|-|\\*|\\.\\*|/|\\./|\\\\|\\.\\\\|\\^|\\.\\^)(?=\\s)", + "name": "keyword.operator.symbols.matlab" + }, + "validators": { + "comment": "Property and argument validation. Match an identifier allowing . and ?.", + "begin": "\\s*[;]?\\s*([a-zA-Z][a-zA-Z0-9_\\.\\?]*)", + "end": "([;\\n%=].*)", + "endCaptures": { + "1": { + "patterns": [ + { + "comment": "Match comments", + "match": "([%].*)", + "captures": { + "1": { + "patterns": [ + { + "include": "$self" + } + ] + } + } + }, + { + "comment": "Handle things like arg = val; nextArg", + "match": "(=[^;]*)", + "captures": { + "1": { + "patterns": [ + { + "include": "$self" + } + ] + } + } + }, + { + "comment": "End of property/argument patterns which start a new property/argument. Look for beginning of identifier after semicolon. Otherwise treat as regular code.", + "match": "([\\n;]\\s*[a-zA-Z].*)", + "captures": { + "1": { + "patterns": [ + { + "include": "#validators" + } + ] + } + } + }, + { + "include": "$self" + } + ] + } + }, + "patterns": [ + { + "include": "#line_continuation" + }, + { + "comment": "Size declaration", + "match": "\\s*(\\([^\\)]*\\))", + "name": "storage.type.matlab" + }, + { + "comment": "Type declaration", + "match": "([a-zA-Z][a-zA-Z0-9_\\.]*)", + "name": "storage.type.matlab" + }, + { + "include": "#braced_validator_list" + } + ] + }, + "braced_validator_list": { + "comment": "Validator functions. Treated as a recursive group to permit nested brackets, quotes, etc.", + "begin": "\\s*({)\\s*", + "beginCaptures": { + "1": { + "name": "storage.type.matlab" + } + }, + "end": "(})", + "endCaptures": { + "1": { + "name": "storage.type.matlab" + } + }, + "patterns": [ + { + "include": "#braced_validator_list" + }, + { + "include": "#validator_strings" + }, + { + "include": "#line_continuation" + }, + { + "match": "([^{}}'\"\\.]+)", + "captures": { + "1": { + "name": "storage.type.matlab" + } + } + }, + { + "match": "\\.", + "name": "storage.type.matlab" + } + ] + }, + "validator_strings": { + "comment": "Simplified string patterns nested inside validator functions which don't change scopes of matches.", + "patterns": [ + { + "patterns": [ + { + "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)'", + "comment": "Character vector literal (single-quoted)", + "end": "'(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\s|;|:|,))", + "name": "storage.type.matlab", + "patterns": [ + { + "match": "''" + }, + { + "match": "'(?=.)" + }, + { + "match": "([^']+)" + } + ] + }, + { + "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^))|^)\"", + "comment": "String literal (double-quoted)", + "end": "\"(?=(\\[|\\(|\\{|\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|/|\\\\|\\.|\\^|\\||\\s|;|:|,))", + "name": "storage.type.matlab", + "patterns": [ + { + "match": "\"\"" + }, + { + "match": "\"(?=.)" + }, + { + "match": "[^\"]+" + } + ] + } + ] + } + ] + } + }, + "scopeName": "source.matlab", + "uuid": "48F8858B-72FF-11D9-BFEE-000D93589AF6" +}