diff options
author | Francesco <francesco.bbt@gmail.com> | 2021-05-08 20:53:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 20:53:29 +0200 |
commit | 0f2d2c3b8e8652b2fab9d27812c6562cca723d67 (patch) | |
tree | 4fb837f00654976988ae781ffc11151d85455888 | |
parent | 6d2bcd5cca6f765d9ea6fee02b8639d54a3c52d7 (diff) | |
parent | 5c86b69d2de3515d7807ce0cbb3e17bae3ee04d1 (diff) | |
download | lite-xl-plugins-0f2d2c3b8e8652b2fab9d27812c6562cca723d67.tar.gz lite-xl-plugins-0f2d2c3b8e8652b2fab9d27812c6562cca723d67.zip |
Merge pull request #9 from Jan200101/ziglang
add language file for ziglang
-rw-r--r-- | plugins/language_zig.lua | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/plugins/language_zig.lua b/plugins/language_zig.lua new file mode 100644 index 0000000..40ecb01 --- /dev/null +++ b/plugins/language_zig.lua @@ -0,0 +1,211 @@ +-- lite-xl 1.16 +local syntax = require "core.syntax" + +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" }, + }, + symbols = { + ["fn"] = "keyword", + + ["asm"] = "keyword", + ["volatile"] = "keyword", + + ["continue"] = "keyword", + ["break"] = "keyword", + ["switch"] = "keyword", + ["for"] = "keyword", + ["while"] = "keyword", + + ["var"] = "keyword", + ["anytype"] = "keyword", + ["const"] = "keyword", + ["test"] = "keyword", + ["packed"] = "keyword", + ["extern"] = "keyword", + ["export"] = "keyword", + ["pub"] = "keyword", + ["defer"] = "keyword", + ["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", + + -- types + ["void"] = "keyword2", + ["c_void"] = "keyword2", + ["isize"] = "keyword2", + ["usize"] = "keyword2", + ["c_short"] = "keyword2", + ["c_ushort"] = "keyword2", + ["c_int"] = "keyword2", + ["c_uint"] = "keyword2", + ["c_long"] = "keyword2", + ["c_ulong"] = "keyword2", + ["c_longlong"] = "keyword2", + ["c_ulonglong"] = "keyword2", + ["c_longdouble"] = "keyword2", + ["bool"] = "keyword2", + + ["noreturn"] = "keyword2", + ["type"] = "keyword2", + ["anyerror"] = "keyword2", + ["comptime_int"] = "keyword2", + ["comptime_float"] = "keyword2", + + ["true"] = "literal", + ["false"] = "literal", + ["null"] = "literal", + ["undefined"] = "literal", + }, +} |