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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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
TypePrinter
to see if there is an option where it prints types such a way that it can be used for variable declaration but could not find any.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.
All reactions