-
Notifications
You must be signed in to change notification settings - Fork 34
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 on range of struct field #43
Comments
Yes, that is the bug in the grammar. PR is welcome |
I've been trying to figure it out, but my understanding of tree-sitter / parsing in general is too limited. I believe the root issue here is that the You can see this when parsing
When it then encounters the Note that without the Digging a bit deeper I found this also happens outside of the For example: // ...
if (test) begin
foo.bar = 3;
foo = bar.baz;
end
// ... Parses to:
Any thoughts on how to continue? |
Thank you for the investigation. In the following test case. module mod ();
always_comb foo = bar.baz;
endmodule
It is quite strange seing (source_file (module_declaration
(module_header (module_keyword) (simple_identifier))
(module_nonansi_header (list_of_ports))
(module_or_generate_item (always_construct (always_keyword)
(statement (statement_item (blocking_assignment (operator_assignment
(variable_lvalue (simple_identifier))
(assignment_operator)
(expression (primary
(function_subroutine_call (subroutine_call (method_call // <- is it function call?
(primary (simple_identifier))
(method_call_body (method_identifier (method_identifier (simple_identifier))))
)))
))
))))
))
)) Where is goes wrong is adding packed dimension to the function call: module mod ();
always_comb foo = bar.baz[7:0];
endmodule (source_file (module_declaration
(module_header (module_keyword) (simple_identifier))
(module_nonansi_header (list_of_ports))
(ERROR
(always_keyword)
(variable_lvalue (simple_identifier))
(assignment_operator)
(constant_function_call (function_subroutine_call (subroutine_call (method_call (primary (simple_identifier)) (method_call_body (method_identifier (method_identifier (simple_identifier))))))))
(packed_dimension
(constant_range
(constant_expression (constant_primary (primary_literal (integral_number (decimal_number (unsigned_number))))))
(constant_expression (constant_primary (primary_literal (integral_number (decimal_number (unsigned_number))))))
)
)
)
(module_or_generate_item (package_or_generate_item_declaration))
)) I have to look at the grammar to see how that should be resolved. |
I'm getting a parsing error when trying to parse this construct:
Parsing result:
The error seems to be located at the
bar.baz[15:6]
part.Removing either the
.baz
or[15:6]
resolves the error.The text was updated successfully, but these errors were encountered: