mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-27 11:53:30 +04:00
6bfd001b48
use latest upstream version move comptime from @keyword.function to @keyword.directive use AssignOp enhance indents
235 lines
2.9 KiB
Scheme
235 lines
2.9 KiB
Scheme
[
|
|
(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
|