]> git.lizzy.rs Git - micro.git/blob - runtime/syntax/zig.yaml
Merge branch 'PR-find-on-type' of https://github.com/ilius/micro into ilius-PR-find...
[micro.git] / runtime / syntax / zig.yaml
1 filetype: zig
2
3 detect:
4     filename: "\\.zig$"
5
6 rules:
7       # Reserved words
8     - statement: "\\b(align|allowzero|and|asm|async|await|break|callconv|catch|comptime|const|continue|defer|else|errdefer|error|export|extern|fn|for|if|inline|noalias|noinline|nosuspend|or|orelse|packed|pub|resume|return|linksection|suspend|switch|test|threadlocal|try|unreachable|usingnamespace|var|volatile|while)\\b"
9       # builtin functions
10     - special: "@[a-zA-Z_]+"
11       # Primitive Types
12     - type: "\\b(anyframe|anytype|anyerror|bool|comptime_int|comptime_float|enum|f(16|32|64|128)|isize|noreturn|struct|type|union|usize|void)\\b"
13     - type: "\\b(c_u?(short|int|long(long)?)|c_longdouble|c_void)\\b"
14     - type: "\\b((i|u)[0-9]+)\\b"
15
16      # Operators
17     - symbol.operator: "[-!|=;%.+^*:&?<>~]"
18
19      # Parenthesis
20     - symbol.brackets: "[(){}]|\\[|\\]"
21
22      # Constants
23     - constant: "\\b(null|undefined)\\b"
24     - constant.number: "\\b(0b[01_]+|0o[0-7_]+|[0-9_]+|0x[a-fA-F0-9_]+)\\b"
25     - constant.bool: "\\b(true|false)\\b"
26
27     - constant.string:
28         start: "\""
29         end: "\""
30         skip: "\\\\."
31         rules:
32             - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
33
34     - constant.string:
35         start: "'"
36         end: "'"
37         skip: "\\\\."
38         rules:
39             - error: "..+"
40             - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
41
42     - constant.string:
43         start: "\\\\\\\\"
44         end: "$"
45         skip: "\\\\."
46         rules:
47             - constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
48     
49     - comment:
50         start: "//"
51         end: "$"
52         rules:
53             - todo: "(TODO|XXX|FIXME):?"