mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
refactor(v)!: update upstream repository
This commit is contained in:
parent
c9bb5a5a7f
commit
46b1ad3de2
6 changed files with 230 additions and 178 deletions
|
|
@ -543,7 +543,7 @@
|
|||
"revision": "14e47600afef0affffcbfbe1543381b1ac8fbc5c"
|
||||
},
|
||||
"v": {
|
||||
"revision": "f1b3a99285a58c6f5fe8add47877cde664b75a60"
|
||||
"revision": "e14fdf6e661b10edccc744102e4ccf0b187aa8ad"
|
||||
},
|
||||
"vala": {
|
||||
"revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b"
|
||||
|
|
|
|||
|
|
@ -1600,12 +1600,12 @@ list.uxntal = {
|
|||
|
||||
list.v = {
|
||||
install_info = {
|
||||
url = "https://github.com/vlang/vls",
|
||||
url = "https://github.com/v-analyzer/v-analyzer",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
location = "tree_sitter_v",
|
||||
},
|
||||
filetype = "vlang",
|
||||
maintainers = { "@kkharji" },
|
||||
maintainers = { "@kkharji", "@amaanq" },
|
||||
}
|
||||
|
||||
list.vala = {
|
||||
|
|
|
|||
|
|
@ -1,196 +1,174 @@
|
|||
;; reference https://github.com/vlang/vls
|
||||
;; rev: c3e9874fa6c3b38beaa50d53aff4967403e251a4
|
||||
|
||||
;; Identifiers -------------------
|
||||
(import_path) @namespace
|
||||
(module_identifier) @variable.builtin
|
||||
(identifier) @variable
|
||||
(interpreted_string_literal) @string
|
||||
(string_interpolation) @none
|
||||
|
||||
; TODO: Have different highlight to make then standout + highlight }{$ as special
|
||||
; ((string_interpolation
|
||||
; (identifier) @constant
|
||||
; "$" @punctuation.special
|
||||
; "${" @punctuation.special
|
||||
; "}" @punctuation.special))
|
||||
|
||||
[(type_identifier) (array_type) (pointer_type)] @type
|
||||
|
||||
(field_identifier) @property
|
||||
|
||||
(builtin_type) @type.builtin
|
||||
|
||||
(parameter_declaration
|
||||
name: (identifier) @parameter)
|
||||
|
||||
(const_spec
|
||||
name: (identifier) @constant)
|
||||
|
||||
((((selector_expression field: (identifier) @property)) @_parent
|
||||
(#not-has-parent? @_parent call_expression special_call_expression)))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "err" "macos" "linux" "windows"))
|
||||
|
||||
(attribute_declaration) @attribute
|
||||
;; C: TODO: fixme make `C`.exten highlighted as variable.builtin
|
||||
; ((binded_identifier) @content
|
||||
; (#offset! @content 0 3 0 -1)
|
||||
; (#match? @content "^C$"))
|
||||
|
||||
;; Function calls ----------------
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(((_
|
||||
function: (selector_expression field: (identifier) @function.call)
|
||||
arguments: (_) @_args)
|
||||
(#not-has-type? @_args arguments_list)))
|
||||
|
||||
((call_expression
|
||||
function: (binded_identifier name: (identifier) @function)
|
||||
@function.call))
|
||||
|
||||
|
||||
;; Function definitions ---------
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_declaration
|
||||
receiver: (parameter_list)
|
||||
name: (identifier) @method)
|
||||
|
||||
((function_declaration
|
||||
(binded_identifier name: (identifier) @function)
|
||||
@function))
|
||||
|
||||
;; Keywords
|
||||
; Includes
|
||||
|
||||
[
|
||||
"import"
|
||||
"module"
|
||||
] @include
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"asm"
|
||||
"assert"
|
||||
"const"
|
||||
"defer"
|
||||
"enum"
|
||||
"goto"
|
||||
"interface"
|
||||
"struct"
|
||||
"sql"
|
||||
"type"
|
||||
"union"
|
||||
"unsafe"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"as"
|
||||
"in"
|
||||
"!in"
|
||||
"or"
|
||||
"is"
|
||||
"!is"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"match"
|
||||
"if"
|
||||
"$if"
|
||||
"else"
|
||||
"$else"
|
||||
"select"
|
||||
] @conditional
|
||||
|
||||
[
|
||||
"for" @repeat
|
||||
"for"
|
||||
"$for"
|
||||
"continue"
|
||||
"break"
|
||||
] @repeat
|
||||
|
||||
[
|
||||
"as"
|
||||
"in"
|
||||
"!in"
|
||||
"or"
|
||||
"is"
|
||||
"!is"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"asm"
|
||||
"assert"
|
||||
"const"
|
||||
"defer"
|
||||
"enum"
|
||||
"go"
|
||||
"goto"
|
||||
"interface"
|
||||
"lock"
|
||||
"mut"
|
||||
"pub"
|
||||
"rlock"
|
||||
"struct"
|
||||
"type"
|
||||
"unsafe"
|
||||
]
|
||||
;; Either not supported or will be dropped
|
||||
;"atomic"
|
||||
;"break"
|
||||
; "continue"
|
||||
;"shared"
|
||||
;"static"
|
||||
;"union"
|
||||
@keyword
|
||||
|
||||
"fn" @keyword.function
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
; "import" @include ;; note: comment out b/c of import_path @namespace
|
||||
[
|
||||
"__global"
|
||||
"shared"
|
||||
"static"
|
||||
"const"
|
||||
] @storageclass
|
||||
|
||||
[
|
||||
"pub"
|
||||
"mut"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"go"
|
||||
"spawn"
|
||||
"lock"
|
||||
"rlock"
|
||||
] @keyword.coroutine
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Namespace
|
||||
|
||||
(module_clause
|
||||
(identifier) @namespace)
|
||||
|
||||
(import_path
|
||||
(import_name) @namespace)
|
||||
|
||||
(import_alias
|
||||
(import_name) @namespace)
|
||||
|
||||
; Literals
|
||||
|
||||
[ (true) (false) ] @boolean
|
||||
|
||||
(interpreted_string_literal) @string
|
||||
|
||||
(string_interpolation) @none
|
||||
|
||||
;; Conditionals ----------------
|
||||
[ "else" "if"] @conditional
|
||||
; Types
|
||||
|
||||
;; Operators ----------------
|
||||
[ "." "," ":" ";"] @punctuation.delimiter
|
||||
(struct_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
[ "(" ")" "{" "}" "[" "]"] @punctuation.bracket
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(array) @punctuation.bracket
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
[
|
||||
"++"
|
||||
"--"
|
||||
(type_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
(type_reference_expression (identifier) @type)
|
||||
|
||||
"~"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
; Labels
|
||||
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
"!="
|
||||
(label_reference) @label
|
||||
|
||||
"<<"
|
||||
">>"
|
||||
; Fields
|
||||
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
(selector_expression field: (reference_expression (identifier) @field))
|
||||
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"&="
|
||||
"|="
|
||||
"^="
|
||||
"<<="
|
||||
">>="
|
||||
(field_name) @field
|
||||
|
||||
"="
|
||||
":="
|
||||
"=="
|
||||
(struct_field_declaration
|
||||
name: (identifier) @field)
|
||||
|
||||
"?"
|
||||
"<-"
|
||||
"$"
|
||||
".."
|
||||
"..."]
|
||||
@operator
|
||||
; Parameters
|
||||
|
||||
(parameter_declaration
|
||||
name: (identifier) @parameter)
|
||||
|
||||
(receiver
|
||||
name: (identifier) @parameter)
|
||||
|
||||
; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#has-ancestor? @constant compile_time_if_expression))
|
||||
|
||||
(enum_fetch
|
||||
(reference_expression) @constant)
|
||||
|
||||
(enum_field_definition
|
||||
(identifier) @constant)
|
||||
|
||||
(const_definition
|
||||
name: (identifier) @constant)
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "err" "macos" "linux" "windows"))
|
||||
|
||||
; Attributes
|
||||
|
||||
(attribute) @attribute
|
||||
|
||||
; Functions
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_declaration
|
||||
receiver: (receiver)
|
||||
name: (identifier) @method)
|
||||
|
||||
(call_expression
|
||||
name: (selector_expression
|
||||
field: (reference_expression) @method.call))
|
||||
|
||||
(call_expression
|
||||
name: (reference_expression) @function.call)
|
||||
|
||||
;; Builtin Functions, maybe redundant with (builtin_type)
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"eprint"
|
||||
"eprintln"
|
||||
"error"
|
||||
|
|
@ -389,25 +367,101 @@
|
|||
"vstrlen_char"
|
||||
"winapi_lasterr_str"))
|
||||
|
||||
; Operators
|
||||
|
||||
;; Literals
|
||||
[
|
||||
"++"
|
||||
"--"
|
||||
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
|
||||
"~"
|
||||
"&"
|
||||
"|"
|
||||
"^"
|
||||
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
"!="
|
||||
|
||||
"<<"
|
||||
">>"
|
||||
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"&="
|
||||
"|="
|
||||
"^="
|
||||
"<<="
|
||||
">>="
|
||||
|
||||
"="
|
||||
":="
|
||||
"=="
|
||||
|
||||
"?"
|
||||
"<-"
|
||||
"$"
|
||||
".."
|
||||
"..."
|
||||
] @operator
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "." "," ":" ";" ] @punctuation.delimiter
|
||||
|
||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
||||
|
||||
; Literals
|
||||
|
||||
(int_literal) @number
|
||||
|
||||
(rune_literal) @string
|
||||
(float_literal) @float
|
||||
|
||||
(raw_string_literal) @string
|
||||
[
|
||||
(c_string_literal)
|
||||
(raw_string_literal)
|
||||
(interpreted_string_literal)
|
||||
(string_interpolation)
|
||||
(rune_literal)
|
||||
] @string
|
||||
|
||||
(string_interpolation
|
||||
(braced_interpolation_opening) @punctuation.bracket
|
||||
(interpolated_expression) @none
|
||||
(braced_interpolation_closing) @punctuation.bracket)
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(float_literal) @float
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
[(true) (false)] @boolean
|
||||
(nil) @constant.builtin
|
||||
|
||||
(ERROR) @error
|
||||
(none) @variable.builtin
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(_
|
||||
(comment)+ @comment.documentation
|
||||
[(function_declaration) (type_declaration) (const_spec) (enum_declaration)])
|
||||
[(function_declaration) (type_declaration) (enum_declaration)])
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
[(import_declaration)
|
||||
(const_declaration)
|
||||
(type_declaration)
|
||||
(literal_value)
|
||||
(type_initializer)
|
||||
(block)
|
||||
(map)
|
||||
(map_init_expression)
|
||||
(call_expression)
|
||||
(parameter_list)]
|
||||
@indent.begin
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
;; regex for the methods defined in `re` module
|
||||
((call_expression
|
||||
function: (selector_expression
|
||||
field: (identifier) @_re)
|
||||
name: (selector_expression
|
||||
field: (reference_expression (identifier) @_re))
|
||||
arguments: (argument_list
|
||||
(raw_string_literal) @regex (#offset! @regex 0 2 0 -1)))
|
||||
(argument (literal (raw_string_literal) @regex (#offset! @regex 0 2 0 -1)))))
|
||||
(#any-of? @_re "regex_base" "regex_opt" "compile_opt"))
|
||||
|
|
|
|||
|
|
@ -1,25 +1,24 @@
|
|||
((function_declaration
|
||||
name: (identifier) @definition.function)) ;@function
|
||||
|
||||
(short_var_declaration
|
||||
left: (expression_list
|
||||
(identifier) @definition.var))
|
||||
(var_declaration
|
||||
var_list: (expression_list
|
||||
(reference_expression
|
||||
(identifier) @definition.var)))
|
||||
|
||||
((function_declaration
|
||||
name: (binded_identifier
|
||||
name: (identifier) @definition.function)))
|
||||
name: (identifier) @definition.function))
|
||||
|
||||
(const_declaration (const_spec (identifier) @definition.var))
|
||||
(const_declaration (const_definition name: (identifier) @definition.var))
|
||||
|
||||
(identifier) @reference
|
||||
(type_identifier) @reference
|
||||
|
||||
((call_expression function: (identifier) @reference)
|
||||
((call_expression name: (reference_expression (identifier)) @reference)
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
((call_expression
|
||||
function: (selector_expression
|
||||
field: (identifier) @definition.function))
|
||||
name: (selector_expression
|
||||
field: (reference_expression (identifier) @definition.function)))
|
||||
(#set! reference.kind "call"))
|
||||
|
||||
(source_file) @scope
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue