branch: externals/matlab-mode
commit c7ebf37ce0c952e8687ff905f00eb9b65e7e3c56
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: more font-lock improvements and test structure update
---
matlab-ts-mode.el | 130 ++++++++++++++-------
tests/t-utils.el | 3 -
.../{MyClass.m => font_lock_MyClass.m} | 2 +-
...expected.txt => font_lock_MyClass_expected.txt} | 2 +-
.../{MySubclass.m => font_lock_MySubClass.m} | 2 +-
...ected.txt => font_lock_MySubClass_expected.txt} | 2 +-
.../{MySubSubClass.m => font_lock_MySubSubClass.m} | 2 +-
...ed.txt => font_lock_MySubSubClass_expected.txt} | 2 +-
.../font_lock_brackets.m | 9 ++
.../font_lock_brackets_expected.txt | 9 ++
...ocks.m => font_lock_class_MultiplePropBlocks.m} | 2 +-
...ont_lock_class_MultiplePropBlocks_expected.txt} | 2 +-
...ttributeDemo.m => font_lock_class_attributes.m} | 2 +-
...txt => font_lock_class_attributes_expected.txt} | 2 +-
.../{test_enum.m => font_lock_class_enum.m} | 2 +-
...ected.txt => font_lock_class_enum_expected.txt} | 2 +-
..._classdef_events.m => font_lock_class_events.m} | 2 +-
...ted.txt => font_lock_class_events_expected.txt} | 2 +-
.../{test_methods.m => font_lock_class_methods.m} | 2 +-
...ed.txt => font_lock_class_methods_expected.txt} | 2 +-
...pertyAccess.m => font_lock_class_prop_access.m} | 2 +-
...xt => font_lock_class_prop_access_expected.txt} | 2 +-
.../{Prop.m => font_lock_class_properties.m} | 2 +-
...txt => font_lock_class_properties_expected.txt} | 2 +-
.../font_lock_continuation.m | 5 +
.../font_lock_continuation_expected.txt | 5 +
.../font_lock_continuation_fcn.m | 11 ++
.../font_lock_continuation_fcn_expected.txt | 11 ++
.../{g2.m => font_lock_continuation_fcn_g2.m} | 0
... => font_lock_continuation_fcn_g2_expected.txt} | 0
.../font_lock_continuation_multiArgFcn.m | 11 ++
...font_lock_continuation_multiArgFcn_expected.txt | 11 ++
.../font_lock_delimiters.m | 9 ++
.../font_lock_delimiters_expected.txt | 9 ++
.../{FlowRate.m => font_lock_enum_FlowRate.m} | 2 +-
...ed.txt => font_lock_enum_FlowRate_expected.txt} | 2 +-
...on.m => font_lock_error_missing_continuation.m} | 6 +-
...t_lock_error_missing_continuation_expected.txt} | 6 +-
.../{test_errors.m => font_lock_error_small.m} | 0
...cted.txt => font_lock_error_small_expected.txt} | 0
...{test_arguments.m => font_lock_fcn_arguments.m} | 2 +-
...ed.txt => font_lock_fcn_arguments_expected.txt} | 2 +-
.../font_lock_fcn_name_value_properties.m | 6 +
...ont_lock_fcn_name_value_properties_expected.txt | 6 +
...all_in_args.m => font_lock_fcn_small_in_args.m} | 0
...xt => font_lock_fcn_small_in_args_expected.txt} | 0
...all_no_args.m => font_lock_fcn_small_no_args.m} | 2 +-
...xt => font_lock_fcn_small_no_args_expected.txt} | 2 +-
...l_out_args.m => font_lock_fcn_small_out_args.m} | 2 +-
...t => font_lock_fcn_small_out_args_expected.txt} | 2 +-
.../{test_spmd.m => font_lock_keyword_spmd.m} | 0
...ted.txt => font_lock_keyword_spmd_expected.txt} | 0
.../{keywords.m => font_lock_keywords.m} | 2 +-
...xpected.txt => font_lock_keywords_expected.txt} | 2 +-
.../font_lock_numbers.m | 8 ++
.../font_lock_numbers_expected.txt | 8 ++
.../{my_fcn.m => font_lock_pragma_in_fcn.m} | 0
...ed.txt => font_lock_pragma_in_fcn_expected.txt} | 0
.../multiArgFcn.m | 11 --
.../multiArgFcn_expected.txt | 11 --
.../test_continuation.m | 11 --
.../test_continuation_expected.txt | 11 --
tests/test-matlab-ts-mode-font-lock.el | 7 +-
63 files changed, 246 insertions(+), 128 deletions(-)
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index b3cbde7847..3795dceb65 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -103,10 +103,14 @@ Guidelines:
:slant italic))
"*Face used on properties, enumerations, and events.")
-(defcustom matlab-ts-mode-font-lock-level 4
+(defface matlab-ts-mode-number-face
+ '((t :inherit font-lock-constant-face))
+ "*Face used for numbers.")
+
+(defcustom matlab-ts-mode-font-lock-level 3
"*Level of font lock, 1 for minimal syntax highlighting and 4 for maximum."
- ;; Setting to 4 to show parse errors causes too much "red". See
- ;; https://github.com/acristoffers/tree-sitter-matlab/issues/36
+ ;; Setting to 4 to results in parse errors causing too much "red". See
'syntax-error
+ ;; font-lock feature below.
:type '(choice (const :tag "Minimal" 1)
(const :tag "Low" 2)
(const :tag "Standard" 3)
@@ -491,6 +495,12 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
(treesit-fontify-with-override prop-start prop-end
'matlab-ts-mode-property-face
override start end)))))))
+(defun matlab-ts-mode--is-fcn-name-value (identifier-node)
+ "Return t if IDENTIFIER-NODE is a function name-value property."
+ (let ((next-sibling (treesit-node-next-sibling identifier-node)))
+ (and next-sibling
+ (string= (treesit-node-text next-sibling) "="))))
+
(defun matlab-ts-mode--is-builtin (identifier-node)
"Return t if IDENTIFIER-NODE is a function provided with MATLAB."
(let ((parent (treesit-node-parent identifier-node)))
@@ -508,27 +518,42 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
;; F-Rule: Comments and line continuation: ... optional text
:language 'matlab
:feature 'comment
- '((comment) @font-lock-comment-face
+ '(
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_types.m
+ (comment) @font-lock-comment-face
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_g2.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn.m
(line_continuation) @font-lock-comment-face)
;; F-Rule: special comments that override normal comment font
:language 'matlab
:feature 'comment-special
:override t
- '(((comment) @matlab-ts-mode-pragma-face
+ '(;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_pragma_in_fcn.m
+ ((comment) @matlab-ts-mode-pragma-face
(:match "^%#.+$" @matlab-ts-mode-pragma-face)) ;; %#pragma's
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_heading.m
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_sections.m
((comment) @matlab-ts-mode--comment-heading-capture) ;; %% comment heading
-
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_no_doc_help.m
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_comment_fcn.m
(function_definition (comment) @matlab-ts-mode--doc-comment-capture) ;;
doc help comments
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass.m
(class_definition (comment) @matlab-ts-mode--doc-comment-capture)) ;; doc
help comments
;; F-Rule: to do, fix me, triple-x marker comment keywords
+ ;; See: test-matlab-ts-mode-font-lock-files/font_lock_comment_markers.m
:language 'matlab
:feature 'comment-marker
:override t
'(((comment) @matlab-ts-mode--comment-to-do-capture))
;; F-Rule: keywords: if, else, etc.
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords.m
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods.m
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_keyword_spmd.m
:language 'matlab
:feature 'keyword
`([,@matlab-ts-mode--keywords] @font-lock-keyword-face)
@@ -536,40 +561,63 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
;; F-Rule: function/classdef and items definiting them, e.g. the function
arguments
:language 'matlab
:feature 'definition
- '((function_definition name: (identifier) @font-lock-function-name-face)
+ '(
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args.m
+ (function_definition name: (identifier) @font-lock-function-name-face)
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_symPosDef.m
(class_definition name: (identifier) @font-lock-function-name-face)
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass.m
(superclasses (property_name (identifier)) @font-lock-function-name-face)
;; Function inputs: functionName(in1, in2, in3)
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_in_args.m
(function_arguments arguments:
(identifier) @font-lock-variable-name-face
("," (identifier) @font-lock-variable-name-face) :*)
;; Function single output argument: function out = functionName(in1, in2)
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args.m
(function_output (identifier) @font-lock-variable-name-face)
;; Function multiple output arguments: function [out1, out2] =
functionName(in1, in2)
(function_output (multioutput_variable (identifier)
@font-lock-variable-name-face))
;; Fields of: arguments ... end , properties ... end
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access.m
(property (validation_functions (identifier) @font-lock-builtin-face))
(property name: (identifier) @matlab-ts-mode-property-face
(identifier) @font-lock-type-face :?)
(property name: (property_name (identifier) @matlab-ts-mode-property-face)
(identifier) @font-lock-type-face :?)
- ;; (property name: (property_name (identifier)
@matlab-ts-mode-property-face))
;; Enumeration's
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate.m
(enum (identifier) @matlab-ts-mode-property-face)
- ;; events block in classdef
+ ;; Events block in classdef
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events.m
(events (identifier) @matlab-ts-mode-property-face)
- ;; attributes of properties, methods
+ ;; Attributes of properties, methods
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes.m
(attribute (identifier) @font-lock-type-face "=" (identifier)
@font-lock-builtin-face)
(attribute (identifier) @font-lock-type-face))
+ ;; F-Rule: Function Name = Value arguments
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties.m
+ :language 'matlab
+ :feature 'fcn-name-value
+ '(((function_call (arguments (identifier) @matlab-ts-mode-property-face))
+ (:pred matlab-ts-mode--is-fcn-name-value @matlab-ts-mode-property-face)))
+
;; F-Rule: variable
- ;; TODO - add font-lock-variable-name-face to variable uses. Consider
- ;; i1 = [1, 2];
- ;; i2 = i1(1) + i3 + i4(i3);
- ;; we know i1 and i2 are varialbles from the (assignment left:
(identifier))
- ;; However, we don't know if i3 or i4 are variables or functions
because a function
- ;; can be called with no arguments, e.g. to call i3 function use i3
or i3(). i4 could
- ;; be a variable indexed by i1 or a function.
+ ;; Could add font-lock-variable-name-face to variable uses. Consider
+ ;; i1 = [1, 2];
+ ;; i2 = i1(1) + i3 + i4(i3);
+ ;; we know i1 and i2 are varialbles from the (assignment left: (identifier))
+ ;; However, we don't know if i3 or i4 are variables or functions because a
function
+ ;; can be called with no arguments, e.g. to call i3 function use i3 or
i3(). i4 could
+ ;; be a variable indexed by i1 or a function.
+ ;;
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_variable.m
:language 'matlab
:feature 'variable
'((assignment left: (identifier) @font-lock-variable-name-face)
@@ -583,6 +631,7 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
'((command_argument) @matlab-ts-mode-command-arg-face)
;; F-Rule: system and command dual commands.
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_command.m
:language 'matlab
:feature 'command-name
'(((command_name) @matlab-ts-mode-system-command-face
@@ -593,6 +642,7 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
((command (command_name) @font-lock-function-call-face
(command_argument))))
;; F-Rule: strings "double quote" and 'single quote'
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_strings.m
:language 'matlab
:feature 'string
'((string_content) @font-lock-string-face
@@ -607,7 +657,8 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
;; F-rule: operators: *, /, +, -, etc.
;; Note, this rule must come after the string rule because single quote (')
can be a transpose or
- ;; string delimiter
+ ;; string delimiter.
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_operators.m
:language 'matlab
:feature 'operator
`([,@matlab-ts-mode--operators] @matlab-ts-mode-operator-face)
@@ -623,47 +674,53 @@ than the FILED-EXPRESSION-NODE start-point and end-point."
eol))
@font-lock-type-face)))
- ;; TODO matlab-math-face for true/false or font-lock-constant-face like
c++-ts-mode? see
+ ;; F-Rule: Constant literal numbers, e.g. 1234, 12.34, 10e10
+ ;; We could use this for items like true, false, pi, etc. See some of these
numbers in:
;;
https://www.mathworks.com/content/dam/mathworks/fact-sheet/matlab-basic-functions-reference.pdf
- ;; - has special variables and constants, matlab.el has others
-
- ;; F-Rule: Constant literal numbers, e.g. 1234
- ;; TODO use font-lock-number-face like c++-ts-mode or make a
matlab-ts-mode-number-face
+ ;; however, they do show up as builtins, which to me seems more accurate.
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers.m
:language 'matlab
:feature 'number
- '((number) @font-lock-constant-face)
+ '((number) @matlab-ts-mode-number-face)
;; F-Rule: Brackets
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets.m
:language 'matlab
:feature 'bracket
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
;; F-Rule: Delimiters, e.g. semicolon
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters.m
:language 'matlab
:feature 'delimiter
'((["." "," ":" ";"]) @font-lock-delimiter-face)
+ ;; F-Rule: factory items that come with MATLAB, Simulink, or add-on products
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_namespaces.m
:language 'matlab
:feature 'builtins
`(((identifier) @font-lock-builtin-face
(:pred matlab-ts-mode--is-builtin @font-lock-builtin-face)))
+ ;; F-Rule: namespaces (the +dir's, class methods, etc.)
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_namespaces.m
:language 'matlab
:feature 'namespace-builtins
:override t
`((field_expression) @matlab-ts-mode--namespace-builtins-capture)
;; F-Rule: Syntax errors
- ;; TODO - This captures too much at times, see
- ;; test-matlab-ts-mode-font-lock-files/font_lock_error.m
- ;; Can we do better? Should we not activate this by default?
- ;; What about narrowing what is shown and if too much, then do
nothing?
- ;; Play with genBuiltinsHashTable.m adding syntax errors.
+ ;; Some errors span too much of the buffer's text, so one will probably not
want this
+ ;; enabled. Perhaps, once
https://github.com/acristoffers/tree-sitter-matlab/issues/36
+ ;; is fixed we can enable this, though a lot more testing is needed.
+ ;;
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_error.m
+ ;; See: tests/test-matlab-ts-mode-font-lock-files/font_lock_error_small.m
+ ;; See:
tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation.m
:language 'matlab
:feature 'syntax-error
:override t
'((ERROR) @font-lock-warning-face)
-
)
"The matlab-ts-mode font-lock settings.")
@@ -1221,7 +1278,7 @@ is t, add the following to an Init File (e.g.
`user-init-file' or
(setq-local treesit-font-lock-level matlab-ts-mode-font-lock-level)
(setq-local treesit-font-lock-settings matlab-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list
- '((comment comment-special comment-marker definition)
+ '((comment comment-special comment-marker definition
fcn-name-value)
(keyword operator string escape-sequence type command-name
command-arg)
(variable builtins namespace-builtins number bracket
delimiter)
(syntax-error)))
@@ -1261,18 +1318,7 @@ is t, add the following to an Init File (e.g.
`user-init-file' or
;; Electric pair mode. See tests/test-matlab-ts-mode-electric-pair.el
(setq-local electric-pair-inhibit-predicate
#'matlab-ts-mode--electric-pair-inhibit-predicate)
- ;; TODO For font-lock reference tests
;; TODO Highlight parens OR if/end type blocks
- ;; TODO face for all built-in functions such as dbstop, quit, sin, etc.
- ;; - maintenance/genBuiltinsHashTable.m
- ;; Add namespaces
- ;;
https://stackoverflow.com/questions/51942464/programmatically-return-a-list-of-all-functions/51946257
- ;; TODO in matlab-ts-mode--builtins, add size to ht definition
- ;; TODO font-lock param=value pairs
- ;; writelines(out, outFile, LineEnding = '\n');
- ;; ==> (arguments argument: (identifier) , argument: (identifier)
, (identifier) =
- ;; (string ' (escape_sequence) '))
- ;;
;; TODO code folding
(treesit-major-mode-setup)))
diff --git a/tests/t-utils.el b/tests/t-utils.el
index 88e51f63f9..6eeb5d2ac8 100644
--- a/tests/t-utils.el
+++ b/tests/t-utils.el
@@ -498,9 +498,6 @@ where int and void are keywords, etc. and CODE-TO-FACE
contains:
xxx give example calling test-name.el (and for others)"
- (when (boundp 'treesit-font-lock-level)
- (setq treesit-font-lock-level 4))
-
(let ((face-to-code (mapcar (lambda (pair)
(cons (cdr pair) (car pair)))
code-to-face)))
diff --git a/tests/test-matlab-ts-mode-font-lock-files/MyClass.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass.m
similarity index 95%
rename from tests/test-matlab-ts-mode-font-lock-files/MyClass.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass.m
index 920d910ea9..3c6bfcebe9 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MyClass.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef MyClass
+classdef font_lock_MyClass
% help comment
% comment about properities
diff --git a/tests/test-matlab-ts-mode-font-lock-files/MyClass_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass_expected.txt
similarity index 95%
rename from tests/test-matlab-ts-mode-font-lock-files/MyClass_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass_expected.txt
index ebd4537d3e..18f194f43c 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MyClass_expected.txt
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MyClass_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk fffffff
+kkkkkkkk fffffffffffffffff
h hhhh hhhhhhh
c ccccccc ccccc ccccccccccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/MySubclass.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass.m
similarity index 92%
rename from tests/test-matlab-ts-mode-font-lock-files/MySubclass.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass.m
index 6ec1cc08bb..133166b219 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MySubclass.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef MySubclass < ParentClass
+classdef font_lock_MySubClass < ParentClass
% help comment
properties
MyProperty double = 0; % Public property with a default value
diff --git a/tests/test-matlab-ts-mode-font-lock-files/MySubclass_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass_expected.txt
similarity index 92%
rename from tests/test-matlab-ts-mode-font-lock-files/MySubclass_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass_expected.txt
index 789898e23a..39b325549f 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MySubclass_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubClass_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffff o fffffffffff
+kkkkkkkk ffffffffffffffffffff o fffffffffff
h hhhh hhhhhhh
kkkkkkkkkk
PPPPPPPPPP tttttt o nD c cccccc cccccccc cccc c ccccccc ccccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/MySubSubClass.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass.m
similarity index 89%
rename from tests/test-matlab-ts-mode-font-lock-files/MySubSubClass.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass.m
index fce0d47244..962577a3bd 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MySubSubClass.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef MySubClass < ParentClass1 & ParentClass2
+classdef font_lock_MySubSubClass < ParentClass1 & ParentClass2
% help comment
properties
MyProperty double = 0; % Public property with a default value
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/MySubSubClass_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass_expected.txt
similarity index 89%
rename from tests/test-matlab-ts-mode-font-lock-files/MySubSubClass_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass_expected.txt
index be4a9ec75b..67676949df 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/MySubSubClass_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_MySubSubClass_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffff o ffffffffffff o ffffffffffff
+kkkkkkkk fffffffffffffffffffffff o ffffffffffff o ffffffffffff
h hhhh hhhhhhh
kkkkkkkkkk
PPPPPPPPPP tttttt o nD c cccccc cccccccc cccc c ccccccc ccccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets.m
new file mode 100644
index 0000000000..cdd1a7a071
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+a = [1, 2; ...
+ 3, 4];
+
+b = {1, 2, [3, 4, ...
+ 5, 6]);
+
+c = a(1,1);
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets_expected.txt
new file mode 100644
index 0000000000..85a5b3e11f
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_brackets_expected.txt
@@ -0,0 +1,9 @@
+c ccc ccccccccc ccc
+
+v o bnD nD ccc
+ nD nbD
+
+w w www ww www ww www
+ ww wwww
+
+w w wwwwwww
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks.m
similarity index 80%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks.m
index eeabc5caa8..a246e983b9 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks.m
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef MultiplePropBlocks
+classdef font_lock_class_MultiplePropBlocks
properties (SetAccess = private, GetAccess = {?OtherClass})
Property1
Property2
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks_expected.txt
similarity index 80%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks_expected.txt
index 35051e461b..c993c46699 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_MultiplePropBlocks_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_MultiplePropBlocks_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffffffffffff
+kkkkkkkk ffffffffffffffffffffffffffffffffff
kkkkkkkkkk bttttttttt o BBBBBBBD ttttttttt o boddddddddddbb
PPPPPPPPP
PPPPPPPPP
diff --git a/tests/test-matlab-ts-mode-font-lock-files/attributeDemo.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes.m
similarity index 89%
rename from tests/test-matlab-ts-mode-font-lock-files/attributeDemo.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes.m
index d915b5c901..f50b49c852 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/attributeDemo.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes.m
@@ -1,6 +1,6 @@
% -*- matlab-ts -*-
% See https://github.com/acristoffers/tree-sitter-matlab/issues/29
-classdef attributeDemo
+classdef font_lock_class_attributes
methods (Access = protected)
function out = method1(obj,inputArg)
...
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/attributeDemo_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes_expected.txt
similarity index 89%
rename from tests/test-matlab-ts-mode-font-lock-files/attributeDemo_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes_expected.txt
index 00d63fb5b0..7c61a1036c 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/attributeDemo_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_attributes_expected.txt
@@ -1,6 +1,6 @@
c ccc ccccccccc ccc
c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-kkkkkkkk fffffffffffff
+kkkkkkkk ffffffffffffffffffffffffff
kkkkkkk btttttt o BBBBBBBBBb
kkkkkkkk vvv o fffffffbvvvDvvvvvvvvb
ccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_enum.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum.m
similarity index 71%
rename from tests/test-matlab-ts-mode-font-lock-files/test_enum.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum.m
index dee39a74bc..c08e4bb347 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_enum.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef test_enum < int32
+classdef font_lock_class_enum < int32
enumeration
Low (0)
Medium (1)
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_enum_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum_expected.txt
similarity index 71%
rename from tests/test-matlab-ts-mode-font-lock-files/test_enum_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum_expected.txt
index 6e599c314c..1774756d33 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_enum_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_enum_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk fffffffff o fffff
+kkkkkkkk ffffffffffffffffffff o fffff
kkkkkkkkkkk
PPP bnb
PPPPPP bnb
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_events.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events.m
similarity index 79%
rename from tests/test-matlab-ts-mode-font-lock-files/test_classdef_events.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events.m
index 3de94593ba..494e83a6a0 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_events.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef test_classdef_events < handle
+classdef font_lock_class_events < handle
events
StateChange
end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_events_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events_expected.txt
similarity index 79%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_classdef_events_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events_expected.txt
index f8ebe4b8a6..fba258f9fb 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_events_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_events_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffffffffffffff o ffffff
+kkkkkkkk ffffffffffffffffffffff o ffffff
kkkkkk
PPPPPPPPPPP
kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_methods.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods.m
similarity index 86%
rename from tests/test-matlab-ts-mode-font-lock-files/test_methods.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods.m
index 4bf39f001b..b8e51da9ba 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_methods.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef test_methods
+classdef font_lock_class_methods
methods (Access = protected)
function out = method1(obj,inputArg)
end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_methods_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods_expected.txt
similarity index 86%
rename from tests/test-matlab-ts-mode-font-lock-files/test_methods_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods_expected.txt
index 4d7ea8084f..21403acc89 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_methods_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_methods_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffffff
+kkkkkkkk fffffffffffffffffffffff
kkkkkkk btttttt o BBBBBBBBBb
kkkkkkkk vvv o fffffffbvvvDvvvvvvvvb
kkk
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access.m
similarity index 78%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access.m
index 0b7d5af6ea..b95973f814 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef test_classdef_PropertyAccess
+classdef font_lock_class_prop_access
properties (GetAccess = {?ClassA, ?ClassB})
Prop1
end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access_expected.txt
similarity index 78%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access_expected.txt
index e53b0331ac..ceae6e6c67 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/test_classdef_PropertyAccess_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_prop_access_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffffffffffffffffffffff
+kkkkkkkk fffffffffffffffffffffffffff
kkkkkkkkkk bttttttttt o boddddddD oddddddbb
PPPPP
kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/Prop.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties.m
similarity index 84%
rename from tests/test-matlab-ts-mode-font-lock-files/Prop.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties.m
index 5e21e05dd9..6269fa37f6 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/Prop.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef Prop
+classdef font_lock_class_properties
properties
p0
p1 double;
diff --git a/tests/test-matlab-ts-mode-font-lock-files/Prop_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties_expected.txt
similarity index 84%
rename from tests/test-matlab-ts-mode-font-lock-files/Prop_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties_expected.txt
index a203df281a..39b3a2b1ac 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/Prop_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_class_properties_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffff
+kkkkkkkk ffffffffffffffffffffffffff
kkkkkkkkkk
PP
PP ttttttD
diff --git a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation.m
new file mode 100644
index 0000000000..2402f2db33
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation.m
@@ -0,0 +1,5 @@
+% -*- matlab-ts -*-
+
+a = ...
+ ... text here is a comment too
+ 1;
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_expected.txt
new file mode 100644
index 0000000000..d277f1b772
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_expected.txt
@@ -0,0 +1,5 @@
+c ccc ccccccccc ccc
+
+v o ccc
+ ccc cccc cccc cc c ccccccc ccc
+ nD
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn.m
new file mode 100644
index 0000000000..7bebdcaadd
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn.m
@@ -0,0 +1,11 @@
+% -*- matlab-ts -*-
+function [ ...
+ out1, ... comment for out1
+ out2 ... comment for out2
+ ] = test_continuation( ...
+ in1, ... comment for in1
+ in2 ... comment for in2
+ )
+ out1 = in1;
+ out2 = in2;
+end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_expected.txt
new file mode 100644
index 0000000000..0a299f6510
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_expected.txt
@@ -0,0 +1,11 @@
+c ccc ccccccccc ccc
+kkkkkkkk b ccc
+ vvvvD ccc ccccccc ccc cccc
+ vvvv ccc ccccccc ccc cccc
+ b o fffffffffffffffffb ccc
+ vvvD ccc ccccccc ccc ccc
+ vvv ccc ccccccc ccc ccc
+ b
+ vvvv o dddD
+ vvvv o dddD
+kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/g2.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_g2.m
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/g2.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_g2.m
diff --git a/tests/test-matlab-ts-mode-font-lock-files/g2_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_g2_expected.txt
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/g2_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_fcn_g2_expected.txt
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn.m
new file mode 100644
index 0000000000..09a71036df
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn.m
@@ -0,0 +1,11 @@
+% -*- mode: matlab-ts -*-
+function [ ...
+ out1 ... % comment for out1
+ out2 ... % comment for out2
+ ] = ...
+ font_lock_continuation_multiArgFcn(in1, ... % comment for in1
+ in2 ... % comment for in2
+ )
+ out1 = in1;
+ out2 = in2;
+end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn_expected.txt
new file mode 100644
index 0000000000..f8e00e0e79
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_continuation_multiArgFcn_expected.txt
@@ -0,0 +1,11 @@
+c ccc ccccc ccccccccc ccc
+kkkkkkkk b ccc
+ vvvv ccc c ccccccc ccc cccc
+ vvvv ccc c ccccccc ccc cccc
+ b o ccc
+ ffffffffffffffffffffffffffffffffffbvvvD ccc c ccccccc ccc ccc
+ vvv ccc c ccccccc ccc ccc
+ b
+ vvvv o dddD
+ vvvv o dddD
+kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters.m
new file mode 100644
index 0000000000..979cc3f35b
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters.m
@@ -0,0 +1,9 @@
+% -*- matlab-ts -*-
+
+foo.bar = 1;
+
+a = (1, 2);
+
+x = 1:10;
+
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters_expected.txt
new file mode 100644
index 0000000000..00f5249446
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_delimiters_expected.txt
@@ -0,0 +1,9 @@
+c ccc ccccccccc ccc
+
+dddDddd o nD
+
+v o bnD nwD
+
+v o nDnnD
+
+
diff --git a/tests/test-matlab-ts-mode-font-lock-files/FlowRate.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate.m
similarity index 82%
rename from tests/test-matlab-ts-mode-font-lock-files/FlowRate.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate.m
index f6c12cf3d5..b053e604b6 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/FlowRate.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate.m
@@ -1,6 +1,6 @@
% -*- matlab-ts -*-
% See https://github.com/acristoffers/tree-sitter-matlab/issues/28
-classdef FlowRate < int32
+classdef font_lock_enum_FlowRate < int32
enumeration
Low (10)
Medium (FlowRate.Low*5)
diff --git a/tests/test-matlab-ts-mode-font-lock-files/FlowRate_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate_expected.txt
similarity index 82%
rename from tests/test-matlab-ts-mode-font-lock-files/FlowRate_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate_expected.txt
index ccd1a15671..9ee389b96b 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/FlowRate_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_enum_FlowRate_expected.txt
@@ -1,6 +1,6 @@
c ccc ccccccccc ccc
c ccc cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
-kkkkkkkk ffffffff o fffff
+kkkkkkkk fffffffffffffffffffffff o fffff
kkkkkkkkkkk
PPP bnnb
PPPPPP bddddddddDdddonb
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation.m
similarity index 57%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation.m
index 4e812eae1b..ffe877454f 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation.m
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation.m
@@ -1,8 +1,8 @@
% -*- matlab-ts -*-
% Missing continuation should result in (ERROR) nodes
% Continuation "..." is needed after the "(" and after the "in1".
-function test_missing_continuation(
- in
- )
+function font_lock_error_missing_continuation(
+ in
+ )
disp(num2str(in));
end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation_expected.txt
similarity index 57%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation_expected.txt
index 324318207c..c24aa5876b 100644
---
a/tests/test-matlab-ts-mode-font-lock-files/test_missing_continuation_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_missing_continuation_expected.txt
@@ -1,8 +1,8 @@
c ccc ccccccccc ccc
c ccccccc cccccccccccc cccccc cccccc cc ccccccc ccccc
c cccccccccccc ccccc cc cccccc ccccc ccc ccc ccc ccccc ccc cccccc
-kkkkkkkk fffffffffffffffffffffffffb
- vv
- b
+kkkkkkkk ffffffffffffffffffffffffffffffffffffb
+ vv
+ b
BBBBbBBBBBBBbddbbD
kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_errors.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_small.m
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/test_errors.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_error_small.m
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_errors_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_error_small_expected.txt
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/test_errors_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_error_small_expected.txt
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_arguments.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments.m
similarity index 82%
rename from tests/test-matlab-ts-mode-font-lock-files/test_arguments.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments.m
index 7c1a18f351..5267d75508 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_arguments.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-function test_arguments(in1, properties, options)
+function font_lock_fcn_arguments(in1, properties, options)
arguments
in1 (1,:) {mustBeNumeric}
properties double
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_arguments_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments_expected.txt
similarity index 82%
rename from
tests/test-matlab-ts-mode-font-lock-files/test_arguments_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments_expected.txt
index 7b2a2e6268..fe81d4f8a4 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/test_arguments_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_arguments_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffffffffffbvvvD vvvvvvvvvvD vvvvvvvb
+kkkkkkkk fffffffffffffffffffffffbvvvD vvvvvvvvvvD vvvvvvvb
kkkkkkkkk
PPP bnDDb bBBBBBBBBBBBBBb
PPPPPPPPPP tttttt
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties.m
new file mode 100644
index 0000000000..3fa2c2d5c8
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties.m
@@ -0,0 +1,6 @@
+% -*- matlab-ts -*-
+
+outFile = 'out.txt';
+lines = ['line1\n', 'line2\n'];
+
+writelines(lines, outFile, LineEnding = '\n');
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties_expected.txt
new file mode 100644
index 0000000000..b01f55ba94
--- /dev/null
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_name_value_properties_expected.txt
@@ -0,0 +1,6 @@
+c ccc ccccccccc ccc
+
+vvvvvvv o SsssssssSD
+vvvvv o bSsssssEESD SsssssEESbD
+
+BBBBBBBBBBbBBBBBD dddddddD PPPPPPPPPP o SEESbD
diff --git a/tests/test-matlab-ts-mode-font-lock-files/small_in_args.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_in_args.m
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/small_in_args.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_in_args.m
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/small_in_args_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_in_args_expected.txt
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/small_in_args_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_in_args_expected.txt
diff --git a/tests/test-matlab-ts-mode-font-lock-files/small_no_args.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args.m
similarity index 69%
rename from tests/test-matlab-ts-mode-font-lock-files/small_no_args.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args.m
index 208e269f5c..b8d4419271 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/small_no_args.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args.m
@@ -1,5 +1,5 @@
% -*- mode: matlab-ts -*-
-function small_no_args
+function font_lock_fcn_small_no_args
% help comment
% code comment
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/small_no_args_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args_expected.txt
similarity index 69%
rename from tests/test-matlab-ts-mode-font-lock-files/small_no_args_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args_expected.txt
index 98bc9b72cf..7b8db9ab63 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/small_no_args_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_no_args_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccc ccccccccc ccc
-kkkkkkkk fffffffffffff
+kkkkkkkk fffffffffffffffffffffffffff
h hhhh hhhhhhh
c cccc ccccccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/small_out_args.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args.m
similarity index 62%
rename from tests/test-matlab-ts-mode-font-lock-files/small_out_args.m
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args.m
index a2c74c3058..7800281913 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/small_out_args.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args.m
@@ -1,5 +1,5 @@
% -*- mode: matlab-ts -*-
-function out = small_out_args()
+function out = font_lock_fcn_small_out_args()
% help comment
% code comment
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/small_out_args_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args_expected.txt
similarity index 62%
rename from
tests/test-matlab-ts-mode-font-lock-files/small_out_args_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args_expected.txt
index 420a4c6cea..c924695173 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/small_out_args_expected.txt
+++
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_fcn_small_out_args_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccc ccccccccc ccc
-kkkkkkkk vvv o ffffffffffffffbb
+kkkkkkkk vvv o ffffffffffffffffffffffffffffbb
h hhhh hhhhhhh
c cccc ccccccc
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_spmd.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keyword_spmd.m
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/test_spmd.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_keyword_spmd.m
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_spmd_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keyword_spmd_expected.txt
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/test_spmd_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_keyword_spmd_expected.txt
diff --git a/tests/test-matlab-ts-mode-font-lock-files/keywords.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords.m
similarity index 97%
rename from tests/test-matlab-ts-mode-font-lock-files/keywords.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords.m
index 42281184e5..90a67cffb6 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/keywords.m
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords.m
@@ -1,5 +1,5 @@
% -*- matlab-ts -*-
-classdef keywords
+classdef font_lock_keywords
properties
p1 = 0
end
diff --git a/tests/test-matlab-ts-mode-font-lock-files/keywords_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords_expected.txt
similarity index 97%
rename from tests/test-matlab-ts-mode-font-lock-files/keywords_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords_expected.txt
index 5ae0e7919d..60c94d7e98 100644
--- a/tests/test-matlab-ts-mode-font-lock-files/keywords_expected.txt
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_keywords_expected.txt
@@ -1,5 +1,5 @@
c ccc ccccccccc ccc
-kkkkkkkk ffffffff
+kkkkkkkk ffffffffffffffffff
kkkkkkkkkk
PP o n
kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers.m
new file mode 100644
index 0000000000..85c3655043
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers.m
@@ -0,0 +1,8 @@
+% -*- matlab-ts -*-
+
+a = 12.34;
+
+b = 3;
+
+c = 3e10;
+
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_expected.txt
new file mode 100644
index 0000000000..696c9a9148
--- /dev/null
+++ b/tests/test-matlab-ts-mode-font-lock-files/font_lock_numbers_expected.txt
@@ -0,0 +1,8 @@
+c ccc ccccccccc ccc
+
+v o nnnnnD
+
+v o nD
+
+v o nnnnD
+
diff --git a/tests/test-matlab-ts-mode-font-lock-files/my_fcn.m
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_pragma_in_fcn.m
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/my_fcn.m
rename to tests/test-matlab-ts-mode-font-lock-files/font_lock_pragma_in_fcn.m
diff --git a/tests/test-matlab-ts-mode-font-lock-files/my_fcn_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/font_lock_pragma_in_fcn_expected.txt
similarity index 100%
rename from tests/test-matlab-ts-mode-font-lock-files/my_fcn_expected.txt
rename to
tests/test-matlab-ts-mode-font-lock-files/font_lock_pragma_in_fcn_expected.txt
diff --git a/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn.m
b/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn.m
deleted file mode 100644
index 295b40afdf..0000000000
--- a/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn.m
+++ /dev/null
@@ -1,11 +0,0 @@
-% -*- mode: matlab-ts -*-
-function [ ...
- out1 ... % comment for out1
- out2 ... % comment for out2
- ] = ...
- multiArgFcn(in1, ... % comment for in1
- in2 ... % comment for in2
- )
- out1 = in1;
- out2 = in2;
-end
diff --git a/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn_expected.txt
deleted file mode 100644
index 3f9594975b..0000000000
--- a/tests/test-matlab-ts-mode-font-lock-files/multiArgFcn_expected.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-c ccc ccccc ccccccccc ccc
-kkkkkkkk b ccc
- vvvv ccc c ccccccc ccc cccc
- vvvv ccc c ccccccc ccc cccc
- b o ccc
- fffffffffffbvvvD ccc c ccccccc ccc ccc
- vvv ccc c ccccccc ccc ccc
- b
- vvvv o dddD
- vvvv o dddD
-kkk
diff --git a/tests/test-matlab-ts-mode-font-lock-files/test_continuation.m
b/tests/test-matlab-ts-mode-font-lock-files/test_continuation.m
deleted file mode 100644
index bb2ef953a9..0000000000
--- a/tests/test-matlab-ts-mode-font-lock-files/test_continuation.m
+++ /dev/null
@@ -1,11 +0,0 @@
-% -*- matlab-ts -*-
-function [ ...
- out1, ... comment for out1
- out2 ... comment for out2
- ] = test_continuation( ...
- in1, ... comment for in1
- in2 ... comment for in2
- )
- out1 = in1;
- out2 = in2;
-end
diff --git
a/tests/test-matlab-ts-mode-font-lock-files/test_continuation_expected.txt
b/tests/test-matlab-ts-mode-font-lock-files/test_continuation_expected.txt
deleted file mode 100644
index 5fd3c6f187..0000000000
--- a/tests/test-matlab-ts-mode-font-lock-files/test_continuation_expected.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-c ccc ccccccccc ccc
-kkkkkkkk b ccc
- vvvvD ccc ccccccc ccc cccc
- vvvv ccc ccccccc ccc cccc
- b o fffffffffffffffffb ccc
- vvvD ccc ccccccc ccc ccc
- vvv ccc ccccccc ccc ccc
- b
- vvvv o dddD
- vvvv o dddD
-kkk
diff --git a/tests/test-matlab-ts-mode-font-lock.el
b/tests/test-matlab-ts-mode-font-lock.el
index 9f32916019..5514a24e89 100644
--- a/tests/test-matlab-ts-mode-font-lock.el
+++ b/tests/test-matlab-ts-mode-font-lock.el
@@ -46,7 +46,8 @@ and run this function. The baseline is saved for you as
after validating it, rename it to
./test-matlab-ts-mode-font-lock-files/NAME_expected.m"
- (let ((test-name "test-matlab-ts-mode-font-lock"))
+ (let ((test-name "test-matlab-ts-mode-font-lock")
+ (matlab-ts-mode-font-lock-level 4))
(when (not (t-utils-is-treesit-available 'matlab test-name))
(cl-return-from test-matlab-ts-mode-font-lock))
@@ -64,10 +65,10 @@ after validating it, rename it to
("f" . font-lock-function-name-face)
("F" . font-lock-function-call-face)
("h" . font-lock-doc-face) ;; function doc help
comment
- ("H" . matlab-ts-mode-comment-heading-face) ;; %%
comment heading
+ ("H" . matlab-ts-mode-comment-heading-face)
("k" . font-lock-keyword-face)
("M" . matlab-ts-mode-comment-to-do-marker-face)
- ("n" . font-lock-constant-face) ;; numbers
+ ("n" . matlab-ts-mode-number-face)
("s" . font-lock-string-face)
("S" . matlab-ts-mode-string-delimiter-face)
("o" . matlab-ts-mode-operator-face)