micro/runtime/syntax/zig.yaml

53 lines
1.7 KiB
YAML
Raw Normal View History

filetype: zig
detect:
filename: "\\.zig$"
rules:
# Reserved words
2023-07-11 09:11:07 +03: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"
# builtin functions
- special: "@[a-zA-Z_]+"
# Primitive Types
2023-07-11 09:11:07 +03: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"
- 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"
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- error: "..+"
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
- constant.string:
start: "\\\\\\\\"
end: "$"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\([nrt\\\\'\"]|x[a-fA-F0-9]{2}|u{[a-fA-F0-9]+})"
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"