tree-sitter / tree-sitter-verilog

SystemVerilog grammar for tree-sitter
MIT License
93 stars 36 forks source link

Parsing error when referencing a multi-dimensional array #67

Open YikeZhou opened 1 year ago

YikeZhou commented 1 year ago

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

leosmaia21 commented 10 months ago

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