Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error when referencing a multi-dimensional array #67

Open
YikeZhou opened this issue Sep 23, 2023 · 1 comment
Open

Parsing error when referencing a multi-dimensional array #67

YikeZhou opened this issue Sep 23, 2023 · 1 comment

Comments

@YikeZhou
Copy link

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.

tree-sitter-verilog/grammar.js

Lines 4381 to 4388 in 9020313

constant_select1: $ => choice( // reordered -> non empty
seq(
'[',
repseq($.constant_expression, ']', '['),
choice($.constant_expression, $._constant_part_select_range),
']'
)
),

@leosmaia21
Copy link

leosmaia21 commented Jan 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants