I want to get the structure of the code, like the function name, the type of args and so on. Is there any ways I can do that?
thanks.
I want to get the structure of the code, like the function name, the type of args and so on. Is there any ways I can do that?
thanks.
Syntax node content (such as names) is not stored in the tree, but you can use the position of the node to read it from the document. Types of things are only available insofar as they are directly encoded in the syntax—this library does not do type inference or anything like that.
To get the function name or variable name from a tree, you need to traverse the tree and extract the information you need from the relevant nodes.
Here are some general steps you can follow:
Note that the specific implementation details of how to traverse the tree and extract the relevant information will depend on the language and tooling you are using.
Ragards : Namesolutions