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
---
name: Zig
file_extensions:
- zig
scope: source.zig
variables:
identifier: '[A-Za-z_][A-Za-z0-9_]*'
contexts:
prototype:
- include: comments
main:
- include: strings
- match: '@{{identifier}}'
scope: entity.name.function.zig
- match: '\b(?:const|var|fn|pub|extern|export|inline|noinline|comptime|struct|union|enum|error|try|catch|defer|errdefer|async|await|suspend|resume|if|else|switch|for|while|break|continue|return)\b'
scope: keyword.control.zig
- match: '\b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64|isize|f16|f32|f64|bool|void|anytype|type)\b'
scope: support.type.zig
- match: '\b[A-Z][A-Za-z0-9_]*\b'
scope: entity.name.type.zig
- match: '\b{{identifier}}(?=\s*\()'
scope: entity.name.function.zig
- match: '\b(?:0x[0-9A-Fa-f_]+|\d[\d_]*(?:\.\d[\d_]*)?)\b'
scope: constant.numeric.zig
- match: '=>|[-+*/%=&|<>!?:]+'
scope: keyword.operator.zig
comments:
- match: '//.*$'
scope: comment.line.double-slash.zig
strings:
- match: '"'
push: double-quoted-string
- match: "'"
push: single-quoted-string
double-quoted-string:
- meta_scope: string.quoted.double.zig
- match: '\\.'
scope: constant.character.escape.zig
- match: '"'
pop: true
single-quoted-string:
- meta_scope: string.quoted.single.zig
- match: '\\.'
scope: constant.character.escape.zig
- match: "'"
pop: true