@@ -1,97 +1,127 @@
1− ; highlights.scm
1+; Constants
22
3−function_keyword: (function_keyword) @keyword.function
3+(events (identifier) @constant)
4+(attribute (identifier) @constant)
45
5−(function_definition
6−function_name: (identifier) @function
7−(end) @function)
6+"~" @constant.builtin
87
9−(parameter_list (identifier) @variable.parameter)
8+; Fields/Properties
109
11−[
12− "if"
13− "elseif"
14− "else"
15− "switch"
16− "case"
17− "otherwise"
18−] @keyword.control.conditional
10+(superclass "." (identifier) @variable.other.member)
11+(property_name "." (identifier) @variable.other.member)
12+(property name: (identifier) @variable.other.member)
1913
20−(if_statement (end) @keyword.control.conditional)
21−(switch_statement (end) @keyword.control.conditional)
14+; Types
2215
23−["for" "while"] @keyword.control.repeat
24−(for_statement (end) @keyword.control.repeat)
25−(while_statement (end) @keyword.control.repeat)
16+(class_definition name: (identifier) @keyword.storage.type)
17+(attributes (identifier) @constant)
18+(enum . (identifier) @type.enum.variant)
2619
27−["try" "catch"] @keyword.control.exception
28−(try_statement (end) @keyword.control.exception)
20+; Functions
2921
30−(function_definition end: (end) @keyword)
22+(function_definition
23+ "function" @keyword.function
24+ name: (identifier) @function
25+ [ "end" "endfunction" ]? @keyword.function)
3126
32−["return" "break" "continue"] @keyword.return
27+(function_signature name: (identifier) @function)
28+(function_call name: (identifier) @function)
29+(handle_operator (identifier) @function)
30+(validation_functions (identifier) @function)
31+(command (command_name) @function.macro)
32+(command_argument) @string
33+(return_statement) @keyword.control.return
3334
34−(
35−(identifier) @constant.builtin
36−(#any-of? @constant.builtin "true" "false")
37−)
35+; Assignments
3836
39−(
40− (identifier) @constant.builtin
41− (#eq? @constant.builtin "end")
42−)
37+(assignment left: (_) @variable)
38+(multioutput_variable (_) @variable)
4339
44−;; Punctuations
40+; Parameters
4541
46−[";" ","] @punctuation.special
47−(argument_list "," @punctuation.delimiter)
48−(vector_definition ["," ";"] @punctuation.delimiter)
49−(cell_definition ["," ";"] @punctuation.delimiter)
50−":" @punctuation.delimiter
51−(parameter_list "," @punctuation.delimiter)
52−(return_value "," @punctuation.delimiter)
42+(function_arguments (identifier) @variable.parameter)
5343
54−; ;; Brackets
44+; Operators
5545
5646[
57− "("
58− ")"
59− "["
60− "]"
61− "{"
62− "}"
63−] @punctuation.bracket
64−
65−;; Operators
66−"=" @operator
67−(operation [ ">"
68− "<"
69− "=="
70− "<="
71− ">="
72− "=<"
73− "=>"
74− "~="
75− "*"
76− ".*"
77− "/"
78− "\\"
79− "./"
80− "^"
81− ".^"
82− "+"] @operator)
83−
84−;; boolean operator
85−[
86− "&&"
87− "||"
47+ "+"
48+ ".+"
49+ "-"
50+ ".*"
51+ "*"
52+ ".*"
53+ "/"
54+ "./"
55+ "\\"
56+ ".\\"
57+ "^"
58+ ".^"
59+ "'"
60+ ".'"
61+ "|"
62+ "&"
63+ "?"
64+ "@"
65+ "<"
66+ "<="
67+ ">"
68+ ">="
69+ "=="
70+ "~="
71+ "="
72+ "&&"
73+ "||"
74+ ":"
8875] @operator
8976
90−;; Number
91−(number) @constant.numeric
77+; Conditionals
78+
79+(if_statement [ "if" "end" ] @keyword.control.conditional)
80+(elseif_clause "elseif" @keyword.control.conditional)
81+(else_clause "else" @keyword.control.conditional)
82+(switch_statement [ "switch" "end" ] @keyword.control.conditional)
83+(case_clause "case" @keyword.control.conditional)
84+(otherwise_clause "otherwise" @keyword.control.conditional)
85+(break_statement) @keyword.control.conditional
86+
87+; Repeats
88+
89+(for_statement [ "for" "parfor" "end" ] @keyword.control.repeat)
90+(while_statement [ "while" "end" ] @keyword.control.repeat)
91+(continue_statement) @keyword.control.repeat
92+
93+; Exceptions
9294
93−;; String
95+(try_statement [ "try" "end" ] @keyword.control.exception)
96+(catch_clause "catch" @keyword.control.exception)
97+
98+; Punctuation
99+
100+[ ";" "," "." ] @punctuation.delimiter
101+[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
102+
103+; Literals
104+
105+(escape_sequence) @constant.character.escape
106+(formatting_sequence) @constant.character.escape
94107(string) @string
108+(number) @constant.numeric.float
109+(boolean) @constant.builtin.boolean
95110
96−;; Comment
97−(comment) @comment
111+; Comments
112+
113+[ (comment) (line_continuation) ] @comment.line
114+
115+; Keywords
116+
117+"classdef" @keyword.storage.type
118+[
119+ "arguments"
120+ "end"
121+ "enumeration"
122+ "events"
123+ "global"
124+ "methods"
125+ "persistent"
126+ "properties"
127+] @keyword