Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenericVisitorAdapter: print tree? #960

Closed
jjYBdx4IL opened this issue Jun 15, 2017 · 6 comments
Closed

GenericVisitorAdapter: print tree? #960

jjYBdx4IL opened this issue Jun 15, 2017 · 6 comments
Labels
Question (JP usage) How to use JP to inspect/modify the AST - please close your question once answered!
Milestone

Comments

@jjYBdx4IL
Copy link

jjYBdx4IL commented Jun 15, 2017

Hi!

Is there an easy way (some already existing dump utility for debugging etc.) to "visually" print/log the AST? Ie. use traversal depth as indentation size or something similar and print out all nodes?

TY!

@matozoid matozoid added the Question (JP usage) How to use JP to inspect/modify the AST - please close your question once answered! label Jun 15, 2017
@matozoid
Copy link
Contributor

See #753 - @ryan-beckett is working on it. In the mean time I use the debugger from my IDE ;)

@jjYBdx4IL
Copy link
Author

jjYBdx4IL commented Jun 16, 2017

My problem with GenericVisitorAdapter is that, like in that other issue stated somewhere similarly, that I'd have to override a lot of methods, and on top of that, I wouldn't be sure that an update wouldn't introduce a new method/type that I'd miss then. So, a practical solution would be to simply add a single visit method like visit(Node, Object payload) and call it from any of the visit methods, or vice versa, call the specific visit methods from the visit(Node...) method by reflection.

@matozoid
Copy link
Contributor

I'll move what we have into the next release.

@matozoid
Copy link
Contributor

See #964

@matozoid matozoid added this to the 3.2.8 milestone Jun 20, 2017
@matozoid
Copy link
Contributor

You can find XmlPrinter and JsonPrinter in version 3.2.8

@jjYBdx4IL
Copy link
Author

TY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question (JP usage) How to use JP to inspect/modify the AST - please close your question once answered!
Projects
None yet
Development

No branches or pull requests

2 participants