mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 03:10:04 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,19 +1,16 @@
|
|||
; Preprocs
|
||||
|
||||
[
|
||||
(calling_convention)
|
||||
(tag)
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
|
||||
[
|
||||
"import"
|
||||
"package"
|
||||
] @keyword.import
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"foreign"
|
||||
"using"
|
||||
|
|
@ -29,9 +26,7 @@
|
|||
"matrix"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"proc"
|
||||
] @keyword.function
|
||||
"proc" @keyword.function
|
||||
|
||||
[
|
||||
"return"
|
||||
|
|
@ -44,7 +39,6 @@
|
|||
] @keyword.storage
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
|
|
@ -67,7 +61,6 @@
|
|||
(#set! "priority" 105))
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
|
|
@ -75,116 +68,163 @@
|
|||
] @keyword.repeat
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Namespaces
|
||||
(package_declaration
|
||||
(identifier) @module)
|
||||
|
||||
(package_declaration (identifier) @module)
|
||||
(import_declaration
|
||||
alias: (identifier) @module)
|
||||
|
||||
(import_declaration alias: (identifier) @module)
|
||||
(foreign_block
|
||||
(identifier) @module)
|
||||
|
||||
(foreign_block (identifier) @module)
|
||||
|
||||
(using_statement (identifier) @module)
|
||||
(using_statement
|
||||
(identifier) @module)
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
(identifier) @variable.parameter
|
||||
":"
|
||||
"="?
|
||||
(identifier)? @constant)
|
||||
|
||||
(parameter (identifier) @variable.parameter ":" "="? (identifier)? @constant)
|
||||
(default_parameter
|
||||
(identifier) @variable.parameter
|
||||
":=")
|
||||
|
||||
(default_parameter (identifier) @variable.parameter ":=")
|
||||
(named_type
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(named_type (identifier) @variable.parameter)
|
||||
|
||||
(call_expression argument: (identifier) @variable.parameter "=")
|
||||
(call_expression
|
||||
argument: (identifier) @variable.parameter
|
||||
"=")
|
||||
|
||||
; Functions
|
||||
(procedure_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(procedure_declaration (identifier) @type)
|
||||
(procedure_declaration
|
||||
(identifier) @function
|
||||
(procedure
|
||||
(block)))
|
||||
|
||||
(procedure_declaration (identifier) @function (procedure (block)))
|
||||
(procedure_declaration
|
||||
(identifier) @function
|
||||
(procedure
|
||||
(uninitialized)))
|
||||
|
||||
(procedure_declaration (identifier) @function (procedure (uninitialized)))
|
||||
(overloaded_procedure_declaration
|
||||
(identifier) @function)
|
||||
|
||||
(overloaded_procedure_declaration (identifier) @function)
|
||||
|
||||
(call_expression function: (identifier) @function.call)
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
; Types
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
(type (identifier) @type)
|
||||
|
||||
((type (identifier) @type.builtin)
|
||||
(#any-of? @type.builtin
|
||||
"bool" "byte" "b8" "b16" "b32" "b64"
|
||||
"int" "i8" "i16" "i32" "i64" "i128"
|
||||
"uint" "u8" "u16" "u32" "u64" "u128" "uintptr"
|
||||
"i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le"
|
||||
"i16be" "i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be"
|
||||
"float" "double" "f16" "f32" "f64" "f16le" "f32le" "f64le" "f16be" "f32be" "f64be"
|
||||
"complex32" "complex64" "complex128" "complex_float" "complex_double"
|
||||
"quaternion64" "quaternion128" "quaternion256"
|
||||
"rune" "string" "cstring" "rawptr" "typeid" "any"))
|
||||
((type
|
||||
(identifier) @type.builtin)
|
||||
(#any-of? @type.builtin "bool" "byte" "b8" "b16" "b32" "b64" "int" "i8" "i16" "i32" "i64" "i128" "uint" "u8" "u16" "u32" "u64" "u128" "uintptr" "i16le" "i32le" "i64le" "i128le" "u16le" "u32le" "u64le" "u128le" "i16be" "i32be" "i64be" "i128be" "u16be" "u32be" "u64be" "u128be" "float" "double" "f16" "f32" "f64" "f16le" "f32le" "f64le" "f16be" "f32be" "f64be" "complex32" "complex64" "complex128" "complex_float" "complex_double" "quaternion64" "quaternion128" "quaternion256" "rune" "string" "cstring" "rawptr" "typeid" "any"))
|
||||
|
||||
"..." @type.builtin
|
||||
|
||||
(struct_declaration (identifier) @type "::")
|
||||
(struct_declaration
|
||||
(identifier) @type
|
||||
"::")
|
||||
|
||||
(enum_declaration (identifier) @type "::")
|
||||
(enum_declaration
|
||||
(identifier) @type
|
||||
"::")
|
||||
|
||||
(union_declaration (identifier) @type "::")
|
||||
(union_declaration
|
||||
(identifier) @type
|
||||
"::")
|
||||
|
||||
(const_declaration (identifier) @type "::" [(array_type) (distinct_type) (bit_set_type) (pointer_type)])
|
||||
(const_declaration
|
||||
(identifier) @type
|
||||
"::"
|
||||
[
|
||||
(array_type)
|
||||
(distinct_type)
|
||||
(bit_set_type)
|
||||
(pointer_type)
|
||||
])
|
||||
|
||||
(struct . (identifier) @type)
|
||||
(struct
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
(field_type . (identifier) @module "." (identifier) @type)
|
||||
(field_type
|
||||
.
|
||||
(identifier) @module
|
||||
"."
|
||||
(identifier) @type)
|
||||
|
||||
(bit_set_type (identifier) @type ";")
|
||||
(bit_set_type
|
||||
(identifier) @type
|
||||
";")
|
||||
|
||||
(procedure_type (parameters (parameter (identifier) @type)))
|
||||
(procedure_type
|
||||
(parameters
|
||||
(parameter
|
||||
(identifier) @type)))
|
||||
|
||||
(polymorphic_parameters (identifier) @type)
|
||||
(polymorphic_parameters
|
||||
(identifier) @type)
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z][a-zA-Z0-9]*$")
|
||||
(#not-has-parent? @type parameter procedure_declaration))
|
||||
|
||||
; Fields
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @variable.member)
|
||||
|
||||
(member_expression "." (identifier) @variable.member)
|
||||
(struct_type
|
||||
"{"
|
||||
(identifier) @variable.member)
|
||||
|
||||
(struct_type "{" (identifier) @variable.member)
|
||||
(struct_field
|
||||
(identifier) @variable.member
|
||||
"="?)
|
||||
|
||||
(struct_field (identifier) @variable.member "="?)
|
||||
|
||||
(field (identifier) @variable.member)
|
||||
(field
|
||||
(identifier) @variable.member)
|
||||
|
||||
; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$")
|
||||
(#not-has-parent? @constant type parameter))
|
||||
|
||||
(member_expression . "." (identifier) @constant)
|
||||
(member_expression
|
||||
.
|
||||
"."
|
||||
(identifier) @constant)
|
||||
|
||||
(enum_declaration "{" (identifier) @constant)
|
||||
(enum_declaration
|
||||
"{"
|
||||
(identifier) @constant)
|
||||
|
||||
; Macros
|
||||
|
||||
((call_expression function: (identifier) @function.macro)
|
||||
((call_expression
|
||||
function: (identifier) @function.macro)
|
||||
(#lua-match? @function.macro "^_*[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
; Attributes
|
||||
|
||||
(attribute (identifier) @attribute "="?)
|
||||
(attribute
|
||||
(identifier) @attribute
|
||||
"="?)
|
||||
|
||||
; Labels
|
||||
|
||||
(label_statement (identifier) @label ":")
|
||||
(label_statement
|
||||
(identifier) @label
|
||||
":")
|
||||
|
||||
; Literals
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @number.float
|
||||
|
|
@ -206,7 +246,6 @@
|
|||
(#any-of? @variable.builtin "context" "self"))
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
":="
|
||||
"="
|
||||
|
|
@ -259,12 +298,20 @@
|
|||
] @keyword.operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"::"
|
||||
|
|
@ -275,14 +322,12 @@
|
|||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
|
||||
[
|
||||
"@"
|
||||
"$"
|
||||
] @punctuation.special
|
||||
|
||||
; Comments
|
||||
|
||||
[
|
||||
(comment)
|
||||
(block_comment)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(block)
|
||||
(declaration)
|
||||
|
|
@ -7,33 +6,54 @@
|
|||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
(package_declaration
|
||||
(identifier) @local.definition.namespace)
|
||||
|
||||
(package_declaration (identifier) @local.definition.namespace)
|
||||
(import_declaration
|
||||
alias: (identifier) @local.definition.namespace)
|
||||
|
||||
(import_declaration alias: (identifier) @local.definition.namespace)
|
||||
(procedure_declaration
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(procedure_declaration (identifier) @local.definition.function)
|
||||
(struct_declaration
|
||||
(identifier) @local.definition.type
|
||||
"::")
|
||||
|
||||
(struct_declaration (identifier) @local.definition.type "::")
|
||||
(enum_declaration
|
||||
(identifier) @local.definition.enum
|
||||
"::")
|
||||
|
||||
(enum_declaration (identifier) @local.definition.enum "::")
|
||||
(union_declaration
|
||||
(identifier) @local.definition.type
|
||||
"::")
|
||||
|
||||
(union_declaration (identifier) @local.definition.type "::")
|
||||
(variable_declaration
|
||||
(identifier) @local.definition.var
|
||||
":=")
|
||||
|
||||
(variable_declaration (identifier) @local.definition.var ":=")
|
||||
(const_declaration
|
||||
(identifier) @local.definition.constant
|
||||
"::")
|
||||
|
||||
(const_declaration (identifier) @local.definition.constant "::")
|
||||
(const_type_declaration
|
||||
(identifier) @local.definition.type
|
||||
":")
|
||||
|
||||
(const_type_declaration (identifier) @local.definition.type ":")
|
||||
(parameter
|
||||
(identifier) @local.definition.parameter
|
||||
":"?)
|
||||
|
||||
(parameter (identifier) @local.definition.parameter ":"?)
|
||||
(default_parameter
|
||||
(identifier) @local.definition.parameter
|
||||
":=")
|
||||
|
||||
(default_parameter (identifier) @local.definition.parameter ":=")
|
||||
(field
|
||||
(identifier) @local.definition.field
|
||||
":")
|
||||
|
||||
(field (identifier) @local.definition.field ":")
|
||||
|
||||
(label_statement (identifier) @local.definition ":")
|
||||
(label_statement
|
||||
(identifier) @local.definition
|
||||
":")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue