|
47 | 47 |
|
48 | 48 | "~" @constant.builtin |
49 | 49 |
|
| 50 | +; Literals |
| 51 | + |
| 52 | +(escape_sequence) @escape |
| 53 | +(formatting_sequence) @escape |
| 54 | +(string) @string |
| 55 | +(number) @number |
| 56 | +(boolean) @constant.builtin |
| 57 | + |
| 58 | +; Punctuation |
| 59 | + |
| 60 | +[ ";" "," "." ] @punctuation.delimiter |
| 61 | +[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket |
| 62 | + |
| 63 | +; Operators |
| 64 | + |
| 65 | +(unary_operator ["+" "-"] @number) |
| 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 | +] @operator |
| 97 | + |
50 | 98 | ; Fields/Properties |
51 | 99 |
|
52 | | -(field_expression field: (identifier) @property) |
| 100 | +(field_expression object: (identifier) @variable) |
| 101 | +(field_expression field: (identifier) @variable.parameter) |
53 | 102 | (superclass "." (identifier) @property) |
54 | 103 | (property_name "." (identifier) @property) |
55 | 104 | (property name: (identifier) @property) |
|
70 | 119 | (function_signature name: (identifier) @function) |
71 | 120 |
|
72 | 121 | (function_call name: (identifier) @function.call) |
| 122 | +(function_call (arguments) @variable.parameter) |
73 | 123 |
|
74 | 124 | (handle_operator (identifier) @function) |
75 | 125 | (validation_functions (identifier) @function) |
|
87 | 137 | ; Conditionals |
88 | 138 |
|
89 | 139 | (if_statement [ "if" "end" ] @keyword) |
| 140 | +(if_statement (identifier) @variable) |
90 | 141 | (elseif_clause "elseif" @keyword) |
91 | 142 | (else_clause "else" @keyword) |
92 | 143 | (switch_statement [ "switch" "end" ] @keyword) |
| 144 | +(switch_statement (identifier) @variable) |
93 | 145 | (case_clause "case" @keyword) |
94 | 146 | (otherwise_clause "otherwise" @keyword) |
95 | 147 | (break_statement) @keyword |
96 | 148 |
|
97 | 149 | ; Repeats |
98 | 150 |
|
99 | 151 | (for_statement [ "for" "parfor" "end" ] @keyword) |
| 152 | +(for_statement (iterator (identifier) @variable)) |
100 | 153 | (while_statement [ "while" "end" ] @keyword) |
101 | 154 | (continue_statement) @keyword |
102 | 155 |
|
|
105 | 158 | (try_statement [ "try" "end" ] @keyword) |
106 | 159 | (catch_clause "catch" @keyword) |
107 | 160 |
|
108 | | -; Punctuation |
109 | | - |
110 | | -[ ";" "," "." ] @punctuation.delimiter |
111 | | -[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket |
112 | | - |
113 | | -; Literals |
114 | | - |
115 | | -(escape_sequence) @escape |
116 | | -(formatting_sequence) @escape |
117 | | -(string) @string |
118 | | -(number) @number |
119 | | -(boolean) @constant.builtin |
120 | | - |
121 | 161 | ; Comments |
122 | 162 |
|
123 | 163 | [ (comment) (line_continuation) ] @comment @spell |
124 | 164 |
|
125 | | -; Operators |
126 | | - |
127 | | -(unary_operator ["+" "-"] @number) |
128 | | - |
129 | | -[ |
130 | | - "+" |
131 | | - ".+" |
132 | | - "-" |
133 | | - ".*" |
134 | | - "*" |
135 | | - ".*" |
136 | | - "/" |
137 | | - "./" |
138 | | - "\\" |
139 | | - ".\\" |
140 | | - "^" |
141 | | - ".^" |
142 | | - "'" |
143 | | - ".'" |
144 | | - "|" |
145 | | - "&" |
146 | | - "?" |
147 | | - "@" |
148 | | - "<" |
149 | | - "<=" |
150 | | - ">" |
151 | | - ">=" |
152 | | - "==" |
153 | | - "~=" |
154 | | - "=" |
155 | | - "&&" |
156 | | - "||" |
157 | | - ":" |
158 | | -] @operator |
159 | | - |
160 | 165 | ; Assignments |
161 | 166 |
|
162 | 167 | (assignment left: (_) @variable) |
| 168 | +(assignment right: (_) @variable) |
163 | 169 | (multioutput_variable (_) @variable) |
164 | 170 |
|
165 | 171 | ; Keywords |
166 | | - |
167 | 172 | [ |
168 | 173 | "arguments" |
169 | 174 | "classdef" |
|
176 | 181 | "properties" |
177 | 182 | ] @keyword |
178 | 183 |
|
| 184 | +; Binary operation |
| 185 | +(binary_operator) @variable |
0 commit comments