nvim-treesitter/queries/zig/highlights.scm

235 lines
2.8 KiB
Scheme
Raw Normal View History

(line_comment) @comment @spell
2021-08-08 18:54:24 +09:00
[
(container_doc_comment)
(doc_comment)
] @comment.documentation @spell
[
variable: (IDENTIFIER)
variable_type_function: (IDENTIFIER)
] @variable
parameter: (IDENTIFIER) @parameter
2021-03-23 06:18:43 +05:30
[
field_member: (IDENTIFIER)
field_access: (IDENTIFIER)
] @field
2021-03-23 06:18:43 +05:30
;; assume TitleCase is a type
2021-08-08 18:54:24 +09:00
(
[
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @type
2023-04-21 04:06:20 -04:00
(#lua-match? @type "^%u([%l]+[%u%l%d]*)*$")
2021-08-08 18:54:24 +09:00
)
;; assume camelCase is a function
(
2021-08-08 18:54:24 +09:00
[
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
parameter: (IDENTIFIER)
] @function
2023-04-21 04:06:20 -04:00
(#lua-match? @function "^%l+([%u][%l%d]*)+$")
)
;; assume all CAPS_1 is a constant
(
[
variable_type_function: (IDENTIFIER)
field_access: (IDENTIFIER)
] @constant
2023-04-21 04:06:20 -04:00
(#lua-match? @constant "^%u[%u%d_]+$")
)
[
function_call: (IDENTIFIER)
function: (IDENTIFIER)
] @function
2021-08-08 18:54:24 +09:00
exception: "!" @exception
2021-08-08 18:54:24 +09:00
(
(IDENTIFIER) @variable.builtin
(#eq? @variable.builtin "_")
)
(PtrTypeStart "c" @variable.builtin)
2021-11-25 20:42:01 +09:00
(
(ContainerDeclType
[
(ErrorUnionExpr)
"enum"
]
)
(ContainerField (IDENTIFIER) @constant)
)
2021-03-23 06:18:43 +05:30
field_constant: (IDENTIFIER) @constant
2021-08-08 18:54:24 +09:00
(BUILTINIDENTIFIER) @function.builtin
2021-03-23 06:18:43 +05:30
2021-08-08 18:54:24 +09:00
((BUILTINIDENTIFIER) @include
(#any-of? @include "@import" "@cImport"))
2021-08-08 18:54:24 +09:00
(INTEGER) @number
2021-03-23 06:18:43 +05:30
2021-08-08 18:54:24 +09:00
(FLOAT) @float
[
"true"
"false"
] @boolean
2021-08-08 18:54:24 +09:00
[
(LINESTRING)
2021-08-08 18:54:24 +09:00
(STRINGLITERALSINGLE)
] @string @spell
2021-03-23 06:18:43 +05:30
2021-08-08 18:54:24 +09:00
(CHAR_LITERAL) @character
(EscapeSequence) @string.escape
(FormatSequence) @string.special
2021-03-23 06:18:43 +05:30
(BreakLabel (IDENTIFIER) @label)
(BlockLabel (IDENTIFIER) @label)
2022-10-28 16:57:38 +03:00
[
"asm"
"defer"
"errdefer"
"test"
"struct"
"union"
"enum"
"opaque"
"error"
] @keyword
2021-08-08 18:54:24 +09:00
[
"async"
"await"
"suspend"
"nosuspend"
"resume"
] @keyword.coroutine
[
"fn"
] @keyword.function
2021-03-23 06:18:43 +05:30
2021-07-08 22:28:51 +02:00
[
"and"
"or"
"orelse"
] @keyword.operator
2021-07-08 22:28:51 +02:00
2021-08-08 18:54:24 +09:00
[
"return"
] @keyword.return
2021-03-23 06:18:43 +05:30
[
"if"
"else"
2021-03-23 06:18:43 +05:30
"switch"
] @conditional
[
"for"
"while"
"break"
"continue"
2021-03-23 06:18:43 +05:30
] @repeat
2021-08-08 18:54:24 +09:00
[
"usingnamespace"
] @include
2021-03-23 06:18:43 +05:30
2022-10-28 16:57:38 +03:00
[
"try"
"catch"
] @exception
2022-10-28 16:57:38 +03:00
2021-03-23 06:18:43 +05:30
[
"anytype"
(BuildinTypeExpr)
] @type.builtin
2021-03-23 06:18:43 +05:30
2021-08-08 18:54:24 +09:00
[
"const"
"var"
"volatile"
"allowzero"
"noalias"
] @type.qualifier
2021-08-08 18:54:24 +09:00
[
"addrspace"
"align"
"callconv"
"linksection"
] @storageclass
2021-08-08 18:54:24 +09:00
[
"comptime"
"export"
"extern"
"inline"
"noinline"
"packed"
"pub"
"threadlocal"
] @attribute
2021-08-08 18:54:24 +09:00
[
"null"
"unreachable"
"undefined"
] @constant.builtin
2021-08-08 18:54:24 +09:00
[
(CompareOp)
(BitwiseOp)
(BitShiftOp)
(AdditionOp)
2021-10-21 13:56:32 +09:00
(AssignOp)
2021-08-08 18:54:24 +09:00
(MultiplyOp)
(PrefixOp)
"*"
"**"
"->"
".?"
".*"
"?"
2021-03-23 06:18:43 +05:30
] @operator
[
";"
"."
","
2021-08-08 18:54:24 +09:00
":"
2021-03-23 06:18:43 +05:30
] @punctuation.delimiter
[
".."
"..."
] @punctuation.special
2021-08-08 18:54:24 +09:00
[
"["
"]"
"("
")"
"{"
"}"
(Payload "|")
(PtrPayload "|")
(PtrIndexPayload "|")
2021-08-08 18:54:24 +09:00
] @punctuation.bracket
; Error
(ERROR) @error