feat: add support for gdshader (#6153)

Godot shading language

---------

Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
This commit is contained in:
GodOfAvacyn 2024-02-29 02:30:33 -08:00 committed by GitHub
parent 4349af8a6e
commit 06b5fda797
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 157 additions and 0 deletions

View file

@ -238,6 +238,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
- [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn)
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @PrestonKnopp)
- [x] [gdshader](https://github.com/GodOfAvacyn/tree-sitter-gdshader) (maintained by @godofavacyn)
- [x] [git_config](https://github.com/the-mikedavis/tree-sitter-git-config) (maintained by @amaanq)
- [x] [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) (maintained by @gbprod)
- [x] [gitattributes](https://github.com/ObserverOfTime/tree-sitter-gitattributes) (maintained by @ObserverOfTime)

View file

@ -194,6 +194,9 @@
"gdscript": {
"revision": "b5dea4d852db65f0872d849c24533eb121e03c76"
},
"gdshader": {
"revision": "ffd9f958df13cae04593781d7d2562295a872455"
},
"git_config": {
"revision": "9c2a1b7894e6d9eedfe99805b829b4ecd871375e"
},

View file

@ -619,6 +619,15 @@ list.gdscript = {
readme_name = "Godot (gdscript)",
}
list.gdshader = {
install_info = {
url = "https://github.com/GodOfAvacyn/tree-sitter-gdshader",
files = { "src/parser.c" },
},
filetype = "gdshaderinc",
maintainers = { "@godofavacyn" },
}
list.git_rebase = {
install_info = {
url = "https://github.com/the-mikedavis/tree-sitter-git-rebase",

View file

@ -0,0 +1,142 @@
[
"render_mode"
"shader_type"
"group_uniforms"
"global"
"instance"
"const"
"varying"
"uniform"
"struct"
] @keyword
[
(precision_qualifier)
(interpolation_qualifier)
] @type.qualifier
[
"in"
"out"
"inout"
] @keyword.storage
[
"while"
"for"
] @keyword.repeat
[
"continue"
"break"
"return"
] @keyword.return
[
"if"
"else"
"switch"
"case"
"default"
] @keyword.conditional
[
"#"
"include"
] @keyword.directive
(string) @string
[
"="
"+="
"-="
"!"
"~"
"+"
"-"
"*"
"/"
"%"
"||"
"&&"
"|"
"^"
"&"
"=="
"!="
">"
">="
"<="
"<"
"<<"
">>"
"++"
"--"
] @operator
(boolean) @boolean
(integer) @number
(float) @number.float
[
"."
","
";"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(builtin_type) @type.builtin
(ident_type) @type.definition
[
(shader_type)
(render_mode)
(hint_name)
] @attribute
(builtin_variable) @constant.builtin
(builtin_function) @function.builtin
(group_uniforms_declaration
group_name: (ident) @property
subgroup_name: (ident) @property)
(struct_declaration
name: (ident) @type)
(struct_member
name: (ident) @property)
(function_declaration
name: (ident) @function)
(parameter
name: (ident) @variable.parameter)
(member_expr
member: (ident) @property)
(call_expr
function:
[
(ident)
(builtin_type)
] @function)
(call_expr
function: (builtin_type) @function.call)
(comment) @comment @spell

View file

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))