2019-07-06 05:51:12 +00:00
|
|
|
filetype: zig
|
|
|
|
|
|
|
|
detect:
|
2024-06-09 15:57:22 +00:00
|
|
|
filename: "\\.z(ig|on)$"
|
2019-07-06 05:51:12 +00:00
|
|
|
|
|
|
|
rules:
|
|
|
|
# Reserved words
|
2023-07-11 06:11:07 +00:00
|
|
|
- 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"
|
2019-07-06 05:51:12 +00:00
|
|
|
# builtin functions
|
2020-08-05 23:39:03 +00:00
|
|
|
- special: "@[a-zA-Z_]+"
|
|
|
|
# Primitive Types
|
2023-07-11 06:11:07 +00:00
|
|
|
- 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"
|
2020-08-05 23:39:03 +00:00
|
|
|
- type: "\\b(c_u?(short|int|long(long)?)|c_longdouble|c_void)\\b"
|
|
|
|
|
|
|
|
# Operators
|
|
|
|
- symbol.operator: "[-!|=;%.+^*:&?<>~]"
|
|
|
|
|
|
|
|
# Parenthesis
|
|
|
|
- symbol.brackets: "[(){}]|\\[|\\]"
|
|
|
|
|
|
|
|
# Constants
|
|
|
|
- constant: "\\b(null|undefined)\\b"
|
|
|
|
- constant.number: "\\b(0b[01_]+|0o[0-7_]+|[0-9_]+|0x[a-fA-F0-9_]+)\\b"
|
|
|
|
- constant.bool: "\\b(true|false)\\b"
|
2019-07-06 05:51:12 +00:00
|
|
|
|
|
|
|
- constant.string:
|
|
|
|
start: "\""
|
|
|
|
end: "\""
|
|
|
|
skip: "\\\\."
|
|
|
|
rules:
|
2020-08-05 23:39:03 +00:00
|
|
|
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
|
2019-07-06 05:51:12 +00:00
|
|
|
|
2020-08-05 23:39:03 +00:00
|
|
|
- constant.string:
|
|
|
|
start: "'"
|
|
|
|
end: "'"
|
|
|
|
skip: "\\\\."
|
2019-07-06 05:51:12 +00:00
|
|
|
rules:
|
2020-08-05 23:39:03 +00:00
|
|
|
- error: "..+"
|
|
|
|
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
|
2019-07-06 05:51:12 +00:00
|
|
|
|
2020-08-05 23:39:03 +00:00
|
|
|
- constant.string:
|
|
|
|
start: "\\\\\\\\"
|
|
|
|
end: "$"
|
|
|
|
skip: "\\\\."
|
|
|
|
rules:
|
|
|
|
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
|
2024-03-22 16:56:09 +00:00
|
|
|
|
2019-07-06 05:51:12 +00:00
|
|
|
- comment:
|
2020-08-05 23:39:03 +00:00
|
|
|
start: "//"
|
|
|
|
end: "$"
|
2019-07-06 05:51:12 +00:00
|
|
|
rules:
|
|
|
|
- todo: "(TODO|XXX|FIXME):?"
|