Update Zig highlights

Recently I rearranged the keywords. This PR brings the highlights query file up to date with that.
This commit is contained in:
Eleanor Bartle 2023-02-13 10:20:02 +11:00 committed by Stephan Seitz
parent be26661417
commit bf3b792ce6

View file

@ -2,11 +2,7 @@
(container_doc_comment) (container_doc_comment)
(doc_comment) (doc_comment)
(line_comment) (line_comment)
] @comment @spell ] @comment
((line_comment) @text.note
(#match? @text.note "^// *zig fmt: (on|off) *$")
)
[ [
variable: (IDENTIFIER) variable: (IDENTIFIER)
@ -27,7 +23,7 @@ parameter: (IDENTIFIER) @parameter
field_access: (IDENTIFIER) field_access: (IDENTIFIER)
parameter: (IDENTIFIER) parameter: (IDENTIFIER)
] @type ] @type
(#match? @type "^[A-Z]") (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$")
) )
;; assume camelCase is a function ;; assume camelCase is a function
( (
@ -36,7 +32,7 @@ parameter: (IDENTIFIER) @parameter
field_access: (IDENTIFIER) field_access: (IDENTIFIER)
parameter: (IDENTIFIER) parameter: (IDENTIFIER)
] @function ] @function
(#match? @function "^[a-z]+[A-Z]+") (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
) )
;; assume all CAPS_1 is a constant ;; assume all CAPS_1 is a constant
@ -51,7 +47,7 @@ parameter: (IDENTIFIER) @parameter
[ [
function_call: (IDENTIFIER) function_call: (IDENTIFIER)
function: (IDENTIFIER) function: (IDENTIFIER)
] @function.call ] @function
exception: "!" @exception exception: "!" @exception
@ -60,15 +56,17 @@ exception: "!" @exception
(#eq? @variable.builtin "_") (#eq? @variable.builtin "_")
) )
; (PtrTypeStart "c" @variable.builtin) (PtrTypeStart "c" @variable.builtin)
; ( (
; (ContainerDeclType (ContainerDeclType
; (ErrorUnionExpr) [
; ; "enum" (ErrorUnionExpr)
; ) "enum"
; (ContainerField (IDENTIFIER) @constant) ]
; ) )
(ContainerField (IDENTIFIER) @constant)
)
field_constant: (IDENTIFIER) @constant field_constant: (IDENTIFIER) @constant
@ -84,44 +82,46 @@ field_constant: (IDENTIFIER) @constant
[ [
(LINESTRING) (LINESTRING)
(STRINGLITERALSINGLE) (STRINGLITERALSINGLE)
] @string @spell ] @string
(CHAR_LITERAL) @character (CHAR_LITERAL) @character
(EscapeSequence) @string.escape (EscapeSequence) @string.escape
(FormatSequence) @string.special (FormatSequence) @string.special
[
"allowzero"
"volatile"
"threadlocal"
"inline"
"noinline"
"noalias"
] @type.qualifier
[
"anytype"
"anyframe"
(BuildinTypeExpr)
] @type.builtin
(BreakLabel (IDENTIFIER) @label) (BreakLabel (IDENTIFIER) @label)
(BlockLabel (IDENTIFIER) @label) (BlockLabel (IDENTIFIER) @label)
[ [
"true" "asm"
"false" "defer"
] @boolean "errdefer"
"nosuspend"
"test"
] @keyword
[ [
"undefined" "fn"
"unreachable" ] @keyword.function
"null"
] @constant.builtin [
"and"
"or"
"orelse"
] @keyword.operator
[
"return"
"break"
"continue"
"async"
"await"
"suspend"
"resume"
] @keyword.return
[ [
"else"
"if" "if"
"else"
"switch" "switch"
] @conditional ] @conditional
@ -131,64 +131,60 @@ field_constant: (IDENTIFIER) @constant
] @repeat ] @repeat
[ [
"or" "usingnamespace"
"and" ] @include
"orelse"
] @keyword.operator
[
"packed"
"opaque"
"comptime"
] @storageclass
[
"struct"
"enum"
"union"
"error"
"defer"
"errdefer"
"async"
"nosuspend"
"await"
"suspend"
"resume"
"export"
"extern"
"asm"
"callconv"
] @keyword
[ [
"try" "try"
"error"
"catch" "catch"
] @exception ] @exception
; VarDecl [
"anytype"
(BuildinTypeExpr)
] @type.builtin
[
"struct"
"union"
"enum"
"opaque"
"error"
] @type.definition
[ [
"const" "const"
"var" "var"
"fn" "volatile"
] @keyword.function "allowzero"
"noalias"
] @type.qualifier
[ [
"test" "addrspace"
"pub"
"usingnamespace"
] @keyword
[
"return"
"break"
"continue"
] @keyword.return
[
"linksection"
"align" "align"
] @function.builtin "callconv"
"linksection"
] @storageclass
[
"comptime"
"export"
"extern"
"inline"
"noinline"
"packed"
"pub"
"threadlocal"
] @attribute
[
"null"
"unreachable"
"undefined"
"true"
"false"
] @constant.builtin
[ [
(CompareOp) (CompareOp)
@ -201,7 +197,6 @@ field_constant: (IDENTIFIER) @constant
"*" "*"
"**" "**"
"->" "->"
"=>"
".?" ".?"
".*" ".*"
"?" "?"