branch: externals/matlab-mode
commit c232273227f78252688dd86faca8ce44b6ade69a
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: update for matlab tree-sitter abi/14 d334652
---
...ine_cont_unary_in_cell_or_mat_issue117.skip.txt | 1 -
...e_cont_unary_in_cell_or_mat_issue117_expected.m | 21 ++++++++++++
...t_unary_in_cell_or_mat_issue117_expected_msgs.m | 21 ++++++++++++
.../indent_line_cont_with_percent_issue118.m | 2 ++
...indent_line_cont_with_percent_issue118.skip.txt | 1 -
...ent_line_cont_with_percent_issue118_expected.m} | 4 ++-
...line_cont_with_percent_issue118_expected_msgs.m | 10 ++++++
.../indent_old_indents_expected_msgs.m | 6 ++--
.../indent_old_indents_for_typing_expected_msgs.m | 6 ++--
.../indent_xr_fun5_expected.org | 24 +++++++-------
.../parser_line_cont_extra_dot.skip.txt | 1 -
.../parser_line_cont_extra_dot_expected.txt | 38 ++++++++++++++++++++++
12 files changed, 113 insertions(+), 22 deletions(-)
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117.skip.txt
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117.skip.txt
deleted file mode 100644
index 9f0d023f04..0000000000
---
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/117
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected.m
new file mode 100644
index 0000000000..2d8e220df2
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected.m
@@ -0,0 +1,21 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/117
+
+m1 = [-100 -200...
+ -300];
+
+c1 = {-100 -200...
+ -300};
+
+m1 = [-100 -200 ...
+ -300];
+
+c1 = {-100 -200 ...
+ -300};
+
+m1 = [-100 -200,...
+ -300];
+
+c1 = {-100 -200,...
+ -300};
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected_msgs.m
new file mode 100644
index 0000000000..c6c9b1d27b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_unary_in_cell_or_mat_issue117_expected_msgs.m
@@ -0,0 +1,21 @@
+% -*- matlab-ts -*- % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/117 %
<{Matched rule: ((lambda (node parent _bol &rest _) (and node (not (string=
(treesit-node-type node) "line_continuation")) (equal (treesit-node-type
parent) "source_file"))) (lambda (_node _parent bol &rest _) (save-excursion
(goto-char bol) (line-beginning-position))) 0)}>
+
+m1 = [-100 -200... % <{Matched rule: ((lambda (node parent _bol &rest _) (and
node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300]; % <{Matched rule: (matlab-ts-mode--i-row-matcher
matlab-ts-mode--i-row-anchor 0)}>
+
+c1 = {-100 -200... % <{Matched rule: ((lambda (node parent _bol &rest _) (and
node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300}; % <{Matched rule: (matlab-ts-mode--i-row-matcher
matlab-ts-mode--i-row-anchor 0)}>
+
+m1 = [-100 -200 ... % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300]; % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+
+c1 = {-100 -200 ... % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300}; % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+
+m1 = [-100 -200,... % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300]; % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+
+c1 = {-100 -200,... % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ -300}; % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
index a17f9d18fa..398fd363c4 100644
---
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
@@ -2,6 +2,8 @@
% See https://github.com/acristoffers/tree-sitter-matlab/issues/118
+% t-utils-test-indent: no-line-by-line-indent - the "... % comment1"
isn't handled typing line-by-line
+
c1 = {'foo'...
... % comment1
'bar'... % comment2
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.skip.txt
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.skip.txt
deleted file mode 100644
index d0d5d05458..0000000000
---
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See https://github.com/acristoffers/tree-sitter-matlab/issues/118
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected.m
similarity index 55%
copy from
tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
copy to
tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected.m
index a17f9d18fa..67f9e2f2e2 100644
---
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118.m
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected.m
@@ -2,7 +2,9 @@
% See https://github.com/acristoffers/tree-sitter-matlab/issues/118
-c1 = {'foo'...
+% t-utils-test-indent: no-line-by-line-indent - the "... % comment1"
isn't handled typing line-by-line
+
+c1 = {'foo'...
... % comment1
'bar'... % comment2
};
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected_msgs.m
new file mode 100644
index 0000000000..1f3c38e723
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_percent_issue118_expected_msgs.m
@@ -0,0 +1,10 @@
+% -*- matlab-ts -*- % <{Matched rule: ((lambda (node parent _bol &rest _)
(and node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/118 %
<{Matched rule: ((lambda (node parent _bol &rest _) (and node (not (string=
(treesit-node-type node) "line_continuation")) (equal (treesit-node-type
parent) "source_file"))) (lambda (_node _parent bol &rest _) (save-excursion
(goto-char bol) (line-beginning-position))) 0)}>
+
+% t-utils-test-indent: no-line-by-line-indent - the "... % comment1"
isn't handled typing line-by-line % <{Matched rule: ((lambda (node parent _bol
&rest _) (and node (not (string= (treesit-node-type node) "line_continuation"))
(equal (treesit-node-type parent) "source_file"))) (lambda (_node _parent bol
&rest _) (save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+
+c1 = {'foo'... % <{Matched rule: ((lambda (node parent _bol &rest _) (and
node (not (string= (treesit-node-type node) "line_continuation")) (equal
(treesit-node-type parent) "source_file"))) (lambda (_node _parent bol &rest _)
(save-excursion (goto-char bol) (line-beginning-position))) 0)}>
+ ... % comment1 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ 'bar'... % comment2 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ }; % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
index 8843a4ef0e..f18394a058 100644
--- a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
+++ b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_expected_msgs.m
@@ -92,7 +92,7 @@ function B = ends_in_comments_and_strings() % <{Matched
rule: ((lambda (node pa
A = C; % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
end; B = [ 1 2 ... % is this the end? % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
- 3 4 ]; % !!15 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
+ 3 4 ]; % !!15 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
% !!4 % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
@@ -144,7 +144,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
multinest = { [ 1 2 %!!4 % <{Matched rule: ((parent-is
"\\`block\\'") parent 0)}>
3 4 ]; %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
{ 5 6 7 ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
- 8 9 10 ... %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
+ 8 9 10 ... %!!20 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
}; %!!18 % <{Matched rule: ((node-is
"\\`[])}]\\'") parent 0)}>
fcncall(10, ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
12, ... %!!26 % <{Matched rule: ((parent-is
"\\`arguments\\'") parent 0)}>
@@ -157,7 +157,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
[ ... %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
2 3 %!!10 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
] ... %!!8 % <{Matched rule: ((node-is "\\`[])}]\\'") parent
0)}>
- 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
+ 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
}; %!!11 % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
cascade_long_name = ... %!!4 % <{Matched rule: ((parent-is "\\`block\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
index 8262597a31..250655babf 100644
---
a/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
+++
b/tests/test-matlab-ts-mode-indent-files/indent_old_indents_for_typing_expected_msgs.m
@@ -94,7 +94,7 @@ function B = ends_in_comments_and_strings() % <{Matched
rule: ((lambda (node pa
A = C; % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
end; B = [ 1 2 ... % is this the end? % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
- 3 4 ]; % !!15 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
+ 3 4 ]; % !!15 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
% !!4 % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
@@ -146,7 +146,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
multinest = { [ 1 2 %!!4 % <{Matched rule: ((parent-is
"\\`block\\'") parent 0)}>
3 4 ]; %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
{ 5 6 7 ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
- 8 9 10 ... %!!20 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
+ 8 9 10 ... %!!20 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
}; %!!18 % <{Matched rule: ((node-is
"\\`[])}]\\'") parent 0)}>
fcncall(10, ... %!!18 % <{Matched rule:
(matlab-ts-mode--i-row-matcher matlab-ts-mode--i-row-anchor 0)}>
12, ... %!!26 % <{Matched rule: ((parent-is
"\\`arguments\\'") parent 0)}>
@@ -159,7 +159,7 @@ function out = array_constant_decls() % <{Matched rule:
((lambda (node parent _
[ ... %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
2 3 %!!10 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
] ... %!!8 % <{Matched rule: ((node-is "\\`[])}]\\'") parent
0)}>
- 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
+ 3 %!!8 % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
}; %!!11 % <{Matched rule: ((node-is "\\`[])}]\\'") parent 0)}>
cascade_long_name = ... %!!4 % <{Matched rule: ((parent-is "\\`block\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
index 9bb5ff710b..69cd8427a8 100644
--- a/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
+++ b/tests/test-matlab-ts-mode-indent-xr-files/indent_xr_fun5_expected.org
@@ -148,9 +148,9 @@
- Invoking : "C-m" = newline
Start point : 1048
- Moved to point: 1057
- : 36:8:
- : ^
+ Moved to point: 1054
+ : 36:5:
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -159,14 +159,14 @@
function ...
[ ...
b ... comment for b
-+
++
#+end_src diff
- Invoking : (insert "] = ...")
- Start point : 1057
- Moved to point: 1064
- : 36:15: ] = ...
- : ^
+ Start point : 1054
+ Moved to point: 1061
+ : 36:12: ] = ...
+ : ^
Buffer modified:
#+begin_src diff
--- start_contents
@@ -175,12 +175,12 @@
function ...
[ ...
b ... comment for b
--
-+ ] = ...
+-
++ ] = ...
#+end_src diff
- Invoking : "C-m" = newline
- Start point : 1064
+ Start point : 1061
Moved to point: 1065
: 37:4:
: ^
@@ -192,7 +192,7 @@
function ...
[ ...
b ... comment for b
-- ] = ...
+- ] = ...
+ ] = ...
+
#+end_src diff
diff --git
a/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot.skip.txt
b/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot.skip.txt
deleted file mode 100644
index f59dac1269..0000000000
--- a/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot.skip.txt
+++ /dev/null
@@ -1 +0,0 @@
-See: https://github.com/acristoffers/tree-sitter-matlab/issues/119
diff --git
a/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot_expected.txt
b/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot_expected.txt
new file mode 100644
index 0000000000..81a13648c3
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/parser_line_cont_extra_dot_expected.txt
@@ -0,0 +1,38 @@
+# -*- t-utils-ts-parse-tree -*-
+# tree-sitter parse tree annotated with [NODE_START,NODE_END]@{NODE_TEXT}@
+# where NODE_TEXT is of length NODE-END - NODE_START
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@)
+ (function_call name: (identifier[21,24]@{foo}@) ([24,25]
+ (arguments argument: (identifier[25,26]@{x}@) ,[26,27]
+ (string '[28,29] (string_content[29,32]@{goo}@) '[32,33])
+ ,[33,34]
+ (postfix_operator
+ operand:
+ (cell {[35,36]
+ (row
+ (function_call name: (identifier[36,38]@{c2}@) {[38,39]
+ (arguments
+ argument: (range (number[39,40]@{1}@) :[40,41] (number[41,42]@{4}@)))
+ }[42,43])
+ ,[44,44]
+ (string '[44,45] (string_content[45,47]@{on}@) '[47,48])
+ (line_continuation[49,68]@{....\n }@) ,[68,68]
+ (matrix [[68,69]
+ (row
+ (string '[69,70] (string_content[70,73]@{foo}@) '[73,74])
+ ,[75,75]
+ (string '[75,76] (string_content[76,79]@{bar}@) '[79,80]))
+ ][80,81])
+ (line_continuation[82,101]@{....\n }@) ,[101,101]
+ (string '[101,102] (string_content[102,105]@{off}@) '[105,106])
+ ,[107,107]
+ (function_call name: (identifier[107,109]@{c3}@) {[109,110]
+ (arguments
+ argument:
+ (range (number[110,111]@{8}@) :[111,112]
+ (end_keyword end[112,115])))
+ }[115,116]))
+ }[116,117])
+ '[117,118]))
+ )[118,119])
+ ;[119,120] \n[120,121])