Open
Description
Forgive my ignorance but I'm trying to use Prism to modify Ruby source (add nodes) and then regenerate the source to be interpreted. I'm using Prism.parse(text)
and then implementing a Prism::Visitor
to potentially modify the nodes as they are visited. I assume this is possible but I haven't really seen any examples of it. Finally I would like to 'unparse' the AST back into source code.
The Python equivalent is indeed unparse
which is where I'm taking many of the ideas. They also have a NodeTransformer
which is allowed to modify the nodes in the visit pattern. I don't see equivalents in Prism but perhaps you're always allowed to modify the nodes ... this is Ruby afterall.
Thanks for any help pointing me in the right direction!
Metadata
Metadata
Assignees
Labels
No labels