tree-sitter-verilog icon indicating copy to clipboard operation
tree-sitter-verilog copied to clipboard

simple_text_macro_usage

Open drom opened this issue 6 years ago • 1 comments

Allow simple_text_macro_usage statements in reasonable places of the grammar:

  • [ ] - vector size. a = `WIDTH'b0;
  • [ ] - delay value. a <= `DELAY b

drom avatar Feb 27 '19 21:02 drom

I took a look at this for the intergral_number case and ran into a couple of issues.

You cannot put non-terminals inside a token() at present (link). So one cannot reuse simple_text_macro_usage inside binary_number without removing token.

If you remove the token() around one of the integral_number children a large number of seemingly unrelated tests start failing (module - with parameters and ios as an example). I believe this is because of conflicting tokens, but I wasn't able to fix the tests.

You could define a new token inside the token() function of binary_number to represent a simple macro usage, but having simple_text_macro_usage visible in the syntax tree might be useful for highlighting.

abradd avatar Jul 04 '21 23:07 abradd