branch: externals/matlab-mode
commit 8297734335b8bd18bd041fe85e3fef4aa14c8b78
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: add test for matlab tree-sitter issue 152
---
.../electric_indent_dot_paren_issue152.m | 31 ++++++++++++++++++++++
.../electric_indent_dot_paren_issue152_expected.m | 31 ++++++++++++++++++++++
...ctric_indent_dot_paren_issue152_expected_msgs.m | 31 ++++++++++++++++++++++
3 files changed, 93 insertions(+)
diff --git
a/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152.m
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152.m
new file mode 100644
index 0000000000..968ad688ae
--- /dev/null
+++
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152.m
@@ -0,0 +1,31 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/152
+
+obj = myClass;
+
+a = 1;
+
+obj.(~a);
+
+obj(~a);
+
+obj{~a};
+
+% classdef myClass
+% methods
+% % For
+% % >> obj = myClass
+% % subsref lets you overload operators:
+% % obj.(expr) - "dot paren index" (often called dynamic field
reference) takes the value of the
+% % expression inside parens and treats that as a
dot-index.
+% % obj(expr) - "paren index"
+% % obj{expr} - "brace index"
+% function varargout = subsref(obj, S)
+% disp('in subref');
+% disp(S);
+% varargout{1} = 0;
+% varargout{2} = 0;
+% end
+% end
+% end
diff --git
a/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected.m
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected.m
new file mode 100644
index 0000000000..968ad688ae
--- /dev/null
+++
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected.m
@@ -0,0 +1,31 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/152
+
+obj = myClass;
+
+a = 1;
+
+obj.(~a);
+
+obj(~a);
+
+obj{~a};
+
+% classdef myClass
+% methods
+% % For
+% % >> obj = myClass
+% % subsref lets you overload operators:
+% % obj.(expr) - "dot paren index" (often called dynamic field
reference) takes the value of the
+% % expression inside parens and treats that as a
dot-index.
+% % obj(expr) - "paren index"
+% % obj{expr} - "brace index"
+% function varargout = subsref(obj, S)
+% disp('in subref');
+% disp(S);
+% varargout{1} = 0;
+% varargout{2} = 0;
+% end
+% end
+% end
diff --git
a/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected_msgs.m
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected_msgs.m
new file mode 100644
index 0000000000..c180224804
--- /dev/null
+++
b/tests/test-matlab-ts-mode-electric-indent-files/electric_indent_dot_paren_issue152_expected_msgs.m
@@ -0,0 +1,31 @@
+% -*- matlab-ts -*- % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/152 %
<{Matched rule: (matlab-ts-mode--i-top-level matlab-ts-mode--column-0 0)}>
+
+obj = myClass; % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+a = 1; % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+obj.(~a); % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+obj(~a); % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+obj{~a}; % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+
+% classdef myClass % <{Matched rule: (matlab-ts-mode--i-top-level
matlab-ts-mode--column-0 0)}>
+% methods % <{Matched rule: (matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % For % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % >> obj = myClass % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % subsref lets you overload operators: % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % obj.(expr) - "dot paren index" (often called dynamic field
reference) takes the value of the % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % expression inside parens and treats that as a
dot-index. % <{Matched rule: (matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % obj(expr) - "paren index" % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% % obj{expr} - "brace index" % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% function varargout = subsref(obj, S) % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% disp('in subref'); % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% disp(S); % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% varargout{1} = 0; % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% varargout{2} = 0; % <{Matched rule:
(matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% end % <{Matched rule: (matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% end % <{Matched rule: (matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>
+% end % <{Matched rule: (matlab-ts-mode--i-block-comment-end-matcher
matlab-ts-mode--i-block-comment-end-anchor 0)}>