javalang
javalang copied to clipboard
Include position information in all AST nodes
The Node base class should include a 'position' attribute. This should be populated with position information for all nodes types in the parser. The position should be copied from the first token associated with each AST node.
Currently the information only seems to be there for Field and Method declarations. Any particular reason why:
- the position information is private?
- the other nodes don't have the position information?
Another user needed the position information in a couple of limited cases. I filed this issue to follow up that change with more complete support. I would absolutely like this information to be available on all AST nodes as a public property, but simply haven't taken the time to implement it yet.
Hey Guys, is there a way to easily get the position from MethodDeclarations ? I've been trying to access this and can only acess via tokenizer, but im using filter ClassDeclarations to get methods.
Any tips for me ? Thank you very much!
I think the position
value for AST nodes is vital information, especially in AST analyses. Is there any progress on this issue?
Thank you for a helpful tools for extracting AST nodes, but currently the nodes having position excluede some that are Assignment,BinaryOperation,ReferenceType and so on, these nodes are significant to figure out the preoblems.Hoping to the next work including them.