Use the prism ripper translator if available #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since ruby 3.4, prism is the default parser. There is talk about deprecating ripper in https://bugs.ruby-lang.org/issues/21827.
In order to make possible, bundled/default gems need to not use ripper. Prism actually contains a compatibility layer which can be used for that. It translates the native prism ast into the format that ripper would return.
So, instead of rewriting the whole logic to use native prism, it can just use the compatiblity layer.
I would be open trying to port it to prism without the compatiblity layer if you prefer. That would entail keeping two implementations around, since prism is only able to parse ruby 3.3+ syntax. Let me know what you think.
A little bit more info: https://github.com/ruby/prism/blob/main/docs/ripper_translation.md