tree-sitter / tree-sitter-verilog

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

fix: separate text_macro with argument #57

Closed henry-hsieh closed 2 years ago

henry-hsieh commented 2 years ago

In the latest version, the optional list_of_formal_arguments of text_macro_name will be overwritten by macro_text with arguments:

`define D(x, y) initial $display("start", x, y)
|---        text_macro_definition          ---|
        ^ text_macro_name -> text_macro_identifier -> simple_identifier
         |---          macro_text          ---|

This PR separate this to text_macro_argument_definition and fix the issue (similar to preproc_function_def in tree-sitter-c).

`define D(x, y) initial $display("start", x, y)
|---    text_macro_argument_definition     ---|
        ^ text_macro_identifier -> simple_identifier
         |----|
         list_of_formal_arguments
               |---       macro_text       ---|