diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /helix-22.03-x86_64-windows/runtime/queries/zig | |
download | cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2 cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip |
Diffstat (limited to 'helix-22.03-x86_64-windows/runtime/queries/zig')
3 files changed, 252 insertions, 0 deletions
diff --git a/helix-22.03-x86_64-windows/runtime/queries/zig/highlights.scm b/helix-22.03-x86_64-windows/runtime/queries/zig/highlights.scm new file mode 100644 index 0000000..62c99ac --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/zig/highlights.scm @@ -0,0 +1,234 @@ +[ + (container_doc_comment) + (doc_comment) + (line_comment) +] @comment + +[ + variable: (IDENTIFIER) + variable_type_function: (IDENTIFIER) +] @variable + +parameter: (IDENTIFIER) @variable.parameter + +[ + field_member: (IDENTIFIER) + field_access: (IDENTIFIER) +] @variable.other.member + +;; assume TitleCase is a type +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) + ] @type + (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$") +) +;; assume camelCase is a function +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) + ] @function + (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$") +) + +;; assume all CAPS_1 is a constant +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + ] @constant + (#match? @constant "^[A-Z][A-Z_0-9]+$") +) + +[ + function_call: (IDENTIFIER) + function: (IDENTIFIER) +] @function + +exception: "!" @function.macro + +( + (IDENTIFIER) @variable.builtin + (#eq? @variable.builtin "_") +) + +(PtrTypeStart "c" @variable.builtin) + +( + (ContainerDeclType + [ + (ErrorUnionExpr) + "enum" + ] + ) + (ContainerField (IDENTIFIER) @constant) +) + +field_constant: (IDENTIFIER) @constant + +(BUILTINIDENTIFIER) @function.builtin + +((BUILTINIDENTIFIER) @keyword.control.import + (#any-of? @keyword.control.import "@import" "@cImport")) + +(INTEGER) @constant.numeric.integer + +(FLOAT) @constant.numeric.float + +[ + (LINESTRING) + (STRINGLITERALSINGLE) +] @string + +(CHAR_LITERAL) @constant.character +(EscapeSequence) @constant.character.escape +(FormatSequence) @string.special + +[ + "allowzero" + "volatile" + "anytype" + "anyframe" + (BuildinTypeExpr) +] @type.builtin + +(BreakLabel (IDENTIFIER) @label) +(BlockLabel (IDENTIFIER) @label) + +[ + "true" + "false" +] @constant.builtin.boolean + +[ + "undefined" + "unreachable" + "null" +] @constant.builtin + +[ + "else" + "if" + "switch" +] @keyword.control.conditional + +[ + "for" + "while" +] @keyword.control.repeat + +[ + "or" + "and" + "orelse" +] @operator + +[ + "struct" + "enum" + "union" + "error" + "packed" + "opaque" +] @keyword + +[ + "try" + "error" + "catch" +] @function.macro + +; VarDecl +[ + "threadlocal" + "fn" +] @keyword.function + +[ + "const" + "var" + "test" + "pub" + "usingnamespace" +] @keyword + +[ + "return" + "break" + "continue" +] @keyword.control + +; Macro +[ + "defer" + "errdefer" + "async" + "nosuspend" + "await" + "suspend" + "resume" + "export" + "extern" +] @function.macro + +; PrecProc +[ + "comptime" + "inline" + "noinline" + "asm" + "callconv" + "noalias" +] @keyword.directive + +[ + "linksection" + "align" +] @function.builtin + +[ + (CompareOp) + (BitwiseOp) + (BitShiftOp) + (AdditionOp) + (AssignOp) + (MultiplyOp) + (PrefixOp) + "*" + "**" + "->" + ".?" + ".*" + "?" +] @operator + +[ + ";" + "." + "," + ":" +] @punctuation.delimiter + +[ + ".." + "..." +] @punctuation.special + +[ + "[" + "]" + "(" + ")" + "{" + "}" + (Payload "|") + (PtrPayload "|") + (PtrIndexPayload "|") +] @punctuation.bracket + +; Error +(ERROR) @keyword diff --git a/helix-22.03-x86_64-windows/runtime/queries/zig/indents.toml b/helix-22.03-x86_64-windows/runtime/queries/zig/indents.toml new file mode 100644 index 0000000..36ba8e5 --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/zig/indents.toml @@ -0,0 +1,16 @@ +indent = [ + "Block", + "BlockExpr", + "ContainerDecl", + "SwitchExpr", + "AssignExpr", + "ErrorUnionExpr", + "Statement", + "InitList" +] + +outdent = [ + "}", + "]", + ")" +] diff --git a/helix-22.03-x86_64-windows/runtime/queries/zig/injections.scm b/helix-22.03-x86_64-windows/runtime/queries/zig/injections.scm new file mode 100644 index 0000000..3df9589 --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/zig/injections.scm @@ -0,0 +1,2 @@ +([(line_comment) (doc_comment)] @injection.content + (#set! injection.language "comment")) |