feat(parsers): add wat

This commit is contained in:
Pig Fang 2026-01-06 23:42:42 +08:00
parent b033ab331c
commit 1e103b917c
No known key found for this signature in database
GPG key ID: A8198F548DADA9E2
4 changed files with 173 additions and 0 deletions

View file

@ -322,6 +322,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | @steelsojka
[vimdoc](https://github.com/neovim/tree-sitter-vimdoc) | unstable | `H  J ` | @clason
[vrl](https://github.com/belltoy/tree-sitter-vrl) | unstable | `HFIJL` | @belltoy
[vue](https://github.com/tree-sitter-grammars/tree-sitter-vue) | unstable | `HFIJ ` | @WhyNotHugo, @lucario387
[wat](https://github.com/g-plane/tree-sitter-wat) | unstable | `HF   ` | @g-plane
[wgsl](https://github.com/szebniok/tree-sitter-wgsl) | unstable | `HFIJ ` | @szebniok
[wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI  ` | @theHamsta
[wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | @gshpychka, @MarkMcCulloh

View file

@ -2560,6 +2560,14 @@ return {
requires = { 'html_tags' },
tier = 2,
},
wat = {
install_info = {
revision = '357bbe6053f261b205f5835a87a6ae094226cc57',
url = 'https://github.com/g-plane/tree-sitter-wat',
},
maintainers = { '@g-plane' },
tier = 2,
},
wgsl = {
install_info = {
revision = '40259f3c77ea856841a4e0c4c807705f3e4a2b65',

View file

@ -0,0 +1,21 @@
[
(block_block)
(block_if)
(block_if_else)
(block_if_then)
(block_loop)
(block_try_table)
(module)
(module_field_data)
(module_field_elem)
(module_field_export)
(module_field_func)
(module_field_global)
(module_field_import)
(module_field_memory)
(module_field_start)
(module_field_table)
(module_field_tag)
(rec_type)
(type_def)
] @fold

View file

@ -0,0 +1,143 @@
[
(block_comment)
(line_comment)
] @comment
((block_comment)+ @comment.documentation
(#match? @comment.documentation "^;;;\\s+.*"))
[
"block"
"data"
"declare"
"elem"
"end"
"export"
"field"
"final"
"global"
"item"
"local"
"memory"
"module"
"null"
"offset"
"pagesize"
"param"
"rec"
"ref"
"result"
"shared"
"start"
"sub"
"table"
"tag"
"try_table"
"unshared"
] @keyword
"func" @keyword.function
"import" @keyword.import
[
"type"
"struct"
"array"
] @keyword.type
"mut" @keyword.modifier
"loop" @keyword.repeat
[
"catch"
"catch_ref"
"catch_all"
"catch_all_ref"
] @keyword.exception
[
"if"
"then"
"else"
] @keyword.conditional
[
(integer)
(uinteger)
] @number
(float) @number.float
(instr_name) @operator
[
"("
")"
] @punctuation.bracket
(annotation_start) @attribute
(string) @string
((annotation_elem) @string
(#match? @string "^\".*\"$"))
[
(num_type)
(vec_type)
(packed_type)
] @type.builtin
((ref_type) @type.builtin
(#match? @type.builtin "^(any|eq|i31|struct|array|null|(null)?func|(null)?exn|(null)?extern)ref$"))
((heap_type) @type.builtin
(#match? @type.builtin "^(any|eq|i31|struct|array|null|(null)?func|(null)?exn|(null)?extern)$"))
(identifier) @variable
(index
(uinteger) @variable)
(param
(identifier) @variable.parameter)
(field
(identifier) @variable.member)
(module
(identifier) @module)
([
(block_block)
(block_if)
(block_loop)
(block_try_table)
]
(identifier) @label)
(module_field_func
(identifier) @function)
(extern_type_func
(identifier) @function)
(module_field_start
(index
[
(identifier)
(uinteger)
] @function.call))
(plain_instr
((instr_name) @operator
(#match? @operator "^(return_)?call$"))
[
(identifier)
(integer)
] @function.call)
(type_def
(identifier) @type)