branch: externals/matlab-mode
commit 1f2453dd9045662f9c2a98618bc8e09400c03525
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: add tests for matlab tree-sitter abi/14 9d16fcf
This adds tests for matlab tree-sitter issues 123 to 129.
---
...font_lock_comment_between_arg_blocks_issue128.m | 16 ++++++
...omment_between_arg_blocks_issue128_expected.txt | 16 ++++++
.../font_lock_empty_endless_fun_issue127.m | 9 ++++
...nt_lock_empty_endless_fun_issue127_expected.txt | 9 ++++
.../font_lock_unnecessary_semicolon_issue129.m | 17 ++++++
...ock_unnecessary_semicolon_issue129_expected.txt | 17 ++++++
.../indent_cell_of_fcn_handles_issue126.m | 9 ++++
.../indent_cell_of_fcn_handles_issue126_expected.m | 9 ++++
...nt_cell_of_fcn_handles_issue126_expected_msgs.m | 9 ++++
.../indent_line_cont_with_metaclass_op_issue124.m | 8 +++
...line_cont_with_metaclass_op_issue124_expected.m | 8 +++
...cont_with_metaclass_op_issue124_expected_msgs.m | 8 +++
.../indent_trailing_whitespace_on_cmd_issue125.m | 23 ++++++++
..._trailing_whitespace_on_cmd_issue125_expected.m | 23 ++++++++
...ling_whitespace_on_cmd_issue125_expected_msgs.m | 23 ++++++++
...t_try_catch_with_trailing_whitespace_issue123.m | 30 +++++++++++
...ch_with_trailing_whitespace_issue123_expected.m | 30 +++++++++++
...th_trailing_whitespace_issue123_expected_msgs.m | 30 +++++++++++
...font_lock_comment_between_arg_blocks_issue128.m | 16 ++++++
...omment_between_arg_blocks_issue128_expected.txt | 24 +++++++++
.../font_lock_empty_endless_fun_issue127.m | 9 ++++
...nt_lock_empty_endless_fun_issue127_expected.txt | 4 ++
.../font_lock_unnecessary_semicolon_issue129.m | 17 ++++++
...ock_unnecessary_semicolon_issue129_expected.txt | 17 ++++++
.../indent_cell_of_fcn_handles_issue126.m | 9 ++++
...ndent_cell_of_fcn_handles_issue126_expected.txt | 31 +++++++++++
.../indent_line_cont_with_metaclass_op_issue124.m | 8 +++
...ne_cont_with_metaclass_op_issue124_expected.txt | 11 ++++
.../indent_trailing_whitespace_on_cmd_issue125.m | 23 ++++++++
...railing_whitespace_on_cmd_issue125_expected.txt | 38 ++++++++++++++
...t_try_catch_with_trailing_whitespace_issue123.m | 30 +++++++++++
..._with_trailing_whitespace_issue123_expected.txt | 61 ++++++++++++++++++++++
32 files changed, 592 insertions(+)
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
new file mode 100644
index 0000000000..6179283ff3
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
@@ -0,0 +1,16 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/128
+
+function out = font_lock_comment_between_arg_blocks_issue128(in1, in2)
+ arguments (Input)
+ in1 double
+ end
+
+ % comment
+ arguments (Input)
+ in2 double
+ end
+
+ out = in1 + in2;
+end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
new file mode 100644
index 0000000000..b6804e3eee
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
@@ -0,0 +1,16 @@
+c ccc ccccccccc ccc
+
+c ccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk vvv o fffffffffffffffffffffffffffffffffffffffffffffbvvvD vvvb
+ kkkkkkkkk bdddddb
+ PPP tttttt
+ kkk
+
+ c ccccccc
+ kkkkkkkkk bdddddb
+ PPP tttttt
+ kkk
+
+ vvv o ddd o dddD
+kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
new file mode 100644
index 0000000000..aa4e5e790f
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/127
+
+function font_lock_empty_endless_fun_issue127
+% empty fcn
+
+function fcn2
+% empty fcn2
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
new file mode 100644
index 0000000000..d4e585066b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
@@ -0,0 +1,9 @@
+c ccc ccccccccc ccc
+
+c cccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+kkkkkkkk ffffffffffffffffffffffffffffffffffff
+h hhhhh hhh
+
+kkkkkkkk ffff
+h hhhhh hhhh
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
new file mode 100644
index 0000000000..a0aee4ce6b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
@@ -0,0 +1,17 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/129
+
+
+function font_lock_unnecessary_semicolon_issue129
+ ;
+ %comment
+ unnecessary_semicolon
+end
+
+function unnecessary_semicolon
+; %#ok undocumented
+ disp('here')
+end
+
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
new file mode 100644
index 0000000000..4689202535
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
@@ -0,0 +1,17 @@
+c ccc ccccccccc ccc
+
+c cccc ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
+
+
+kkkkkkkk ffffffffffffffffffffffffffffffffffffffff
+ D
+ cccccccc
+ ddddddddddddddddddddd
+kkk
+
+kkkkkkkk fffffffffffffffffffff
+D pppp pppppppppppp
+ BBBBbSssssSb
+kkk
+
+
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
new file mode 100644
index 0000000000..d8acdae329
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/126
+
+v = { ...
+ @(p) f1(p), ...
+ @(p) f2(p) ...
+ @(p) f3(p) ...
+ }
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.m
new file mode 100644
index 0000000000..d8acdae329
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/126
+
+v = { ...
+ @(p) f1(p), ...
+ @(p) f2(p) ...
+ @(p) f3(p) ...
+ }
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected_msgs.m
new file mode 100644
index 0000000000..9d7546c869
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected_msgs.m
@@ -0,0 +1,9 @@
+% -*- 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/126 %
<{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)}>
+
+v = { ... % <{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)}>
+ @(p) f1(p), ... % <{Matched rule: ((parent-is
"\\`\\(?:cell\\|matrix\\)\\'") parent 2)}>
+ @(p) f2(p) ... % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
+ @(p) f3(p) ... % <{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_line_cont_with_metaclass_op_issue124.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124.m
new file mode 100644
index 0000000000..efb3856d5d
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124.m
@@ -0,0 +1,8 @@
+% -*- matlab-ts -*-
+
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/124
+
+
+iTypes=[?int8...
+ ?int16]
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.m
new file mode 100644
index 0000000000..efb3856d5d
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.m
@@ -0,0 +1,8 @@
+% -*- matlab-ts -*-
+
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/124
+
+
+iTypes=[?int8...
+ ?int16]
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected_msgs.m
new file mode 100644
index 0000000000..49bbdf2a6e
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected_msgs.m
@@ -0,0 +1,8 @@
+% -*- 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/124 %
<{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)}>
+
+
+iTypes=[?int8... % <{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)}>
+ ?int16] % <{Matched rule: ((parent-is
"\\`\\(?:function_output\\|row\\)\\'") parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
new file mode 100644
index 0000000000..83dd33977e
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
@@ -0,0 +1,23 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/125
+
+% There is whitespace after both "someCmd " statements below
+
+switch in1
+ otherwise
+ if in1 > 1
+ disp('> 1');
+ else
+ someCmd
+ end
+end
+
+
+switch a
+ otherwise
+ someCmd
+ if a > 1
+ disp('>1')
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.m
new file mode 100644
index 0000000000..e5f7ff976f
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.m
@@ -0,0 +1,23 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/125
+
+% There is whitespace after both "someCmd " statements below
+
+switch in1
+ otherwise
+ if in1 > 1
+ disp('> 1');
+ else
+ someCmd
+ end
+end
+
+
+switch a
+ otherwise
+ someCmd
+ if a > 1
+ disp('>1')
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected_msgs.m
new file mode 100644
index 0000000000..03acdaefef
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected_msgs.m
@@ -0,0 +1,23 @@
+% -*- 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/125 %
<{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)}>
+
+% There is whitespace after both "someCmd " statements below % <{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)}>
+
+switch in1 % <{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)}>
+ otherwise % <{Matched rule: ((node-is
"\\`\\(?:\\(?:ca\\|otherwi\\)se_clause\\)\\'") parent 2)}>
+ if in1 > 1 % <{Matched rule: ((parent-is
"\\`\\(?:case_clause\\|otherwise_clause\\|switch_statement\\)\\'") parent 2)}>
+ disp('> 1'); % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ else % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+ someCmd % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+
+
+switch a % <{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)}>
+ otherwise % <{Matched rule: ((node-is
"\\`\\(?:\\(?:ca\\|otherwi\\)se_clause\\)\\'") parent 2)}>
+ someCmd % <{Matched rule: ((parent-is
"\\`\\(?:case_clause\\|otherwise_clause\\|switch_statement\\)\\'") parent 2)}>
+ if a > 1 % <{Matched rule: ((parent-is "\\`block\\'") parent 0)}>
+ disp('>1') % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
new file mode 100644
index 0000000000..a36bc3ae4a
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
@@ -0,0 +1,30 @@
+% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/123
+
+% Below the "catch ME " should have trailing whitespace to exercise
tree-sitter
+
+classdef indent_try_catch_with_trailing_whitespace_issue123
+ properties
+ m
+ end
+
+ methods
+ function obj = foo(m)
+ end
+
+ function rtn = fcn1(obj, val)
+ try
+ rtn = obj.m * [1, 2; 3 4];
+ catch ME
+ if val == 1
+ disp('here1');
+ else
+ disp('here2');
+ end
+ rtn = [];
+ end
+ end
+
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.m
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.m
new file mode 100644
index 0000000000..6eb741b437
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.m
@@ -0,0 +1,30 @@
+% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/123
+
+% Below the "catch ME " should have trailing whitespace to exercise
tree-sitter
+
+classdef indent_try_catch_with_trailing_whitespace_issue123
+ properties
+ m
+ end
+
+ methods
+ function obj = foo(m)
+ end
+
+ function rtn = fcn1(obj, val)
+ try
+ rtn = obj.m * [1, 2; 3 4];
+ catch ME
+ if val == 1
+ disp('here1');
+ else
+ disp('here2');
+ end
+ rtn = [];
+ end
+ end
+
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected_msgs.m
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected_msgs.m
new file mode 100644
index 0000000000..cac9751aa8
--- /dev/null
+++
b/tests/test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected_msgs.m
@@ -0,0 +1,30 @@
+% -*- 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)}>
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/123 % <{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)}>
+
+% Below the "catch ME " should have trailing whitespace to exercise
tree-sitter % <{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)}>
+
+classdef indent_try_catch_with_trailing_whitespace_issue123 % <{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)}>
+ properties % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ m % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+
+ methods % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ function obj = foo(m) % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+
+ function rtn = fcn1(obj, val) % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ try % <{Matched rule: ((parent-is "\\`function_definition\\'")
parent matlab-ts-mode--set-function-indent-level-for-gp)}>
+ rtn = obj.m * [1, 2; 3 4]; % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ catch ME % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+ if val == 1 % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ disp('here1'); % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ else % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+ disp('here2'); % <{Matched rule: ((node-is
"\\`\\(?:arguments_statement\\|block\\|e\\(?:num\\(?:eration\\)?\\|vents\\)\\|function_definition\\|methods\\|propert\\(?:ies\\|y\\)\\)\\'")
parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+ rtn = []; % <{Matched rule: ((n-p-gp nil "\\`block\\'"
"\\`catch_clause\\'") grand-parent 4)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+
+ end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
+end % <{Matched rule: ((node-is
"\\`\\(?:catch_clause\\|e\\(?:lse\\(?:\\(?:if\\)?_clause\\)\\|nd\\)\\)\\'")
parent 0)}>
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
new file mode 100644
index 0000000000..6179283ff3
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128.m
@@ -0,0 +1,16 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/128
+
+function out = font_lock_comment_between_arg_blocks_issue128(in1, in2)
+ arguments (Input)
+ in1 double
+ end
+
+ % comment
+ arguments (Input)
+ in2 double
+ end
+
+ out = in1 + in2;
+end
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
new file mode 100644
index 0000000000..c98b9e1dc3
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_comment_between_arg_blocks_issue128_expected.txt
@@ -0,0 +1,24 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,89]@{% See
https://github.com/acristoffers/tree-sitter-...}@)
+ (function_definition function[91,99]
+ (function_output (identifier[100,103]@{out}@) =[104,105])
+ name: (identifier[106,151]@{font_lock_comment_between_arg_blocks_issue128}@)
+ (function_arguments ([151,152] arguments: (identifier[152,155]@{in1}@)
,[155,156] (identifier[157,160]@{in2}@) )[160,161])
+ \n[161,162]
+ (arguments_statement arguments[166,175]
+ (attributes ([176,177] argument: (identifier[177,182]@{Input}@) )[182,183])
+ \n[183,184]
+ (property name: (identifier[192,195]@{in1}@)
(identifier[196,202]@{double}@) \n[202,203])
+ end[207,210])
+ (comment[216,225]@{% comment}@) \n[225,226]
+ (arguments_statement arguments[230,239]
+ (attributes ([240,241] argument: (identifier[241,246]@{Input}@) )[246,247])
+ \n[247,248]
+ (property name: (identifier[256,259]@{in2}@)
(identifier[260,266]@{double}@) \n[266,267])
+ end[271,274])
+ (block
+ (assignment left: (identifier[280,283]@{out}@) =[284,285]
+ right: (binary_operator left: (identifier[286,289]@{in1}@) +[290,291]
right: (identifier[292,295]@{in2}@)))
+ ;[295,296] \n[296,297])
+ end[297,300])
+ \n[300,301])
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
new file mode 100644
index 0000000000..aa4e5e790f
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/127
+
+function font_lock_empty_endless_fun_issue127
+% empty fcn
+
+function fcn2
+% empty fcn2
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
new file mode 100644
index 0000000000..0ad60c127a
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_empty_endless_fun_issue127_expected.txt
@@ -0,0 +1,4 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,90]@{% See:
https://github.com/acristoffers/tree-sitter...}@)
+ (function_definition function[92,100] name:
(identifier[101,137]@{font_lock_empty_endless_fun_issue127}@)
(comment[138,149]@{% empty fcn}@) \n[149,151])
+ (function_definition function[151,159] name: (identifier[160,164]@{fcn2}@)
(comment[165,177]@{% empty fcn2}@) \n[177,178]))
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
new file mode 100644
index 0000000000..a0aee4ce6b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129.m
@@ -0,0 +1,17 @@
+% -*- matlab-ts -*-
+
+% See: https://github.com/acristoffers/tree-sitter-matlab/issues/129
+
+
+function font_lock_unnecessary_semicolon_issue129
+ ;
+ %comment
+ unnecessary_semicolon
+end
+
+function unnecessary_semicolon
+; %#ok undocumented
+ disp('here')
+end
+
+
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
new file mode 100644
index 0000000000..b075f7410b
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-font-lock-files/font_lock_unnecessary_semicolon_issue129_expected.txt
@@ -0,0 +1,17 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,90]@{% See:
https://github.com/acristoffers/tree-sitter...}@)
+ (function_definition function[93,101] name:
(identifier[102,142]@{font_lock_unnecessary_semicolon_issue129}@) \n[142,143]
;[147,148] (comment[153,161]@{%comment}@)
+ (block
+ (command (command_name[166,187]@{unnecessary_semicolon}@))
+ \n[187,188])
+ end[188,191])
+ \n[191,193]
+ (function_definition function[193,201] name:
(identifier[202,223]@{unnecessary_semicolon}@) \n[223,224] ;[224,225]
(comment[226,243]@{%#ok undocumented}@)
+ (block
+ (function_call name: (identifier[248,252]@{disp}@) ([252,253]
+ (arguments
+ argument: (string '[253,254] (string_content[254,258]@{here}@)
'[258,259]))
+ )[259,260])
+ \n[260,261])
+ end[261,264])
+ \n[264,266] \n[267,268])
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
new file mode 100644
index 0000000000..d8acdae329
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/126
+
+v = { ...
+ @(p) f1(p), ...
+ @(p) f2(p) ...
+ @(p) f3(p) ...
+ }
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.txt
new file mode 100644
index 0000000000..1c2f54c91c
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_cell_of_fcn_handles_issue126_expected.txt
@@ -0,0 +1,31 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,89]@{% See
https://github.com/acristoffers/tree-sitter-...}@)
+ (assignment left: (identifier[91,92]@{v}@) =[93,94]
+ right:
+ (cell {[95,96] (line_continuation[97,101]@{...\n}@)
+ (row
+ (lambda @[107,108] ([108,109]
+ (arguments (identifier[109,110]@{p}@))
+ )[110,111]
+ expression:
+ (function_call name: (identifier[112,114]@{f1}@) ([114,115]
+ (arguments argument: (identifier[115,116]@{p}@))
+ )[116,117]))
+ ,[117,118] (line_continuation[119,123]@{...\n}@)
+ (lambda @[129,130] ([130,131]
+ (arguments (identifier[131,132]@{p}@))
+ )[132,133]
+ expression:
+ (function_call name: (identifier[134,136]@{f2}@) ([136,137]
+ (arguments argument: (identifier[137,138]@{p}@))
+ )[138,139]))
+ (line_continuation[140,150]@{...\n }@) ,[150,150]
+ (lambda @[150,151] ([151,152]
+ (arguments (identifier[152,153]@{p}@))
+ )[153,154]
+ expression:
+ (function_call name: (identifier[155,157]@{f3}@) ([157,158]
+ (arguments argument: (identifier[158,159]@{p}@))
+ )[159,160])))
+ (line_continuation[161,169]@{...\n }@) }[169,170]))
+ \n[170,171])
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124.m
new file mode 100644
index 0000000000..efb3856d5d
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124.m
@@ -0,0 +1,8 @@
+% -*- matlab-ts -*-
+
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/124
+
+
+iTypes=[?int8...
+ ?int16]
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.txt
new file mode 100644
index 0000000000..7c38fdf682
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_line_cont_with_metaclass_op_issue124_expected.txt
@@ -0,0 +1,11 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[23,90]@{% See
https://github.com/acristoffers/tree-sitter-...}@)
+ (assignment left: (identifier[93,99]@{iTypes}@) =[99,100]
+ right:
+ (matrix [[100,101]
+ (row
+ (metaclass_operator ?[101,102] (identifier[102,106]@{int8}@))
+ (line_continuation[106,118]@{...\n }@) ,[118,118]
+ (metaclass_operator ?[118,119] (identifier[119,124]@{int16}@)))
+ ][124,125]))
+ \n[125,126])
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
new file mode 100644
index 0000000000..83dd33977e
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125.m
@@ -0,0 +1,23 @@
+% -*- matlab-ts -*-
+
+% See https://github.com/acristoffers/tree-sitter-matlab/issues/125
+
+% There is whitespace after both "someCmd " statements below
+
+switch in1
+ otherwise
+ if in1 > 1
+ disp('> 1');
+ else
+ someCmd
+ end
+end
+
+
+switch a
+ otherwise
+ someCmd
+ if a > 1
+ disp('>1')
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.txt
new file mode 100644
index 0000000000..6b82a817cc
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_trailing_whitespace_on_cmd_issue125_expected.txt
@@ -0,0 +1,38 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,89]@{% See
https://github.com/acristoffers/tree-sitter-...}@) (comment[91,152]@{% There is
whitespace after both "someCmd " state...}@)
+ (switch_statement switch[154,160] condition: (identifier[161,164]@{in1}@)
\n[164,165]
+ (otherwise_clause otherwise[167,176] \n[176,177]
+ (block
+ (if_statement if[181,183]
+ condition: (comparison_operator (identifier[184,187]@{in1}@) >[188,189]
(number[190,191]@{1}@))
+ (block
+ (function_call name: (identifier[200,204]@{disp}@) ([204,205]
+ (arguments
+ argument: (string '[205,206] (string_content[206,209]@{> 1}@)
'[209,210]))
+ )[210,211])
+ ;[211,212] \n[212,213])
+ (else_clause else[217,221]
+ (block
+ (command (command_name[230,237]@{someCmd}@))
+ \n[239,240]))
+ end[244,247])
+ \n[247,248]))
+ end[248,251])
+ \n[251,254]
+ (switch_statement switch[254,260] condition: (identifier[261,262]@{a}@)
\n[262,263]
+ (otherwise_clause otherwise[265,274]
+ (block
+ (command (command_name[279,286]@{someCmd}@))
+ \n[288,289]
+ (if_statement if[293,295]
+ condition: (comparison_operator (identifier[296,297]@{a}@) >[298,299]
(number[300,301]@{1}@))
+ (block
+ (function_call name: (identifier[310,314]@{disp}@) ([314,315]
+ (arguments
+ argument: (string '[315,316] (string_content[316,318]@{>1}@)
'[318,319]))
+ )[319,320])
+ \n[320,321])
+ end[325,328])
+ \n[328,329]))
+ end[329,332])
+ \n[332,333])
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
new file mode 100644
index 0000000000..a36bc3ae4a
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123.m
@@ -0,0 +1,30 @@
+% -*- matlab-ts -*-
+
+% https://github.com/acristoffers/tree-sitter-matlab/issues/123
+
+% Below the "catch ME " should have trailing whitespace to exercise
tree-sitter
+
+classdef indent_try_catch_with_trailing_whitespace_issue123
+ properties
+ m
+ end
+
+ methods
+ function obj = foo(m)
+ end
+
+ function rtn = fcn1(obj, val)
+ try
+ rtn = obj.m * [1, 2; 3 4];
+ catch ME
+ if val == 1
+ disp('here1');
+ else
+ disp('here2');
+ end
+ rtn = [];
+ end
+ end
+
+ end
+end
diff --git
a/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.txt
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.txt
new file mode 100644
index 0000000000..0a211705ca
--- /dev/null
+++
b/tests/test-matlab-ts-mode-parser-files/copy-of-test-matlab-ts-mode-indent-files/indent_try_catch_with_trailing_whitespace_issue123_expected.txt
@@ -0,0 +1,61 @@
+# -*- t-utils-ts-parse-tree -*-
+(source_file (comment[1,20]@{% -*- matlab-ts -*-}@) (comment[22,85]@{%
https://github.com/acristoffers/tree-sitter-matl...}@) (comment[87,167]@{%
Below the "catch ME " should have trailing whit...}@)
+ (class_definition classdef[169,177] name:
(identifier[178,228]@{indent_try_catch_with_trailing_whitespace_issue123}@)
\n[228,229]
+ (properties properties[233,243] \n[243,244]
+ (property name: (identifier[252,253]@{m}@) \n[253,254])
+ end[258,261])
+ (methods methods[267,274] \n[274,275]
+ (function_definition function[283,291]
+ (function_output (identifier[292,295]@{obj}@) =[296,297])
+ name: (identifier[298,301]@{foo}@)
+ (function_arguments ([301,302] arguments: (identifier[302,303]@{m}@)
)[303,304])
+ \n[304,305] end[313,316])
+ \n[316,317] \n[325,326]
+ (function_definition function[334,342]
+ (function_output (identifier[343,346]@{rtn}@) =[347,348])
+ name: (identifier[349,353]@{fcn1}@)
+ (function_arguments ([353,354] arguments: (identifier[354,357]@{obj}@)
,[357,358] (identifier[359,362]@{val}@) )[362,363])
+ \n[363,364]
+ (block
+ (try_statement try[376,379]
+ (block
+ (assignment left: (identifier[396,399]@{rtn}@) =[400,401]
+ right:
+ (binary_operator
+ left: (field_expression object: (identifier[402,405]@{obj}@)
.[405,406] field: (identifier[406,407]@{m}@))
+ *[408,409]
+ right:
+ (matrix [[410,411]
+ (row (number[411,412]@{1}@) ,[412,413] (number[414,415]@{2}@))
+ ;[415,416]
+ (row (number[417,418]@{3}@) ,[419,419] (number[419,420]@{4}@))
+ ][420,421])))
+ ;[421,422] \n[422,423])
+ (catch_clause catch[435,440] (identifier[441,443]@{ME}@) \n[445,446]
+ (block
+ (if_statement if[462,464]
+ condition: (comparison_operator (identifier[465,468]@{val}@)
==[469,471] (number[472,473]@{1}@))
+ (block
+ (function_call name: (identifier[494,498]@{disp}@) ([498,499]
+ (arguments
+ argument: (string '[499,500] (string_content[500,505]@{here1}@)
'[505,506]))
+ )[506,507])
+ ;[507,508] \n[508,509])
+ (else_clause else[525,529]
+ (block
+ (function_call name: (identifier[550,554]@{disp}@) ([554,555]
+ (arguments
+ argument: (string '[555,556] (string_content[556,561]@{here2}@)
'[561,562]))
+ )[562,563])
+ ;[563,564] \n[564,565]))
+ end[581,584])
+ \n[585,586]
+ (assignment left: (identifier[602,605]@{rtn}@) =[606,607]
+ right: (matrix [[608,609] ][609,610]))
+ ;[610,611] \n[611,612]))
+ end[624,627])
+ \n[627,628])
+ end[636,639])
+ \n[639,641] end[645,648])
+ end[649,652])
+ \n[652,653])