-
-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
ast_error.py.txt
error.sv.txt
no_error.sv.txt
I have attached three files to help recreate this issue. You'll have to remove the .txt extension to run them locally.
When a compiler directive is inserted in the codebase, it has a potential to "break" the syntax. In error.sv I have made a contrived example that breaks the begin/end of an always_comb block:
always_comb begin
`ifndef MYDEFINE
if (a) begin
`else
if (b) begin
`endif
c = a ^ b;
end
end
This has the downstream effect of breaking the ability of tree-sitter to properly parse the module instantiation.
In ast_error.py you will see this query:
MODULE_INST_QUERY = '''
(module_instantiation
(simple_identifier) @module_name (#eq? @module_name "my_module")
(hierarchical_instance
(name_of_instance
(simple_identifier) @instance_name
)
)
)
'''
When ast_error.py is run against no_error.sv, it properly returns the module instantiation. But it does not when you run it against error.sv.
Command lines:
python ast_error.py error.sv
python ast_error.py no_error.sv
Metadata
Metadata
Assignees
Labels
No labels