Easiest way to print the declaration of a Port/Net/Variable #1111
-
I want to print the definition of Port, Net and Variable using pyslang. So far what I have tried out is get the type member and convert it to string and replace '$' with the variable name if exists or else append the variable name to the end of the string. But this does not work for complex data types like structs or Interfaces since the string conversion prints the definition of the types as well which is not what I want when stating the declaration of a variable. I've been looking into Is there a proper way to print a Port/Net/Variable symbol as a declaration or should I write my own where it takes the dimension/type name and variable name and stitch them together? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Most symbols have a SyntaxNode pointer that you can use to get back to the original declaration and print that if you want. Otherwise if you want it in some specific standardized format then you should write the formatting yourself. The TypePrinter probably has the options you need to get it the way you want. |
Beta Was this translation helpful? Give feedback.
Most symbols have a SyntaxNode pointer that you can use to get back to the original declaration and print that if you want. Otherwise if you want it in some specific standardized format then you should write the formatting yourself. The TypePrinter probably has the options you need to get it the way you want.