2021-08-28 06:32:01 +02:00
|
|
|
[
|
|
|
|
(container_doc_comment)
|
|
|
|
(doc_comment)
|
2022-09-03 00:22:07 +02:00
|
|
|
] @comment.documentation
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
[
|
2022-09-03 00:22:07 +02:00
|
|
|
(line_comment)
|
|
|
|
] @comment.line
|
2021-10-05 05:18:15 +02:00
|
|
|
|
|
|
|
;; assume TitleCase is a type
|
|
|
|
(
|
|
|
|
[
|
|
|
|
variable_type_function: (IDENTIFIER)
|
|
|
|
field_access: (IDENTIFIER)
|
|
|
|
parameter: (IDENTIFIER)
|
|
|
|
] @type
|
2023-08-02 21:22:28 +02:00
|
|
|
(#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)+$")
|
2021-10-05 05:18:15 +02:00
|
|
|
)
|
2022-09-03 00:22:07 +02:00
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
;; assume camelCase is a function
|
|
|
|
(
|
|
|
|
[
|
|
|
|
variable_type_function: (IDENTIFIER)
|
|
|
|
field_access: (IDENTIFIER)
|
|
|
|
parameter: (IDENTIFIER)
|
|
|
|
] @function
|
|
|
|
(#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$")
|
2021-08-28 06:32:01 +02:00
|
|
|
)
|
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
;; assume all CAPS_1 is a constant
|
|
|
|
(
|
|
|
|
[
|
|
|
|
variable_type_function: (IDENTIFIER)
|
|
|
|
field_access: (IDENTIFIER)
|
|
|
|
] @constant
|
|
|
|
(#match? @constant "^[A-Z][A-Z_0-9]+$")
|
|
|
|
)
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2022-09-03 00:22:07 +02:00
|
|
|
;; _
|
2021-08-28 06:32:01 +02:00
|
|
|
(
|
2021-10-05 05:18:15 +02:00
|
|
|
(IDENTIFIER) @variable.builtin
|
|
|
|
(#eq? @variable.builtin "_")
|
2021-08-28 06:32:01 +02:00
|
|
|
)
|
|
|
|
|
2022-09-03 00:22:07 +02:00
|
|
|
;; C Pointers [*c]T
|
2021-10-05 05:18:15 +02:00
|
|
|
(PtrTypeStart "c" @variable.builtin)
|
|
|
|
|
2022-09-03 00:22:07 +02:00
|
|
|
[
|
|
|
|
variable: (IDENTIFIER)
|
|
|
|
variable_type_function: (IDENTIFIER)
|
|
|
|
] @variable
|
|
|
|
|
|
|
|
parameter: (IDENTIFIER) @variable.parameter
|
|
|
|
|
|
|
|
[
|
|
|
|
field_member: (IDENTIFIER)
|
|
|
|
field_access: (IDENTIFIER)
|
|
|
|
] @variable.other.member
|
|
|
|
|
|
|
|
[
|
|
|
|
function_call: (IDENTIFIER)
|
|
|
|
function: (IDENTIFIER)
|
|
|
|
] @function
|
|
|
|
|
|
|
|
exception: "!" @keyword.control.exception
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
field_constant: (IDENTIFIER) @constant
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
(BUILTINIDENTIFIER) @function.builtin
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
((BUILTINIDENTIFIER) @keyword.control.import
|
|
|
|
(#any-of? @keyword.control.import "@import" "@cImport"))
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-11-03 04:00:52 +01:00
|
|
|
(INTEGER) @constant.numeric.integer
|
2021-08-28 06:32:01 +02:00
|
|
|
|
2021-11-03 04:00:52 +01:00
|
|
|
(FLOAT) @constant.numeric.float
|
2021-08-28 06:32:01 +02:00
|
|
|
|
|
|
|
[
|
2021-10-05 05:18:15 +02:00
|
|
|
(LINESTRING)
|
2021-08-28 06:32:01 +02:00
|
|
|
(STRINGLITERALSINGLE)
|
|
|
|
] @string
|
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
(CHAR_LITERAL) @constant.character
|
2021-11-03 04:00:52 +01:00
|
|
|
(EscapeSequence) @constant.character.escape
|
2021-10-05 05:18:15 +02:00
|
|
|
(FormatSequence) @string.special
|
2021-08-28 06:32:01 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
"anytype"
|
|
|
|
"anyframe"
|
|
|
|
(BuildinTypeExpr)
|
|
|
|
] @type.builtin
|
|
|
|
|
|
|
|
(BreakLabel (IDENTIFIER) @label)
|
|
|
|
(BlockLabel (IDENTIFIER) @label)
|
|
|
|
|
|
|
|
[
|
|
|
|
"true"
|
|
|
|
"false"
|
2021-10-05 05:18:15 +02:00
|
|
|
] @constant.builtin.boolean
|
|
|
|
|
|
|
|
[
|
2021-08-28 06:32:01 +02:00
|
|
|
"undefined"
|
|
|
|
"unreachable"
|
|
|
|
"null"
|
|
|
|
] @constant.builtin
|
|
|
|
|
|
|
|
[
|
|
|
|
"else"
|
|
|
|
"if"
|
|
|
|
"switch"
|
2021-10-05 05:18:15 +02:00
|
|
|
] @keyword.control.conditional
|
|
|
|
|
|
|
|
[
|
2021-08-28 06:32:01 +02:00
|
|
|
"for"
|
|
|
|
"while"
|
2021-10-05 05:18:15 +02:00
|
|
|
] @keyword.control.repeat
|
|
|
|
|
|
|
|
[
|
|
|
|
"or"
|
|
|
|
"and"
|
|
|
|
"orelse"
|
2022-09-03 00:22:07 +02:00
|
|
|
] @keyword.operator
|
2021-08-28 06:32:01 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
"enum"
|
2023-08-02 21:22:28 +02:00
|
|
|
] @type.enum
|
|
|
|
|
|
|
|
[
|
|
|
|
"struct"
|
2021-08-28 06:32:01 +02:00
|
|
|
"union"
|
|
|
|
"packed"
|
|
|
|
"opaque"
|
2022-09-03 00:22:07 +02:00
|
|
|
"export"
|
|
|
|
"extern"
|
|
|
|
"linksection"
|
|
|
|
] @keyword.storage.type
|
|
|
|
|
|
|
|
[
|
|
|
|
"const"
|
|
|
|
"var"
|
|
|
|
"threadlocal"
|
|
|
|
"allowzero"
|
|
|
|
"volatile"
|
|
|
|
"align"
|
|
|
|
] @keyword.storage.modifier
|
2021-08-28 06:32:01 +02:00
|
|
|
|
|
|
|
[
|
2021-10-05 05:18:15 +02:00
|
|
|
"try"
|
|
|
|
"error"
|
|
|
|
"catch"
|
2022-09-03 00:22:07 +02:00
|
|
|
] @keyword.control.exception
|
2021-10-05 05:18:15 +02:00
|
|
|
|
|
|
|
[
|
2021-08-28 06:32:01 +02:00
|
|
|
"fn"
|
|
|
|
] @keyword.function
|
|
|
|
|
2021-10-05 05:18:15 +02:00
|
|
|
[
|
|
|
|
"test"
|
2022-09-03 00:22:07 +02:00
|
|
|
] @keyword
|
|
|
|
|
|
|
|
[
|
2021-10-05 05:18:15 +02:00
|
|
|
"pub"
|
|
|
|
"usingnamespace"
|
2022-09-03 00:22:07 +02:00
|
|
|
] @keyword.control.import
|
2021-10-05 05:18:15 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
"return"
|
|
|
|
"break"
|
|
|
|
"continue"
|
2022-09-03 00:22:07 +02:00
|
|
|
] @keyword.control.return
|
2021-10-05 05:18:15 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
"defer"
|
|
|
|
"errdefer"
|
|
|
|
"async"
|
|
|
|
"nosuspend"
|
|
|
|
"await"
|
|
|
|
"suspend"
|
|
|
|
"resume"
|
|
|
|
] @function.macro
|
|
|
|
|
2021-08-28 06:32:01 +02:00
|
|
|
[
|
2022-01-14 15:29:24 +01:00
|
|
|
"comptime"
|
2021-08-28 06:32:01 +02:00
|
|
|
"inline"
|
|
|
|
"noinline"
|
|
|
|
"asm"
|
|
|
|
"callconv"
|
|
|
|
"noalias"
|
2021-10-05 05:18:15 +02:00
|
|
|
] @keyword.directive
|
2021-08-28 06:32:01 +02:00
|
|
|
|
|
|
|
[
|
|
|
|
(CompareOp)
|
|
|
|
(BitwiseOp)
|
|
|
|
(BitShiftOp)
|
|
|
|
(AdditionOp)
|
2022-01-14 15:29:24 +01:00
|
|
|
(AssignOp)
|
2021-08-28 06:32:01 +02:00
|
|
|
(MultiplyOp)
|
|
|
|
(PrefixOp)
|
|
|
|
"*"
|
|
|
|
"**"
|
|
|
|
"->"
|
|
|
|
".?"
|
|
|
|
".*"
|
2021-10-05 05:18:15 +02:00
|
|
|
"?"
|
2021-08-28 06:32:01 +02:00
|
|
|
] @operator
|
|
|
|
|
|
|
|
[
|
|
|
|
";"
|
|
|
|
"."
|
|
|
|
","
|
|
|
|
":"
|
|
|
|
] @punctuation.delimiter
|
|
|
|
|
|
|
|
[
|
|
|
|
".."
|
|
|
|
"..."
|
2021-10-05 05:18:15 +02:00
|
|
|
] @punctuation.special
|
|
|
|
|
|
|
|
[
|
2021-08-28 06:32:01 +02:00
|
|
|
"["
|
|
|
|
"]"
|
|
|
|
"("
|
|
|
|
")"
|
|
|
|
"{"
|
|
|
|
"}"
|
|
|
|
(Payload "|")
|
|
|
|
(PtrPayload "|")
|
|
|
|
(PtrIndexPayload "|")
|
2021-10-05 05:18:15 +02:00
|
|
|
] @punctuation.bracket
|
|
|
|
|
2022-09-03 00:22:07 +02:00
|
|
|
(ERROR) @keyword.control.exception
|