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

Parsing error when referencing a multi-dimensional array

Open YikeZhou opened this issue 2 years ago • 1 comments

Given this:

module top;
  wire a[1:0][1:0];
  assign a[1][0] = 0;
endmodule;

Run tree-sitter like this:

tree-sitter parse top.v

Got this error:

top.v   0 ms    (ERROR [2, 10] - [2, 16])

However, a one-dimensional array works fine.

module top;
  wire a[1:0];
  assign a[0] = 0;
endmodule;

I guess the parser somehow failed to recognize [1][0] as constant_select1 here.

https://github.com/tree-sitter/tree-sitter-verilog/blob/902031343056bc0b11f3e47b33f036a9cf59f58d/grammar.js#L4381-L4388

YikeZhou avatar Sep 23 '23 09:09 YikeZhou

Did you manage how to solve it? i am about to start working with verilog and i have noticed that problem as well.

leosmaia21 avatar Jan 20 '24 17:01 leosmaia21

PR is welcome

drom avatar Jul 10 '25 01:07 drom