MikePopoloski / slang

SystemVerilog compiler and language services
MIT License
558 stars 122 forks source link

slang cannot handle macro expansion correctly when macro argument contain "*" #922

Closed hongping closed 2 months ago

hongping commented 3 months ago

Describe the bug slang cannot handle when the argument for macro has '*'

To Reproduce Source code:

`define import_base(_pkg)\
    import _pkg;

module test7();
    `import_base(uvm_pkg::*)
endmodule

slang will error as:

tests/unittests/data/test7.sv:4:16: error: expected 'endmodule'
module test7();
               ^
tests/unittests/data/test7.sv:4:1: note: to match this 'module'
module test7();
^
tests/unittests/data/test7.sv:6:10: error: expected ')'
hongping commented 3 months ago

the problem is whenever the source code has ( or ), it is lex as OpenParenthesisStar or StarCloseParenthesis, which makes the macro expansion can't find ( or ).

MikePopoloski commented 2 months ago

Fixed in 9705113788c5a11749ae463f3ee3e49751948666