mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat!: drop modules, general refactor and cleanup
This commit is contained in:
parent
310f0925ec
commit
692b051b09
1247 changed files with 6096 additions and 9074 deletions
20
runtime/queries/tact/folds.scm
Normal file
20
runtime/queries/tact/folds.scm
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
; import …
|
||||
(import)+
|
||||
; (…, …)
|
||||
(parameter_list)
|
||||
(argument_list)
|
||||
; {…, …}
|
||||
(instance_argument_list)
|
||||
(destruct_bind_list)
|
||||
; {…; …}
|
||||
(message_body)
|
||||
(struct_body)
|
||||
(contract_body)
|
||||
(trait_body)
|
||||
(function_body)
|
||||
(block_statement)
|
||||
(asm_function_body)
|
||||
; <{ … }>
|
||||
(asm_sequence)
|
||||
] @fold
|
||||
342
runtime/queries/tact/highlights.scm
Normal file
342
runtime/queries/tact/highlights.scm
Normal file
|
|
@ -0,0 +1,342 @@
|
|||
; variable
|
||||
; --------
|
||||
(identifier) @variable
|
||||
|
||||
(destruct_bind
|
||||
name: (identifier) @variable.member
|
||||
bind: (identifier) @variable)
|
||||
|
||||
; variable.builtin
|
||||
; ----------------
|
||||
(self) @variable.builtin
|
||||
|
||||
; variable.parameter
|
||||
; ------------------
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; punctuation.delimiter
|
||||
; ---------------------
|
||||
[
|
||||
";"
|
||||
","
|
||||
"."
|
||||
":"
|
||||
"?"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; punctuation.bracket
|
||||
; -------------------
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; operator
|
||||
; --------
|
||||
[
|
||||
"-"
|
||||
"-="
|
||||
"+"
|
||||
"+="
|
||||
"*"
|
||||
"*="
|
||||
"/"
|
||||
"/="
|
||||
"%"
|
||||
"%="
|
||||
"="
|
||||
"=="
|
||||
"!"
|
||||
"!="
|
||||
"!!"
|
||||
"<"
|
||||
"<="
|
||||
"<<"
|
||||
"<<="
|
||||
">"
|
||||
">="
|
||||
">>"
|
||||
">>="
|
||||
"&"
|
||||
"&="
|
||||
"|"
|
||||
"|="
|
||||
"^"
|
||||
"^="
|
||||
"&&"
|
||||
"&&="
|
||||
"||"
|
||||
"||="
|
||||
"->"
|
||||
".."
|
||||
] @operator
|
||||
|
||||
; constructor
|
||||
; -----------
|
||||
(instance_expression
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(initOf
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(codeOf
|
||||
name: (identifier) @constructor)
|
||||
|
||||
; type
|
||||
; ----
|
||||
(type_identifier) @type
|
||||
|
||||
; type.builtin
|
||||
; ------------
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin "Context" "SendParameters" "StateInit" "StdAddress" "VarAddress"))
|
||||
|
||||
(generic_parameter_list
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
|
||||
(bounced_type
|
||||
"bounced" @type.builtin
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
|
||||
(map_type
|
||||
"map" @type.builtin
|
||||
"<" @punctuation.bracket
|
||||
">" @punctuation.bracket)
|
||||
|
||||
((type_identifier) @type.builtin
|
||||
(#any-of? @type.builtin "Address" "Bool" "Builder" "Cell" "Int" "Slice" "String" "StringBuilder"))
|
||||
|
||||
(tlb_serialization
|
||||
"as" @keyword
|
||||
type: (identifier) @type)
|
||||
|
||||
; string
|
||||
; ------
|
||||
(string) @string
|
||||
|
||||
; string.escape
|
||||
; -------------
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
; string.special.path
|
||||
; -------------------
|
||||
(import
|
||||
name: (string) @string.special.path)
|
||||
|
||||
; boolean
|
||||
; -------
|
||||
(boolean) @boolean
|
||||
|
||||
; constant
|
||||
; --------
|
||||
(global_constant
|
||||
name: (identifier) @constant)
|
||||
|
||||
(storage_constant
|
||||
name: (identifier) @constant)
|
||||
|
||||
; constant.builtin
|
||||
; ----------------
|
||||
(null) @constant.builtin
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"SendDefaultMode" "SendBounceIfActionFail" "SendPayGasSeparately" "SendIgnoreErrors"
|
||||
"SendDestroyIfZero" "SendRemainingValue" "SendRemainingBalance" "SendOnlyEstimateFee"
|
||||
"ReserveExact" "ReserveAllExcept" "ReserveAtMost" "ReserveAddOriginalBalance"
|
||||
"ReserveInvertSign" "ReserveBounceIfActionFail"))
|
||||
|
||||
; property
|
||||
; --------
|
||||
(instance_argument
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(field_access_expression
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(field
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(storage_variable
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
; number
|
||||
; ------
|
||||
(integer) @number
|
||||
|
||||
; keyword
|
||||
; -------
|
||||
[
|
||||
"with"
|
||||
"const"
|
||||
"let"
|
||||
; "public" ; -- not used, but declared in grammar.ohm
|
||||
; "extend" ; -- not used, but declared in grammar.ohm
|
||||
] @keyword
|
||||
|
||||
; keyword.type
|
||||
; ------------
|
||||
[
|
||||
"contract"
|
||||
"trait"
|
||||
"struct"
|
||||
"message"
|
||||
] @keyword.type
|
||||
|
||||
; keyword.function
|
||||
; ----------------
|
||||
[
|
||||
"fun"
|
||||
"native"
|
||||
"asm"
|
||||
] @keyword.function
|
||||
|
||||
; keyword.operator
|
||||
; ----------------
|
||||
"initOf" @keyword.operator
|
||||
|
||||
"codeOf" @keyword.operator
|
||||
|
||||
; keyword.import
|
||||
; --------------
|
||||
"import" @keyword.import
|
||||
|
||||
; keyword.modifier
|
||||
; ---------------
|
||||
[
|
||||
"get"
|
||||
"mutates"
|
||||
"extends"
|
||||
"virtual"
|
||||
"override"
|
||||
"inline"
|
||||
"abstract"
|
||||
] @keyword.modifier
|
||||
|
||||
; keyword.repeat
|
||||
; --------------
|
||||
(foreach_statement
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
"in" @keyword.repeat)
|
||||
|
||||
[
|
||||
"while"
|
||||
"repeat"
|
||||
"do"
|
||||
"until"
|
||||
"foreach"
|
||||
] @keyword.repeat
|
||||
|
||||
; keyword.return
|
||||
; --------------
|
||||
"return" @keyword.return
|
||||
|
||||
; keyword.exception
|
||||
; -----------------
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
] @keyword.exception
|
||||
|
||||
; keyword.conditional
|
||||
; -------------------
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
; keyword.directive.define
|
||||
; ------------------------
|
||||
"primitive" @keyword.directive.define
|
||||
|
||||
; function
|
||||
; --------
|
||||
(native_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(asm_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(global_function
|
||||
name: (identifier) @function)
|
||||
|
||||
(func_identifier) @function
|
||||
|
||||
; function.method
|
||||
; ---------------
|
||||
(init_function
|
||||
"init" @function.method)
|
||||
|
||||
(receive_function
|
||||
"receive" @function.method)
|
||||
|
||||
(bounced_function
|
||||
"bounced" @function.method)
|
||||
|
||||
(external_function
|
||||
"external" @function.method)
|
||||
|
||||
(storage_function
|
||||
name: (identifier) @function.method)
|
||||
|
||||
; function.call
|
||||
; -------------
|
||||
(static_call_expression
|
||||
name: (identifier) @function.call)
|
||||
|
||||
; function.method.call
|
||||
; ---------------
|
||||
(method_call_expression
|
||||
name: (identifier) @function.method.call)
|
||||
|
||||
; asm-specific
|
||||
; ------------
|
||||
(tvm_instruction) @function.call
|
||||
|
||||
(asm_integer) @number
|
||||
|
||||
(asm_string) @string
|
||||
|
||||
(asm_control_register) @string.special.symbol
|
||||
|
||||
(asm_stack_register) @string.special.symbol
|
||||
|
||||
(asm_hex_bitstring) @function.macro
|
||||
|
||||
(asm_bin_bitstring) @function.macro
|
||||
|
||||
(asm_boc_hex) @function.macro
|
||||
|
||||
(asm_cont_name) @variable
|
||||
|
||||
; within asm_sequence
|
||||
[
|
||||
"<{"
|
||||
"}>"
|
||||
"}>c"
|
||||
"}>s"
|
||||
"}>CONT"
|
||||
] @punctuation.bracket
|
||||
|
||||
; attribute
|
||||
; ---------
|
||||
[
|
||||
"@name"
|
||||
"@interface"
|
||||
] @attribute
|
||||
|
||||
; comment
|
||||
; -------
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
52
runtime/queries/tact/indents.scm
Normal file
52
runtime/queries/tact/indents.scm
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
; indent.begin ; indent children when matching this node
|
||||
; ------------
|
||||
[
|
||||
; (..., ...)
|
||||
(parameter_list)
|
||||
(argument_list)
|
||||
; {..., ...}
|
||||
(instance_argument_list)
|
||||
(destruct_bind_list)
|
||||
; {...; ...}
|
||||
(message_body)
|
||||
(struct_body)
|
||||
(contract_body)
|
||||
(trait_body)
|
||||
(function_body)
|
||||
(block_statement)
|
||||
(asm_function_body)
|
||||
; misc.
|
||||
(binary_expression)
|
||||
(ternary_expression)
|
||||
(return_statement)
|
||||
(static_call_expression)
|
||||
(method_call_expression)
|
||||
] @indent.begin
|
||||
|
||||
; indent.branch ; dedent itself when matching this node
|
||||
; -------------
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
">"
|
||||
] @indent.branch
|
||||
|
||||
; indent.end ; marks the end of indented block
|
||||
; ----------
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
">"
|
||||
] @indent.end
|
||||
|
||||
; indent.auto ; behaves like 'autoindent' buffer option
|
||||
; -----------
|
||||
[
|
||||
(comment)
|
||||
(ERROR)
|
||||
] @indent.auto
|
||||
|
||||
; indent.align ; behaves like python aligned/hanging indent
|
||||
; indent.dedent ; dedent children when matching this node
|
||||
; indent.ignore ; do not indent in this node
|
||||
; indent.zero ; sets this node at position 0 (no indent)
|
||||
2
runtime/queries/tact/injections.scm
Normal file
2
runtime/queries/tact/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
83
runtime/queries/tact/locals.scm
Normal file
83
runtime/queries/tact/locals.scm
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
; Scopes @local.scope
|
||||
; -------------------------
|
||||
[
|
||||
(asm_function)
|
||||
(global_function)
|
||||
(init_function)
|
||||
(bounced_function)
|
||||
(receive_function)
|
||||
(external_function)
|
||||
(storage_function)
|
||||
(block_statement)
|
||||
] @local.scope
|
||||
|
||||
; Definitions @local.definition
|
||||
; ------------------------------
|
||||
; variables
|
||||
(storage_variable
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(let_statement
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
; constants
|
||||
(global_constant
|
||||
name: (identifier) @local.definition.constant)
|
||||
|
||||
(storage_constant
|
||||
name: (identifier) @local.definition.constant)
|
||||
|
||||
; functions
|
||||
(asm_function
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(global_function
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
; methods (functions off of contracts and traits)
|
||||
(init_function
|
||||
"init" @local.definition.method
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(bounced_function
|
||||
"bounced" @local.definition.method
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(receive_function
|
||||
"receive" @local.definition.method
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(external_function
|
||||
"external" @local.definition.method
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(storage_function
|
||||
name: (identifier) @local.definition.method
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
; parameters
|
||||
(parameter
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
; user-defined types (structs and messages)
|
||||
(type_identifier) @local.definition.type
|
||||
|
||||
; fields (of messages and structs)
|
||||
(field
|
||||
name: (identifier) @local.definition.field)
|
||||
|
||||
; imports
|
||||
(import
|
||||
name: (string) @local.definition.import)
|
||||
|
||||
; References @local.reference
|
||||
; -----------------------------
|
||||
(self) @local.reference
|
||||
|
||||
(value_expression
|
||||
(identifier) @local.reference)
|
||||
|
||||
(field_access_expression
|
||||
name: (identifier) @local.reference)
|
||||
Loading…
Add table
Add a link
Reference in a new issue