aboutsummaryrefslogtreecommitdiff
path: root/plugins/language_zig.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/language_zig.lua')
-rw-r--r--plugins/language_zig.lua165
1 files changed, 35 insertions, 130 deletions
diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua
index 2c098af..3b4c953 100644
--- a/plugins/language_zig.lua
+++ b/plugins/language_zig.lua
@@ -5,33 +5,41 @@ syntax.add {
files = { "%.zig$" },
comment = "//",
patterns = {
- { pattern = "//.-\n", type = "comment" },
- { pattern = "#!.-\n", type = "comment" },
- { pattern = { '"', '"', '\\' }, type = "string" },
- { pattern = { "'", "'", '\\' }, type = "string" },
- { pattern = "-?[iuf][%d_]+", type = "keyword2" },
- { pattern = "-?\\x[%x_]+", type = "number" },
- { pattern = "-?\\u{[%x_]+}", type = "number" },
- { pattern = "-?%d+[%d%.eE]*f?", type = "number" },
- { pattern = "-?%.?%d+f?", type = "number" },
- { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" },
- { pattern = "[%a_][%w_]*%f[(]", type = "function" },
- { pattern = "@?[%a_][%w_]*", type = "symbol" },
+ { pattern = "//.-\n", type = "comment" },
+ { pattern = "\\\\.-\n", type = "string" },
+ { pattern = { '"', '"', '\\' }, type = "string" },
+ { pattern = { "'", "'", '\\' }, type = "string" },
+ { pattern = "[iu][%d_]+", type = "keyword2" },
+ { pattern = "0b[01_]+", type = "number" },
+ { pattern = "0o[0-7_]+", type = "number" },
+ { pattern = "0x[%x_]+", type = "number" },
+ { pattern = "0x[%x_]+%.[%x_]*[pP][-+]?%d+", type = "number" },
+ { pattern = "0x[%x_]+%.[%x_]*", type = "number" },
+ { pattern = "0x%.[%x_]+[pP][-+]?%d+", type = "number" },
+ { pattern = "0x%.[%x_]+", type = "number" },
+ { pattern = "0x[%x_]+[pP][-+]?%d+", type = "number" },
+ { pattern = "0x[%x_]+", type = "number" },
+ { pattern = "%d[%d_]*%.[%d_]*[eE][-+]?%d+", type = "number" },
+ { pattern = "%d[%d_]*%.[%d_]*", type = "number" },
+ { pattern = "%d[%d_]*", type = "number" },
+ { pattern = "[%+%-=/%*%^%%<>!~|&%.%?]", type = "operator" },
+ { pattern = "[%a_][%w_]*()%s*%(", type = {"function", "normal"} },
+ { pattern = "[A-Z][%w_]*", type = "keyword2" },
+ { pattern = "[%a_][%w_]*", type = "symbol" },
+ { pattern = "@()[%a_][%w_]*", type = {"operator", "function"} },
},
symbols = {
["fn"] = "keyword",
-
["asm"] = "keyword",
["volatile"] = "keyword",
-
["continue"] = "keyword",
["break"] = "keyword",
["switch"] = "keyword",
["for"] = "keyword",
["while"] = "keyword",
-
["var"] = "keyword",
["anytype"] = "keyword",
+ ["anyframe"] = "keyword",
["const"] = "keyword",
["test"] = "keyword",
["packed"] = "keyword",
@@ -42,146 +50,43 @@ syntax.add {
["errdefer"] = "keyword",
["align"] = "keyword",
["usingnamespace"] = "keyword",
-
["noasync"] = "keyword",
["async"] = "keyword",
["await"] = "keyword",
["cancel"] = "keyword",
["suspend"] = "keyword",
["resume"] = "keyword",
-
["threadlocal"] = "keyword",
-
["linksection"] = "keyword",
-
["callconv"] = "keyword",
-
["try"] = "keyword",
["catch"] = "keyword",
["orelse"] = "keyword",
["unreachable"] = "keyword",
- ["noreturn"] = "keyword",
["error"] = "keyword",
["if"] = "keyword",
["else"] = "keyword",
["return"] = "keyword",
["comptime"] = "keyword",
-
["stdcallcc"] = "keyword",
["ccc"] = "keyword",
["nakedcc"] = "keyword",
-
["and"] = "keyword",
["or"] = "keyword",
-
- -- std
- ["@import"] = "keyword",
- ["@cImport"] = "keyword",
-
- [ "@addWithOverflow" ] = "function",
- [ "@alignCast" ] = "function",
- [ "@alignOf" ] = "function",
- [ "@as" ] = "function",
- [ "@asyncCall" ] = "function",
- [ "@atomicLoad" ] = "function",
- [ "@atomicRmw" ] = "function",
- [ "@atomicStore" ] = "function",
- [ "@bitCast" ] = "function",
- [ "@bitOffsetOf" ] = "function",
- [ "@boolToInt" ] = "function",
- [ "@bitSizeOf" ] = "function",
- [ "@breakpoint" ] = "function",
- [ "@mulAdd" ] = "function",
- [ "@byteSwap" ] = "function",
- [ "@bitReverse" ] = "function",
- [ "@byteOffsetOf" ] = "function",
- [ "@call" ] = "function",
- [ "@cDefine" ] = "function",
- [ "@cImport" ] = "function",
- [ "@cInclude" ] = "function",
- [ "@clz" ] = "function",
- [ "@cmpxchgStrong" ] = "function",
- [ "@cmpxchgWeak" ] = "function",
- [ "@compileError" ] = "function",
- [ "@compileLog" ] = "function",
- [ "@ctz" ] = "function",
- [ "@cUndef" ] = "function",
- [ "@divExact" ] = "function",
- [ "@divFloor" ] = "function",
- [ "@divTrunc" ] = "function",
- [ "@embedFile" ] = "function",
- [ "@enumToInt" ] = "function",
- [ "@errorName" ] = "function",
- [ "@errorReturnTrace" ] = "function",
- [ "@errorToInt" ] = "function",
- [ "@errSetCast" ] = "function",
- [ "@export" ] = "function",
- [ "@fence" ] = "function",
- [ "@field" ] = "function",
- [ "@fieldParentPtr" ] = "function",
- [ "@floatCast" ] = "function",
- [ "@floatToInt" ] = "function",
- [ "@Frame" ] = "function",
- [ "@frame" ] = "function",
- [ "@frameAddress" ] = "function",
- [ "@frameSize" ] = "function",
- [ "@hasDecl" ] = "function",
- [ "@hasField" ] = "function",
- [ "@import" ] = "function",
- [ "@intCast" ] = "function",
- [ "@intToEnum" ] = "function",
- [ "@intToError" ] = "function",
- [ "@intToFloat" ] = "function",
- [ "@intToPtr" ] = "function",
- [ "@memcpy" ] = "function",
- [ "@memset" ] = "function",
- [ "@wasmMemorySize" ] = "function",
- [ "@wasmMemoryGrow" ] = "function",
- [ "@mod" ] = "function",
- [ "@mulWithOverflow" ] = "function",
- [ "@panic" ] = "function",
- [ "@popCount" ] = "function",
- [ "@ptrCast" ] = "function",
- [ "@ptrToInt" ] = "function",
- [ "@rem" ] = "function",
- [ "@returnAddress" ] = "function",
- [ "@setAlignStack" ] = "function",
- [ "@setCold" ] = "function",
- [ "@setEvalBranchQuota" ] = "function",
- [ "@setFloatMode" ] = "function",
- [ "@setRuntimeSafety" ] = "function",
- [ "@shlExact" ] = "function",
- [ "@shlWithOverflow" ] = "function",
- [ "@shrExact" ] = "function",
- [ "@shuffle" ] = "function",
- [ "@sizeOf" ] = "function",
- [ "@splat" ] = "function",
- [ "@src" ] = "function",
- [ "@sqrt" ] = "function",
- [ "@sin" ] = "function",
- [ "@cos" ] = "function",
- [ "@exp" ] = "function",
- [ "@exp2" ] = "function",
- [ "@log" ] = "function",
- [ "@log2" ] = "function",
- [ "@log10" ] = "function",
- [ "@fabs" ] = "function",
- [ "@floor" ] = "function",
- [ "@ceil" ] = "function",
- [ "@trunc" ] = "function",
- [ "@round" ] = "function",
- [ "@subWithOverflow" ] = "function",
- [ "@tagName" ] = "function",
- [ "@TagType" ] = "function",
- [ "@This" ] = "function",
- [ "@truncate" ] = "function",
- [ "@Type" ] = "function",
- [ "@typeInfo" ] = "function",
- [ "@typeName" ] = "function",
- [ "@TypeOf" ] = "function",
- [ "@unionInit" ] = "function",
+ ["struct"] = "keyword",
+ ["enum"] = "keyword",
+ ["union"] = "keyword",
+ ["opaque"] = "keyword",
+ ["inline"] = "keyword",
+ ["allowzero"] = "keyword",
+ ["noalias"] = "keyword",
+ ["nosuspend"] = "keyword",
-- types
+ ["f16"] = "keyword2",
+ ["f32"] = "keyword2",
+ ["f64"] = "keyword2",
+ ["f128"] = "keyword2",
["void"] = "keyword2",
["c_void"] = "keyword2",
["isize"] = "keyword2",