Skip to content

Decouple ripper translator from ripper library#3839

Merged
kddnewton merged 3 commits into
ruby:mainfrom
Earlopain:ripper-translator-untangle
Jan 8, 2026
Merged

Decouple ripper translator from ripper library#3839
kddnewton merged 3 commits into
ruby:mainfrom
Earlopain:ripper-translator-untangle

Conversation

@Earlopain

Copy link
Copy Markdown
Collaborator

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.

See #3838

cc @eregon I was actually checking this out after you made https://bugs.ruby-lang.org/issues/21827.

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
Earlopain force-pushed the ripper-translator-untangle branch 2 times, most recently from 7841970 to 2c0bea0 Compare January 8, 2026 13:08
@Earlopain
Earlopain marked this pull request as ready for review January 8, 2026 13:16

@kddnewton kddnewton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, yeah looks great.

@kddnewton
kddnewton merged commit 451f70e into ruby:main Jan 8, 2026
66 checks passed
@eregon

eregon commented Jan 8, 2026

Copy link
Copy Markdown
Member

Amazing, thank you, I'll try it soon.

@Earlopain
Earlopain deleted the ripper-translator-untangle branch February 20, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ripper translation layer relies on upstream Ripper and is not fully compatible

3 participants