nvim-treesitter/queries/vala/highlights.scm

293 lines
3.2 KiB
Scheme
Raw Normal View History

2022-01-29 14:21:10 -03:00
; Variable
(uppercased_identifier) @constant
(namespaced_identifier
left: [
(camel_cased_identifier) @namespace
(identifier) @variable
]
right: [
(identifier) @parameter
(camel_cased_identifier) @type
(uppercased_identifier) @constant
]
)
2022-01-28 19:13:39 -03:00
; Pointers
2022-01-29 11:18:26 -03:00
(address_of_identifier "&" @symbol)
(pointer_type "*" @symbol)
(indirection_identifier "*" @symbol)
2022-01-28 19:13:39 -03:00
; Misc
(number) @number
[
"{"
"}"
"("
")"
2022-01-29 14:30:03 -03:00
"["
"]"
2022-01-28 19:13:39 -03:00
] @punctuation.bracket
[
2022-01-29 11:18:26 -03:00
";"
":"
2022-01-29 11:18:26 -03:00
"."
","
"->"
2022-01-28 19:13:39 -03:00
] @punctuation.delimiter
2022-01-29 11:18:26 -03:00
; Reserved keywords
[
"return"
"yield"
"break"
] @keyword.return
2022-01-29 14:21:10 -03:00
(null) @constant.builtin
2022-01-29 11:18:26 -03:00
[
"typeof"
"is"
2022-01-29 14:21:10 -03:00
] @keyword.operator
[
(modifier)
2022-01-29 11:18:26 -03:00
"var"
"class"
"interface"
(property_parameter)
(this)
"enum"
"new"
"in"
"as"
"try"
"catch"
"requires"
"ensures"
"owned"
"throws"
"delete"
] @keyword
2022-01-28 19:13:39 -03:00
2022-01-29 11:18:26 -03:00
"throw" @exception
2022-01-28 19:13:39 -03:00
2022-01-29 11:18:26 -03:00
[
"if"
"else"
"switch"
"case"
"default"
] @conditional
2022-01-28 19:13:39 -03:00
2022-01-29 11:18:26 -03:00
[
"for"
"foreach"
"while"
"do"
] @repeat
[
(true)
(false)
] @boolean
2022-01-28 19:13:39 -03:00
; Operators
(binary_expression
[
"*"
"/"
"+"
"-"
"%"
"<"
"<="
">"
">="
"=="
"!="
"+="
"-="
"*="
"/="
"%="
"&&"
"||"
"&"
"|"
"^"
"~"
"|="
"&="
"^="
"??"
"="
2022-01-28 19:13:39 -03:00
] @operator
)
(unary_expression
[
"-"
"!"
"--"
"++"
] @operator
)
2022-01-29 14:21:10 -03:00
; Declaration
(declaration
type_name: (_) @type
)
2022-01-28 19:13:39 -03:00
; Methods
(function_definition
type: (_) @type
name: [
(identifier) @method
(camel_cased_identifier) @type
(generic_identifier (_) @type)
(namespaced_identifier
2022-01-29 11:18:26 -03:00
(_) @method .
2022-01-28 19:13:39 -03:00
)
]
)
(function_call
identifier: [
(identifier) @method
(camel_cased_identifier) @type
(generic_identifier (_) @type)
(namespaced_identifier
2022-01-29 11:18:26 -03:00
(_) @method .
2022-01-28 19:13:39 -03:00
)
]
)
; Types
(primitive_type) @type
(nullable_type
(_) @type
"?" @symbol
)
; Comments
(comment) @comment
; Namespace
(namespace
"namespace" @include
2022-01-29 11:18:26 -03:00
(_) @namespace
2022-01-28 19:13:39 -03:00
)
2022-01-29 11:18:26 -03:00
"global::" @namespace
2022-01-28 19:13:39 -03:00
"using" @include
; Classes
(class_declaration
[
(camel_cased_identifier) @type
(generic_identifier (_) @type )
]
)
(class_constructor_definition
[
2022-01-29 11:18:26 -03:00
(_)
(namespaced_identifier (_) @constructor .)
2022-01-28 19:13:39 -03:00
] @constructor
)
(class_destructor
"~" @symbol
(_) @constructor
)
; Interfaces
(interface_declaration
[
(camel_cased_identifier) @type
(generic_identifier (_) @type )
]
)
; Strings and escape sequences
(string_literal) @string
(escape_sequence) @string.escape
(string_template
"@" @symbol
) @string
(string_template_variable) @variable
(string_template_expression) @variable
2022-01-29 11:18:26 -03:00
; New instance from Object
2022-01-28 19:13:39 -03:00
(new_instance
2022-01-29 11:18:26 -03:00
".new" @keyword
2022-01-28 19:13:39 -03:00
)
; GObject construct
"construct" @constructor
; Try statement
(try_statement
exception: (parameter_list (declaration_parameter
(_) @exception
(_) @variable
))
)
; Enum
(enum_declaration
(camel_cased_identifier) @type
)
; Loop
(foreach_statement
loop_item: (identifier) @variable
)
; Casting
(static_cast
2022-01-29 11:18:26 -03:00
type: (_) @type
2022-01-28 19:13:39 -03:00
)
(dynamic_cast
2022-01-29 11:18:26 -03:00
type: (_) @type
2022-01-28 19:13:39 -03:00
)
; Regex
(regex_literal) @string.regex
; Code attribute
(code_attribute
name: (camel_cased_identifier) @attribute
2022-01-29 11:18:26 -03:00
param: (_) @attribute
) @attribute