From f51553797416029a5a56bfe8a698f8f1b5683203 Mon Sep 17 00:00:00 2001 From: "SNDST00M: M.U.N.I.N" <82655227+4086606@users.noreply.github.com> Date: Fri, 23 Jul 2021 16:16:58 +0100 Subject: [PATCH 1/9] Add `matlab.io.hdf`; undeprecate generic props Also fix function boundaries in lookbehind patterns --- grammars/m.cson | 123 +++++++++++++++++++++++++++--------------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index 04f19f7..c20a26d 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -4,7 +4,7 @@ fileTypes: [ ] keyEquivalent: '^~M' scopeName: 'source.matlab' -uuid: '0448B0AE-F226-4E07-8F42-845D6324B896' +uuid: '0C463768-44FD-4D00-880B-E7F5553D6880' patterns: [ { comment: 'Rules are split into groups so #command_dual can be excluded in things like (), {}, []' @@ -84,7 +84,7 @@ injections: { include: '#readwrite_operations' } ] - 'source.matlab meta.class.matlab meta.arguments.matlab meta.block.validation.matlab': + 'source.matlab meta.class.matlab meta.arguments.matlab meta.block.validation.matlab': patterns: [ { include: '#argument_validation' @@ -465,7 +465,7 @@ repository: ^\\s* # Leading whitespace (classdef) \\s* - + ''' end: '\\s*(?<=^|[\\s,;])(end)\\b' beginCaptures: @@ -542,7 +542,7 @@ repository: { comment: 'Inherited class' name: 'meta.inherited-class.matlab' - begin: '(? Date: Tue, 27 Jul 2021 09:15:46 +0100 Subject: [PATCH 2/9] Fix import module highlighting --- grammars/m.cson | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index c20a26d..e62c365 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -1089,22 +1089,26 @@ repository: import: comment: 'Import statement' name: 'meta.import.matlab' - contentName: 'entity.name.namespace.matlab' - begin: '\\b(import)\\b[^\\S\\n]+(?=\\w)' - beginCaptures: + match: '\\b(import)\\b[^\\S\\n]+([a-zA-Z0-9.]*)(?=;|%|$)' + captures: '1': name: 'keyword.other.import.matlab' - end: '(?=;|\\n|%)' - patterns: [ - { - name: 'punctuation.separator.matlab' - match: '\\.' - } - { - name: 'variable.language.wildcard.matlab' - match: '\\*' - } - ] + '2': + name: 'entity.name.namespace.matlab' + patterns: [ + { + name: 'entity.name.module.matlab' + match: '\\w+' + } + { + name: 'punctuation.separator.matlab' + match: '\\.' + } + { + name: 'variable.language.wildcard.matlab' + match: '\\*' + } + ] indexing_by_expression: comment: 'Index array with expression evaluated to variable name or number' contentName: 'meta.parens.matlab' From bcca568482f8f1139e5eb1bd884ed7f0c93bfb4b Mon Sep 17 00:00:00 2001 From: "SNDST00M: M.U.N.I.N" <82655227+4086606@users.noreply.github.com> Date: Tue, 27 Jul 2021 09:16:53 +0100 Subject: [PATCH 3/9] Make keyword control end tokens consistent --- grammars/m.cson | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index e62c365..37e47dc 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -626,7 +626,7 @@ repository: ] endCaptures: '1': - name: 'keyword.control.properties.end.matlab' + name: 'keyword.control.end.properties.matlab' patterns: [ { include: '#validators' @@ -676,7 +676,7 @@ repository: ] endCaptures: '1': - name: 'keyword.control.methods.end.matlab' + name: 'keyword.control.end.methods.matlab' patterns: [ { include: '$self' @@ -723,7 +723,7 @@ repository: ] endCaptures: '1': - name: 'keyword.control.events.end.matlab' + name: 'keyword.control.end.events.matlab' patterns: [ { name: 'meta.assignment.definition.event.matlab' @@ -752,7 +752,7 @@ repository: name: 'keyword.control.enum.matlab' endCaptures: '1': - name: 'keyword.control.enum.end.matlab' + name: 'keyword.control.end.enum.matlab' patterns: [ { name: 'meta.assignment.definition.enummember.matlab' @@ -1025,7 +1025,7 @@ repository: ] endCaptures: '1': - name: 'keyword.control.arguments.end.matlab' + name: 'keyword.control.end.arguments.matlab' patterns: [ { comment: 'Class property name-value arguments' From e51596a6c615267d5106557858b93a43f2f1609a Mon Sep 17 00:00:00 2001 From: "SNDST00M: M.U.N.I.N" <82655227+4086606@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:36:50 +0100 Subject: [PATCH 4/9] Fix readwrite injection selector --- grammars/m.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/m.cson b/grammars/m.cson index 37e47dc..48d2171 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -78,7 +78,7 @@ injections: { include: '#package_word_operators' } ] - 'source.matlab -(comment, function-call, support, string, interpolation, comment *, function-call *, support *, string *, interpolation *)': + 'source.matlab -(comment, support, string, interpolation, entity.name.function, entity.name.namespace, comment *, support *, string *, interpolation *, entity.name.function *, entity.name.namespace *)': patterns: [ { include: '#readwrite_operations' From 3113a8177ae5ffd945ddd630bc9a8f2252b9c5a0 Mon Sep 17 00:00:00 2001 From: "SNDST00M: M.U.N.I.N" <82655227+4086606@users.noreply.github.com> Date: Thu, 29 Jul 2021 11:58:13 +0100 Subject: [PATCH 5/9] Prevent variables in command duality --- grammars/m.cson | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index 48d2171..3afabd9 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -5765,11 +5765,11 @@ repository: property: comment: 'Class property or enumeration member access' name: 'variable.other.property.matlab' - match: '(?<=\\.)[a-zA-Z][a-zA-Z0-9_]*(?![a-zA-Z0-9_]|(?:\\(|\\{|\\.\\())' + match: '(?<=\\.)[a-zA-Z][a-zA-Z0-9_]*(?![a-zA-Z0-9_]|(?:["\']|\\(|\\{|\\.\\())' readwrite_variable: comment: 'Top-level workspace variable highlighting' name: 'variable.other.readwrite.matlab' - match: '(? Date: Thu, 29 Jul 2021 15:27:21 +0100 Subject: [PATCH 6/9] Respect entity and shell highlighting --- grammars/m.cson | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index 3afabd9..80a40ea 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -18,7 +18,7 @@ patterns: [ } ] injections: { - 'source.matlab -(comment, string, interpolation, comment *, string *, interpolation *)': + 'source.matlab -(comment, string, interpolation, source.shell, comment *, string *, interpolation *, source.shell *)': patterns: [ { include: '#keywords' @@ -54,7 +54,7 @@ injections: { include: '#overload_definition' } ] - 'source.matlab -(comment, string, interpolation, assignment, comment *, string *, interpolation *, assignment *)': + 'source.matlab -(comment, string, interpolation, assignment, source.shell, comment *, string *, interpolation *, assignment *, source.shell *)': patterns: [ { include: '#package_builtin_functions' @@ -78,7 +78,7 @@ injections: { include: '#package_word_operators' } ] - 'source.matlab -(comment, support, string, interpolation, entity.name.function, entity.name.namespace, comment *, support *, string *, interpolation *, entity.name.function *, entity.name.namespace *)': + 'source.matlab -(comment, support, string, interpolation, entity.name, source.shell, comment *, support *, string *, interpolation *, entity.name *, source.shell *)': patterns: [ { include: '#readwrite_operations' From 952b73349ff8c37cf694bfa8f63b74f6bbe37dea Mon Sep 17 00:00:00 2001 From: "SNDST00M: M.U.N.I.N" <82655227+4086606@users.noreply.github.com> Date: Thu, 29 Jul 2021 19:34:20 +0100 Subject: [PATCH 7/9] Fix readwrite variable patterns --- grammars/m.cson | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/grammars/m.cson b/grammars/m.cson index 80a40ea..6625f1f 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -4,7 +4,7 @@ fileTypes: [ ] keyEquivalent: '^~M' scopeName: 'source.matlab' -uuid: '0C463768-44FD-4D00-880B-E7F5553D6880' +uuid: '00727D6C-EF5E-42F1-A155-5EB15931A4C6' patterns: [ { comment: 'Rules are split into groups so #command_dual can be excluded in things like (), {}, []' @@ -5754,22 +5754,32 @@ repository: } ] readwrite_operations: - patterns: [ - { - include: '#property' - } - { - include: '#readwrite_variable' - } - ] + match: '(? Date: Fri, 30 Jul 2021 10:20:29 +0100 Subject: [PATCH 8/9] Undeprecate rm* functions --- grammars/m.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/m.cson b/grammars/m.cson index 6625f1f..d841aa5 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -1690,7 +1690,7 @@ repository: { comment: 'Removed or pre-R2021a functionality' name: 'invalid.deprecated.matlab' - match: '(? Date: Sat, 31 Jul 2021 18:45:25 +0100 Subject: [PATCH 9/9] Allow colon index in cell array index --- grammars/m.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/m.cson b/grammars/m.cson index d841aa5..20ebfe2 100644 --- a/grammars/m.cson +++ b/grammars/m.cson @@ -1461,7 +1461,7 @@ repository: { comment: 'Colon operator for vector creation/indexing' name: 'keyword.operator.vector.colon.matlab' - match: '(?<=[a-zA-Z0-9_\\s(),]|^):(?=[a-zA-Z0-9_\\s(),]|$)' + match: '(?<=[a-zA-Z0-9_\\s(){,]|^):(?=[a-zA-Z0-9_\\s()},]|$)' } { comment: 'Comparative operators'