Decouple ripper translator from ripper library#3839
Merged
Conversation
It has a hard dependency on ripper that can't be removed. This makes it so that ripper can be loaded only when the class is actually used.
Ripper is either not used or loaded where it is actually needed
Ripper exposes Ripper::Lexer:State in its output, which is a bit of a problem. To make this work, I basically copy-pasted the implementation. I'm unsure if that is acceptable and added a test to make sure that these values never go out of sync. I don't imagine them changing often, prism maps them 1:1 for its own usage. This also fixed the shim by accident. `Ripper.lex` went to `Translation::Ripper.lex` when it should have been the original. Removing the need for the original resolves that issue.
Earlopain
force-pushed
the
ripper-translator-untangle
branch
2 times, most recently
from
January 8, 2026 13:08
7841970 to
2c0bea0
Compare
Earlopain
marked this pull request as ready for review
January 8, 2026 13:16
kddnewton
approved these changes
Jan 8, 2026
kddnewton
left a comment
Collaborator
There was a problem hiding this comment.
Wow, yeah looks great.
Member
|
Amazing, thank you, I'll try it soon. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ripper exposes
Ripper::Lexer:Statein its output, which is a bit of a problem. To make this work, I basically copy-pasted the implementation.I'm unsure if that is acceptable and added a test to make sure that these values never go out of sync.
I don't imagine them changing often, prism maps them 1:1 for its own usage.
This also fixed the shim by accident.
Ripper.lexwent toTranslation::Ripper.lexwhen it should have been the original. Removing the need for the original resolves that issue.See #3838
cc @eregon I was actually checking this out after you made https://bugs.ruby-lang.org/issues/21827.