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
48
49
50
51
52
53
54
55
56
57
58
|
// zig fmt: off
const std = @import("std");
const Syntax = @import("../Syntax.zig");
// TODO: Add support for the multiline string \\
pub const syntax = Syntax{
.name = "Zig",
.filematch = &[_][]const u8{ ".zig" },
.keywords1 = &[_][]const u8{
// keywords
"align", "allowzero", "and", "anyframe", "anytype", "asm", "async", "await", "break",
"callconv", "catch", "comptime", "const", "continue", "defer", "else", "enum", "errdefer",
"error", "export", "extern", "fn", "for", "if", "inline", "noalias", "nosuspend", "noinline",
"opaque", "or", "orelse", "packed", "pub", "resume", "return", "linksection", "struct",
"suspend", "switch", "test", "threadlocal", "try", "union", "unreachable", "usingnamespace",
"var", "volatile", "while",
// primitive values
"false", "null", "true", "undefined",
},
.keywords2 = &[_][]const u8{
// primitive types
"i8", "u8", "i16", "u16", "i32", "u32", "i64", "u64", "i128", "u128", "isize", "usize",
"c_short", "c_ushort", "c_int", "c_uint", "c_long", "c_ulong", "c_longlong", "c_ulonglong",
"c_longdouble", "f16", "f32", "f64", "f128", "bool", "anyopaque", "void", "noreturn", "type",
"anyerror", "comptime_int", "comptime_float",
// removed types
"c_void",
// TODO: Generate all integer types
// builtin functions
"@addWithOverflow", "@alignCast", "@alignOf", "@as", "@asyncCall", "@atomicLoad",
"@atomicRmw", "@atomicStore", "@bitCast", "@bitOffsetOf", "@boolToInt", "@bitSizeOf",
"@breakpoint", "@mulAdd", "@byteSwap", "@bitReverse", "@offsetOf", "@call", "@cDefine",
"@cImport", "@cInclude", "@clz", "@cmpxchgStrong", "@cmpxchgWeak", "@compileError",
"@compileLog", "@ctz", "@cUndef", "@divExact", "@divFloor", "@divTrunc", "@embedFile",
"@enumToInt", "@errorName", "@errorReturnTrace", "@errorToInt", "@errSetCast", "@export",
"@extern", "@fence", "@field", "@fieldParentPtr", "@floatCast", "@floatToInt", "@frame",
"@Frame", "@frameAddress", "@frameSize", "@hasDecl", "@hasField", "@import", "@intCast",
"@intToEnum", "@intToError" , "@intToFloat", "@intToPtr", "@maximum", "@memcpy", "@memset",
"@minimum", "@wasmMemorySize", "@wasmMemoryGrow", "@mod", "@mulWithOverflow", "@panic",
"@popCount", "@prefetch", "@ptrCast", "@ptrToInt", "@rem", "@returnAddress", "@select",
"@setAlignStack", "@setCold", "@setEvalBranchQuota", "@setFloatMode", "@setRuntimeSafety",
"@shlExact", "@shlWithOverflow", "@shrExact", "@shuffle", "@sizeOf", "@splat", "@reduce",
"@src", "@sqrt", "@sin", "@cos", "@exp", "@exp2", "@log", "@log2", "@log10", "@fabs",
"@floor", "@ceil", "@trunc", "@round", "@subWithOverflow", "@tagName", "@This", "@truncate",
"@Type", "@typeInfo", "@typeName", "@TypeOf", "@unionInit",
},
.singleline_comment_start = "//",
.multiline_comment_start = null,
.multiline_comment_end = null,
.separators = "&*^:,.=!<{[(-%|+?>}]);/~",
.flags = .{ .hl_numbers = true, .hl_strings = true },
};
|