tree-sitter-wgsl icon indicating copy to clipboard operation
tree-sitter-wgsl copied to clipboard

Texture type parameters not working?

Open paulgessinger opened this issue 2 years ago • 1 comments

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.

paulgessinger avatar Sep 03 '22 16:09 paulgessinger

@szebniok can you take a look at this ⬆️

jmysliv avatar Nov 15 '23 12:11 jmysliv