Closed qarlosalberto closed 1 year ago
Yes, it's possible. Well, line number is fairly easy. Comments are perhaps ambiguous about which you want included and which you don't. This will certainly balloon the size of the JSON so it might not be practical for a large design.
That's cool.
My idea is to use slang in TerosHDL (https://terostechnology.github.io/terosHDLdoc/). Currently I'm using for the parser tree-sitter-verilog (https://github.com/tree-sitter/tree-sitter-verilog)
How you can see I extract the comments in the code to generate the documentation: https://terostechnology.github.io/terosHDLdoc/documenter/start.html
So I would like to do the same using slang instead tree-sitter-verilog
Ah nice. You might be better off with using slang as a library and having it dump just the various entities you care about and their comments, since you probably don't care about all the expression / statement trees that will otherwise clog up the JSON. I can provide assistance with that if you want.
Perfect! Sadly I'm not familiarized with C++, but I will try it.
I added a set of Python bindings along with a (very) simple example of using them to extract comments. Hopefully that helps.
Thanks!!
El mar., 9 ago. 2022 14:55, Michael Popoloski @.***> escribió:
I added a set of Python bindings along with a (very) simple example of using them to extract comments. Hopefully that helps.
— Reply to this email directly, view it on GitHub https://github.com/MikePopoloski/slang/issues/557#issuecomment-1209345900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNN4RZ7ONF5EZF366EN4STVYJIKRANCNFSM52I4EPMQ . You are receiving this because you authored the thread.Message ID: @.***>
Is it possible show the line number and comments in the ast JSON output?