diff options
| author | Eleanor Bartle <eleanor@eleanor-nb.com> | 2023-02-13 10:20:02 +1100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2023-02-17 14:30:42 -0800 |
| commit | bf3b792ce627630d54ec1352aae52f1bc38874f1 (patch) | |
| tree | efd3c989b2730b8e64461d120cc76650eda34f63 | |
| parent | Update parsers: ledger, sql (#4331) (diff) | |
| download | nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar.gz nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar.bz2 nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar.lz nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar.xz nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.tar.zst nvim-treesitter-bf3b792ce627630d54ec1352aae52f1bc38874f1.zip | |
Update Zig highlights
Recently I rearranged the keywords. This PR brings the highlights query file up to date with that.
| -rw-r--r-- | queries/zig/highlights.scm | 157 |
1 files changed, 76 insertions, 81 deletions
diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index 5115eb604..943d2f2c5 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -2,11 +2,7 @@ (container_doc_comment) (doc_comment) (line_comment) -] @comment @spell - -((line_comment) @text.note - (#match? @text.note "^// *zig fmt: (on|off) *$") -) +] @comment [ variable: (IDENTIFIER) @@ -27,7 +23,7 @@ parameter: (IDENTIFIER) @parameter field_access: (IDENTIFIER) parameter: (IDENTIFIER) ] @type - (#match? @type "^[A-Z]") + (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$") ) ;; assume camelCase is a function ( @@ -36,7 +32,7 @@ parameter: (IDENTIFIER) @parameter field_access: (IDENTIFIER) parameter: (IDENTIFIER) ] @function - (#match? @function "^[a-z]+[A-Z]+") + (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$") ) ;; assume all CAPS_1 is a constant @@ -51,7 +47,7 @@ parameter: (IDENTIFIER) @parameter [ function_call: (IDENTIFIER) function: (IDENTIFIER) -] @function.call +] @function exception: "!" @exception @@ -60,15 +56,17 @@ exception: "!" @exception (#eq? @variable.builtin "_") ) -; (PtrTypeStart "c" @variable.builtin) +(PtrTypeStart "c" @variable.builtin) -; ( -; (ContainerDeclType -; (ErrorUnionExpr) -; ; "enum" -; ) -; (ContainerField (IDENTIFIER) @constant) -; ) +( + (ContainerDeclType + [ + (ErrorUnionExpr) + "enum" + ] + ) + (ContainerField (IDENTIFIER) @constant) +) field_constant: (IDENTIFIER) @constant @@ -84,44 +82,46 @@ field_constant: (IDENTIFIER) @constant [ (LINESTRING) (STRINGLITERALSINGLE) -] @string @spell +] @string (CHAR_LITERAL) @character (EscapeSequence) @string.escape (FormatSequence) @string.special -[ - "allowzero" - "volatile" - "threadlocal" - "inline" - "noinline" - "noalias" -] @type.qualifier +(BreakLabel (IDENTIFIER) @label) +(BlockLabel (IDENTIFIER) @label) [ - "anytype" - "anyframe" - (BuildinTypeExpr) -] @type.builtin + "asm" + "defer" + "errdefer" + "nosuspend" + "test" +] @keyword -(BreakLabel (IDENTIFIER) @label) -(BlockLabel (IDENTIFIER) @label) +[ + "fn" +] @keyword.function [ - "true" - "false" -] @boolean + "and" + "or" + "orelse" +] @keyword.operator [ - "undefined" - "unreachable" - "null" -] @constant.builtin + "return" + "break" + "continue" + "async" + "await" + "suspend" + "resume" +] @keyword.return [ - "else" "if" + "else" "switch" ] @conditional @@ -131,64 +131,60 @@ field_constant: (IDENTIFIER) @constant ] @repeat [ - "or" - "and" - "orelse" -] @keyword.operator + "usingnamespace" +] @include [ - "packed" - "opaque" - "comptime" -] @storageclass + "try" + "catch" +] @exception [ - "struct" - "enum" - "union" - "error" - "defer" - "errdefer" - "async" - "nosuspend" - "await" - "suspend" - "resume" - "export" - "extern" - "asm" - "callconv" -] @keyword + "anytype" + (BuildinTypeExpr) +] @type.builtin [ - "try" + "struct" + "union" + "enum" + "opaque" "error" - "catch" -] @exception +] @type.definition -; VarDecl [ "const" "var" - "fn" -] @keyword.function + "volatile" + "allowzero" + "noalias" +] @type.qualifier [ - "test" - "pub" - "usingnamespace" -] @keyword + "addrspace" + "align" + "callconv" + "linksection" +] @storageclass [ - "return" - "break" - "continue" -] @keyword.return + "comptime" + "export" + "extern" + "inline" + "noinline" + "packed" + "pub" + "threadlocal" +] @attribute [ - "linksection" - "align" -] @function.builtin + "null" + "unreachable" + "undefined" + "true" + "false" +] @constant.builtin [ (CompareOp) @@ -201,7 +197,6 @@ field_constant: (IDENTIFIER) @constant "*" "**" "->" - "=>" ".?" ".*" "?" |
