tree-sitter-wgsl
tree-sitter-wgsl copied to clipboard
Texture type parameters not working?
Hey! Fantastic project!
I'm seeing a discrepancy in how texture_2d
(should be the same for other suffixes) type declarations don't get their parameters parsed somehow compared to other types.
If I parse something like
var u_mat: mat4x4<f32>;
I get
(source_file
(global_variable_declaration
(variable_declaration
(variable_identifier_declaration
(identifier)
(type_declaration
(type_declaration))))))
which I believe is what I expect.
For
var u_texture: texture_2d<f32>;
however this is
(source_file
(global_variable_declaration
(variable_declaration
(variable_identifier_declaration
(identifier)
(type_declaration)))))
where the last (type_declaration)
is then texture_2d<f32>
including the type parameter.
First of all: is this intentional?
Reading the grammar, I think the responsible part is this:
https://github.com/szebniok/tree-sitter-wgsl/blob/272e89ef2aeac74178edb9db4a83c1ffef80a463/grammar.js#L341-L343
but it's not clear to me why that would cause the parsing of the type parameter to fail.
@szebniok can you take a look at this ⬆️