PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.2
Code Block Pro – Beautiful Syntax Highlighting v1.27.2
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / wgsl.tmLanguage.json

wgsl.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.27.2, at build/shiki/languages/wgsl.tmLanguage.json

391 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "name": "wgsl",
3 "scopeName": "source.wgsl",
4 "patterns": [
5 {
6 "include": "#line_comments"
7 },
8 {
9 "include": "#block_comments"
10 },
11 {
12 "include": "#keywords"
13 },
14 {
15 "include": "#attributes"
16 },
17 {
18 "include": "#functions"
19 },
20 {
21 "include": "#function_calls"
22 },
23 {
24 "include": "#constants"
25 },
26 {
27 "include": "#types"
28 },
29 {
30 "include": "#variables"
31 },
32 {
33 "include": "#punctuation"
34 }
35 ],
36 "repository": {
37 "line_comments": {
38 "comment": "single line comment",
39 "name": "comment.line.double-slash.wgsl",
40 "match": "\\s*//.*"
41 },
42 "block_comments": {
43 "patterns": [
44 {
45 "comment": "empty block comments",
46 "name": "comment.block.wgsl",
47 "match": "/\\*\\*/"
48 },
49 {
50 "comment": "block documentation comments",
51 "name": "comment.block.documentation.wgsl",
52 "begin": "/\\*\\*",
53 "end": "\\*/",
54 "patterns": [
55 {
56 "include": "#block_comments"
57 }
58 ]
59 },
60 {
61 "comment": "block comments",
62 "name": "comment.block.wgsl",
63 "begin": "/\\*(?!\\*)",
64 "end": "\\*/",
65 "patterns": [
66 {
67 "include": "#block_comments"
68 }
69 ]
70 }
71 ]
72 },
73 "attributes": {
74 "patterns": [
75 {
76 "comment": "attribute declaration",
77 "name": "meta.attribute.wgsl",
78 "match": "(@)([A-Za-z_]+)",
79 "captures": {
80 "1": {
81 "name": "keyword.operator.attribute.at"
82 },
83 "2": {
84 "name": "entity.name.attribute.wgsl"
85 }
86 }
87 }
88 ]
89 },
90 "functions": {
91 "patterns": [
92 {
93 "comment": "function definition",
94 "name": "meta.function.definition.wgsl",
95 "begin": "\\b(fn)\\s+([A-Za-z0-9_]+)((\\()|(<))",
96 "beginCaptures": {
97 "1": {
98 "name": "keyword.other.fn.wgsl"
99 },
100 "2": {
101 "name": "entity.name.function.wgsl"
102 },
103 "4": {
104 "name": "punctuation.brackets.round.wgsl"
105 }
106 },
107 "end": "\\{",
108 "endCaptures": {
109 "0": {
110 "name": "punctuation.brackets.curly.wgsl"
111 }
112 },
113 "patterns": [
114 {
115 "include": "#line_comments"
116 },
117 {
118 "include": "#block_comments"
119 },
120 {
121 "include": "#keywords"
122 },
123 {
124 "include": "#attributes"
125 },
126 {
127 "include": "#function_calls"
128 },
129 {
130 "include": "#constants"
131 },
132 {
133 "include": "#types"
134 },
135 {
136 "include": "#variables"
137 },
138 {
139 "include": "#punctuation"
140 }
141 ]
142 }
143 ]
144 },
145 "function_calls": {
146 "patterns": [
147 {
148 "comment": "function/method calls",
149 "name": "meta.function.call.wgsl",
150 "begin": "([A-Za-z0-9_]+)(\\()",
151 "beginCaptures": {
152 "1": {
153 "name": "entity.name.function.wgsl"
154 },
155 "2": {
156 "name": "punctuation.brackets.round.wgsl"
157 }
158 },
159 "end": "\\)",
160 "endCaptures": {
161 "0": {
162 "name": "punctuation.brackets.round.wgsl"
163 }
164 },
165 "patterns": [
166 {
167 "include": "#line_comments"
168 },
169 {
170 "include": "#block_comments"
171 },
172 {
173 "include": "#keywords"
174 },
175 {
176 "include": "#attributes"
177 },
178 {
179 "include": "#function_calls"
180 },
181 {
182 "include": "#constants"
183 },
184 {
185 "include": "#types"
186 },
187 {
188 "include": "#variables"
189 },
190 {
191 "include": "#punctuation"
192 }
193 ]
194 }
195 ]
196 },
197 "constants": {
198 "patterns": [
199 {
200 "comment": "decimal float literal",
201 "name": "constant.numeric.float.wgsl",
202 "match": "(-?\\b[0-9][0-9]*\\.[0-9][0-9]*)([eE][+-]?[0-9]+)?\\b"
203 },
204 {
205 "comment": "int literal",
206 "name": "constant.numeric.decimal.wgsl",
207 "match": "-?\\b0x[0-9a-fA-F]+\\b|\\b0\\b|-?\\b[1-9][0-9]*\\b"
208 },
209 {
210 "comment": "uint literal",
211 "name": "constant.numeric.decimal.wgsl",
212 "match": "\\b0x[0-9a-fA-F]+u\\b|\\b0u\\b|\\b[1-9][0-9]*u\\b"
213 },
214 {
215 "comment": "boolean constant",
216 "name": "constant.language.boolean.wgsl",
217 "match": "\\b(true|false)\\b"
218 }
219 ]
220 },
221 "types": {
222 "comment": "types",
223 "name": "storage.type.wgsl",
224 "patterns": [
225 {
226 "comment": "scalar Types",
227 "name": "storage.type.wgsl",
228 "match": "\\b(bool|i32|u32|f32)\\b"
229 },
230 {
231 "comment": "reserved scalar Types",
232 "name": "storage.type.wgsl",
233 "match": "\\b(i64|u64|f64)\\b"
234 },
235 {
236 "comment": "vector type aliasses",
237 "name": "storage.type.wgsl",
238 "match": "\\b(vec2i|vec3i|vec4i|vec2u|vec3u|vec4u|vec2f|vec3f|vec4f|vec2h|vec3h|vec4h)\\b"
239 },
240 {
241 "comment": "matrix type aliasses",
242 "name": "storage.type.wgsl",
243 "match": "\\b(mat2x2f|mat2x3f|mat2x4f|mat3x2f|mat3x3f|mat3x4f|mat4x2f|mat4x3f|mat4x4f|mat2x2h|mat2x3h|mat2x4h|mat3x2h|mat3x3h|mat3x4h|mat4x2h|mat4x3h|mat4x4h)\\b"
244 },
245 {
246 "comment": "vector/matrix types",
247 "name": "storage.type.wgsl",
248 "match": "\\b(vec[2-4]|mat[2-4]x[2-4])\\b"
249 },
250 {
251 "comment": "atomic types",
252 "name": "storage.type.wgsl",
253 "match": "\\b(atomic)\\b"
254 },
255 {
256 "comment": "array types",
257 "name": "storage.type.wgsl",
258 "match": "\\b(array)\\b"
259 },
260 {
261 "comment": "Custom type",
262 "name": "entity.name.type.wgsl",
263 "match": "\\b([A-Z][A-Za-z0-9]*)\\b"
264 }
265 ]
266 },
267 "variables": {
268 "patterns": [
269 {
270 "comment": "variables",
271 "name": "variable.other.wgsl",
272 "match": "\\b(?<!(?<!\\.)\\.)(?:r#(?!(crate|[Ss]elf|super)))?[a-z0-9_]+\\b"
273 }
274 ]
275 },
276 "punctuation": {
277 "patterns": [
278 {
279 "comment": "comma",
280 "name": "punctuation.comma.wgsl",
281 "match": ","
282 },
283 {
284 "comment": "curly braces",
285 "name": "punctuation.brackets.curly.wgsl",
286 "match": "[{}]"
287 },
288 {
289 "comment": "parentheses, round brackets",
290 "name": "punctuation.brackets.round.wgsl",
291 "match": "[()]"
292 },
293 {
294 "comment": "semicolon",
295 "name": "punctuation.semi.wgsl",
296 "match": ";"
297 },
298 {
299 "comment": "square brackets",
300 "name": "punctuation.brackets.square.wgsl",
301 "match": "[\\[\\]]"
302 },
303 {
304 "comment": "angle brackets",
305 "name": "punctuation.brackets.angle.wgsl",
306 "match": "(?<![=-])[<>]"
307 }
308 ]
309 },
310 "keywords": {
311 "patterns": [
312 {
313 "comment": "other keywords",
314 "name": "keyword.control.wgsl",
315 "match": "\\b(bitcast|block|break|case|continue|continuing|default|discard|else|elseif|enable|fallthrough|for|function|if|loop|private|read|read_write|return|storage|switch|uniform|while|workgroup|write)\\b"
316 },
317 {
318 "comment": "reserved keywords",
319 "name": "keyword.control.wgsl",
320 "match": "\\b(asm|const|do|enum|handle|mat|premerge|regardless|typedef|unless|using|vec|void)\\b"
321 },
322 {
323 "comment": "storage keywords",
324 "name": "keyword.other.wgsl storage.type.wgsl",
325 "match": "\\b(let|var)\\b"
326 },
327 {
328 "comment": "type keyword",
329 "name": "keyword.declaration.type.wgsl storage.type.wgsl",
330 "match": "\\b(type)\\b"
331 },
332 {
333 "comment": "enum keyword",
334 "name": "keyword.declaration.enum.wgsl storage.type.wgsl",
335 "match": "\\b(enum)\\b"
336 },
337 {
338 "comment": "struct keyword",
339 "name": "keyword.declaration.struct.wgsl storage.type.wgsl",
340 "match": "\\b(struct)\\b"
341 },
342 {
343 "comment": "fn",
344 "name": "keyword.other.fn.wgsl",
345 "match": "\\bfn\\b"
346 },
347 {
348 "comment": "logical operators",
349 "name": "keyword.operator.logical.wgsl",
350 "match": "(\\^|\\||\\|\\||&&|<<|>>|!)(?!=)"
351 },
352 {
353 "comment": "logical AND, borrow references",
354 "name": "keyword.operator.borrow.and.wgsl",
355 "match": "&(?![&=])"
356 },
357 {
358 "comment": "assignment operators",
359 "name": "keyword.operator.assignment.wgsl",
360 "match": "(\\+=|-=|\\*=|/=|%=|\\^=|&=|\\|=|<<=|>>=)"
361 },
362 {
363 "comment": "single equal",
364 "name": "keyword.operator.assignment.equal.wgsl",
365 "match": "(?<![<>])=(?!=|>)"
366 },
367 {
368 "comment": "comparison operators",
369 "name": "keyword.operator.comparison.wgsl",
370 "match": "(=(=)?(?!>)|!=|<=|(?<!=)>=)"
371 },
372 {
373 "comment": "math operators",
374 "name": "keyword.operator.math.wgsl",
375 "match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))"
376 },
377 {
378 "comment": "dot access",
379 "name": "keyword.operator.access.dot.wgsl",
380 "match": "\\.(?!\\.)"
381 },
382 {
383 "comment": "dashrocket, skinny arrow",
384 "name": "keyword.operator.arrow.skinny.wgsl",
385 "match": "->"
386 }
387 ]
388 }
389 }
390 }
391