mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
Add WGSL parser
This commit is contained in:
parent
fad7da5046
commit
1a58c71b73
5 changed files with 122 additions and 0 deletions
|
|
@ -263,6 +263,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (experimental, maintained by @zegervdv)
|
- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (experimental, maintained by @zegervdv)
|
||||||
- [x] [vim](https://github.com/vigoux/tree-sitter-viml) (maintained by @vigoux)
|
- [x] [vim](https://github.com/vigoux/tree-sitter-viml) (maintained by @vigoux)
|
||||||
- [x] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo)
|
- [x] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo)
|
||||||
|
- [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok)
|
||||||
- [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd)
|
- [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd)
|
||||||
- [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro)
|
- [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro)
|
||||||
- [x] [zig](https://github.com/maxxnino/tree-sitter-zig) (maintained by @maxxnino)
|
- [x] [zig](https://github.com/maxxnino/tree-sitter-zig) (maintained by @maxxnino)
|
||||||
|
|
|
||||||
1
ftdetect/wgsl.vim
Normal file
1
ftdetect/wgsl.vim
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
au BufRead,BufNewFile *.wgsl set filetype=wgsl
|
||||||
|
|
@ -1025,6 +1025,15 @@ list.astro = {
|
||||||
maintainers = { "@virchau13" },
|
maintainers = { "@virchau13" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.wgsl = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/szebniok/tree-sitter-wgsl",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
},
|
||||||
|
maintainers = { "@szebniok" },
|
||||||
|
filetype = "wgsl"
|
||||||
|
}
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
list = list,
|
list = list,
|
||||||
filetype_to_parsername = filetype_to_parsername,
|
filetype_to_parsername = filetype_to_parsername,
|
||||||
|
|
|
||||||
10
queries/wgsl/folds.scm
Normal file
10
queries/wgsl/folds.scm
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[
|
||||||
|
(struct_declaration)
|
||||||
|
(function_declaration)
|
||||||
|
(if_statement)
|
||||||
|
(switch_statement)
|
||||||
|
(switch_body)
|
||||||
|
(loop_statement)
|
||||||
|
(for_statement)
|
||||||
|
(while_statement)
|
||||||
|
] @fold
|
||||||
101
queries/wgsl/highlights.scm
Normal file
101
queries/wgsl/highlights.scm
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
(identifier) @variable
|
||||||
|
(int_literal) @number
|
||||||
|
(float_literal) @float
|
||||||
|
(bool_literal) @boolean
|
||||||
|
|
||||||
|
(type_declaration) @type
|
||||||
|
|
||||||
|
(function_declaration
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
|
(parameter
|
||||||
|
(variable_identifier_declaration (identifier) @parameter))
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
(identifier) @structure)
|
||||||
|
|
||||||
|
(struct_declaration
|
||||||
|
(struct_member (variable_identifier_declaration (identifier) @field)))
|
||||||
|
|
||||||
|
(type_constructor_or_function_call_expression
|
||||||
|
(type_declaration) @function)
|
||||||
|
|
||||||
|
[
|
||||||
|
"struct"
|
||||||
|
"bitcast"
|
||||||
|
"discard"
|
||||||
|
"enable"
|
||||||
|
"fallthrough"
|
||||||
|
"fn"
|
||||||
|
"let"
|
||||||
|
"private"
|
||||||
|
"read"
|
||||||
|
"read_write"
|
||||||
|
"storage"
|
||||||
|
"type"
|
||||||
|
"uniform"
|
||||||
|
"var"
|
||||||
|
"workgroup"
|
||||||
|
"write"
|
||||||
|
"override"
|
||||||
|
(texel_format)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
"fn" @keyword.function
|
||||||
|
|
||||||
|
"return" @keyword.return
|
||||||
|
|
||||||
|
[ "," "." ":" ";" ] @punctuation.delimiter
|
||||||
|
|
||||||
|
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"loop"
|
||||||
|
"for"
|
||||||
|
"while"
|
||||||
|
"break"
|
||||||
|
"continue"
|
||||||
|
"continuing"
|
||||||
|
] @repeat
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"switch"
|
||||||
|
"case"
|
||||||
|
"default"
|
||||||
|
] @conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"&"
|
||||||
|
"&&"
|
||||||
|
"/"
|
||||||
|
"!"
|
||||||
|
"="
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
">"
|
||||||
|
">="
|
||||||
|
">>"
|
||||||
|
"<"
|
||||||
|
"<="
|
||||||
|
"<<"
|
||||||
|
"%"
|
||||||
|
"-"
|
||||||
|
"+"
|
||||||
|
"|"
|
||||||
|
"||"
|
||||||
|
"*"
|
||||||
|
"~"
|
||||||
|
"^"
|
||||||
|
"@"
|
||||||
|
"++"
|
||||||
|
"--"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
(attribute
|
||||||
|
(identifier) @attribute)
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
Loading…
Add table
Add a link
Reference in a new issue