| 1 |
filetype: zig |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "\\.z(ig|on)$" |
| 5 |
|
| 6 |
rules: |
| 7 |
# Reserved words |
| 8 |
- statement: "\\b(addrspace|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|anyopaque|bool|comptime_int|comptime_float|enum|f(16|32|64|80|128)|i(8|16|32|64|128)|isize|noreturn|opaque|struct|type|union|u(8|16|32|64|128)|usize|void)\\b" |
| 13 |
- type: "\\b(c_u?(short|int|long(long)?)|c_longdouble|c_void)\\b" |
| 14 |
|
| 15 |
# Operators |
| 16 |
- symbol.operator: "[-!|=;%.+^*:&?<>~]" |
| 17 |
|
| 18 |
# Parenthesis |
| 19 |
- symbol.brackets: "[(){}]|\\[|\\]" |
| 20 |
|
| 21 |
# Constants |
| 22 |
- constant: "\\b(null|undefined)\\b" |
| 23 |
- constant.number: "\\b(0b[01_]+|0o[0-7_]+|[0-9_]+|0x[a-fA-F0-9_]+)\\b" |
| 24 |
- constant.bool: "\\b(true|false)\\b" |
| 25 |
|
| 26 |
- constant.string: |
| 27 |
start: "\"" |
| 28 |
end: "\"" |
| 29 |
skip: "\\\\." |
| 30 |
rules: |
| 31 |
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" |
| 32 |
|
| 33 |
- constant.string: |
| 34 |
start: "'" |
| 35 |
end: "'" |
| 36 |
skip: "\\\\." |
| 37 |
rules: |
| 38 |
- error: "..+" |
| 39 |
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" |
| 40 |
|
| 41 |
- constant.string: |
| 42 |
start: "\\\\\\\\" |
| 43 |
end: "$" |
| 44 |
skip: "\\\\." |
| 45 |
rules: |
| 46 |
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})" |
| 47 |
|
| 48 |
- comment: |
| 49 |
start: "//" |
| 50 |
end: "$" |
| 51 |
rules: |
| 52 |
- todo: "(TODO|XXX|FIXME):?" |