aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/matlab/highlights.scm
blob: 875cba5097727bd67d3ee1492b0ed755c8dbc321 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
; Constants

(events (identifier) @constant)
(attribute (identifier) @constant)

"~" @constant.builtin

; Fields/Properties

(superclass "." (identifier) @variable.other.member)
(property_name "." (identifier) @variable.other.member)
(property name: (identifier) @variable.other.member)

; Types

(class_definition name: (identifier) @keyword.storage.type)
(attributes (identifier) @constant)
(enum . (identifier) @type.enum.variant)

; Functions

(function_definition
  "function" @keyword.function
  name: (identifier) @function
  [ "end" "endfunction" ]? @keyword.function)

(function_signature name: (identifier) @function)
(function_call name: (identifier) @function)
(handle_operator (identifier) @function)
(validation_functions (identifier) @function)
(command (command_name) @function.macro)
(command_argument) @string
(return_statement) @keyword.control.return

; Assignments

(assignment left: (_) @variable)
(multioutput_variable (_) @variable)

; Parameters

(function_arguments (identifier) @variable.parameter)

; Conditionals

(if_statement [ "if" "end" ] @keyword.control.conditional)
(elseif_clause "elseif" @keyword.control.conditional)
(else_clause "else" @keyword.control.conditional)
(switch_statement [ "switch" "end" ] @keyword.control.conditional)
(case_clause "case" @keyword.control.conditional)
(otherwise_clause "otherwise" @keyword.control.conditional)
(break_statement) @keyword.control.conditional

; Repeats

(for_statement [ "for" "parfor" "end" ] @keyword.control.repeat)
(while_statement [ "while" "end" ] @keyword.control.repeat)
(continue_statement) @keyword.control.repeat

; Exceptions

(try_statement [ "try" "end" ] @keyword.control.exception)
(catch_clause "catch" @keyword.control.exception)

; Punctuation

[ ";" "," "." ] @punctuation.delimiter
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket

; Literals

(escape_sequence) @constant.character.escape
(formatting_sequence) @constant.character.escape
(string) @string
(number) @constant.numeric.float
(unary_operator ["+" "-"] @constant.numeric.float)
(boolean) @constant.builtin.boolean

; Comments

[ (comment) (line_continuation) ] @comment.line

; Operators

[
  "+"
  ".+"
  "-"
  ".*"
  "*"
  ".*"
  "/"
  "./"
  "\\"
  ".\\"
  "^"
  ".^"
  "'"
  ".'"
  "|"
  "&"
  "?"
  "@"
  "<"
  "<="
  ">"
  ">="
  "=="
  "~="
  "="
  "&&"
  "||"
  ":"
] @operator

; Keywords

"classdef" @keyword.storage.type
[
  "arguments"
  "end"
  "enumeration"
  "events"
  "global"
  "methods"
  "persistent"
  "properties"
] @keyword