Add Move language support

pull/10505/head
Blaž Hrastnik 7 months ago
parent 1d23796ad1
commit f06a166962

@ -3544,3 +3544,17 @@ comment-token = ";"
[[grammar]] [[grammar]]
name = "xtc" name = "xtc"
source = { git = "https://github.com/Alexis-Lapierre/tree-sitter-xtc", rev = "7bc11b736250c45e25cfb0215db2f8393779957e" } source = { git = "https://github.com/Alexis-Lapierre/tree-sitter-xtc", rev = "7bc11b736250c45e25cfb0215db2f8393779957e" }
[[language]]
name = "move"
scope = "source.move"
injection-regex = "move"
roots = ["Move.toml"]
file-types = ["move"]
comment-token = "//"
indent = { tab-width = 4, unit = " " }
language-servers = []
[[grammar]]
name = "move"
source = { git = "https://github.com/tzakian/tree-sitter-move", rev = "8bc0d1692caa8763fef54d48068238d9bf3c0264" }

@ -0,0 +1,157 @@
(ability) @keyword
; ---
; Primitives
; ---
(address_literal) @constant
(bool_literal) @constant.builtin.boolean
(num_literal) @constant.numeric
[
(hex_string_literal)
(byte_string_literal)
] @string
; TODO: vector_literal
[
(line_comment)
(block_comment)
] @comment
(annotation) @function.macro
(borrow_expression "&" @keyword.storage.modifier.ref)
(borrow_expression "&mut" @keyword.storage.modifier.mut)
(constant_identifier) @constant
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
(function_identifier) @function
(struct_identifier) @type
(pack_expression
access: (module_access
member: (identifier) @type))
(apply_type
(module_access
member: (identifier) @type))
(field_identifier) @variable.other.member
; -------
; Functions
; -------
(call_expression
access: (module_access
member: (identifier) @function))
(macro_call_expression
access: (macro_module_access
access: (module_access
member: [(identifier) @function.macro])
"!" @function.macro))
; -------
; Paths
; -------
(module_identifier) @namespace
; -------
; Operators
; -------
[
"*"
"="
"!"
] @operator
(binary_operator) @operator
; ---
; Punctuation
; ---
[
"::"
"."
";"
","
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
[
"abort"
; "acquires"
"as"
"break"
"const"
"continue"
"copy"
"else"
"false"
"friend"
"fun"
"has"
"if"
; "invariant"
"let"
"loop"
"module"
"move"
"native"
"public"
"return"
; "script"
"spec"
"struct"
"true"
"use"
"while"
"entry"
; "aborts_if"
; "aborts_with"
"address"
"apply"
"assume"
; "axiom"
; "choose"
"decreases"
; "emits"
"ensures"
"except"
; "forall"
"global"
"include"
"internal"
"local"
; "min"
; "modifies"
"mut"
"phantom"
"post"
"pragma"
; "requires"
; "Self"
"schema"
"succeeds_if"
"to"
; "update"
"where"
"with"
] @keyword
(primitive_type) @type.buildin
(identifier) @variable
Loading…
Cancel
Save