143 lines
3.0 KiB
Scheme
143 lines
3.0 KiB
Scheme
; Broad defaults; specific contexts below override them.
|
|
(identifier) @variable
|
|
|
|
; Comments and literals
|
|
(comment) @comment
|
|
(string_literal) @string
|
|
(multiline_string_literal) @string
|
|
(character_literal) @string.special
|
|
(integer_literal) @number
|
|
(float_literal) @number
|
|
(boolean_literal) @boolean
|
|
(null_literal) @constant.builtin
|
|
(undefined_literal) @constant.builtin
|
|
(unreachable_literal) @keyword
|
|
|
|
; Declarations
|
|
(function_declaration name: (identifier) @function)
|
|
(test_declaration name: (identifier) @function)
|
|
(record_declaration name: (identifier) @type)
|
|
(enum_declaration name: (identifier) @type)
|
|
(opaque_declaration name: (identifier) @type)
|
|
(distinct_declaration name: (identifier) @type)
|
|
(alias_declaration name: (identifier) @type)
|
|
(binding_declaration name: (identifier) @variable)
|
|
(binding_declaration name: (identifier) @constant operator: "::")
|
|
(parameter_group name: (identifier) @variable.parameter)
|
|
(parameter_group "$" . name: (identifier) @constant)
|
|
(parameter_group "$" @attribute)
|
|
(comptime_block "$" @attribute)
|
|
(conditional_capture name: (identifier) @variable.parameter)
|
|
(loop_capture item: (identifier) @variable.parameter)
|
|
(loop_capture index: (identifier) @variable.parameter)
|
|
(match_capture name: (identifier) @variable.parameter)
|
|
(inline_match_capture value: (identifier) @variable.parameter)
|
|
(inline_match_capture tag: (identifier) @variable.parameter)
|
|
(capture_list (identifier) @variable.parameter)
|
|
(record_field name: (member_name) @property)
|
|
(enum_member name: (member_name) @constant)
|
|
(import_declaration alias: (identifier) @constant @module)
|
|
|
|
; Types
|
|
(primitive_type) @type.builtin
|
|
(type_identifier) @type
|
|
(type_identifier (identifier) @type)
|
|
(type_call function: (type_identifier) @type)
|
|
(array_type length: (identifier) @constant)
|
|
((type_call
|
|
arguments: (argument_list
|
|
(identifier) @type))
|
|
(#match? @type "^[A-Z][A-Za-z0-9_]*$"))
|
|
|
|
; Expressions
|
|
(call_expression function: (identifier) @function)
|
|
(field_expression field: (member_name) @property)
|
|
(call_expression
|
|
function: (field_expression
|
|
field: (member_name) @function))
|
|
(field_expression field: (integer_literal) @property)
|
|
(record_initializer name: (member_name) @property)
|
|
(enum_literal name: (member_name) @constructor)
|
|
|
|
; Keywords
|
|
[
|
|
"test"
|
|
"proc"
|
|
"func"
|
|
"c_func"
|
|
"struct"
|
|
"c_struct"
|
|
"opaque"
|
|
"union"
|
|
"enum"
|
|
"distinct"
|
|
"alias"
|
|
"import"
|
|
"return"
|
|
"try"
|
|
"catch"
|
|
"mut"
|
|
"orelse"
|
|
"and"
|
|
"or"
|
|
"xor"
|
|
"if"
|
|
"while"
|
|
"for"
|
|
"inline"
|
|
"break"
|
|
"continue"
|
|
"defer"
|
|
"errdefer"
|
|
"yield"
|
|
"match"
|
|
"else"
|
|
] @keyword
|
|
|
|
(visibility_modifier ["hide" "file" "package"] @attribute)
|
|
|
|
; Operators
|
|
[
|
|
"::"
|
|
":="
|
|
"="
|
|
"+="
|
|
"-="
|
|
"*="
|
|
"/="
|
|
"&="
|
|
"|="
|
|
"xor="
|
|
"<<="
|
|
">>="
|
|
"<<|="
|
|
"+"
|
|
"-"
|
|
"*"
|
|
"/"
|
|
"=="
|
|
"!="
|
|
"<"
|
|
"<="
|
|
">"
|
|
">="
|
|
"&"
|
|
"|"
|
|
"<<"
|
|
">>"
|
|
"<<|"
|
|
".."
|
|
"..="
|
|
"!"
|
|
"~"
|
|
"?"
|
|
"^"
|
|
"@"
|
|
] @operator
|
|
(visibility_modifier "@" @attribute)
|
|
|
|
; Punctuation
|
|
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
|
["," ":" ";" "."] @punctuation.delimiter
|
|
|