Conversation
A bunch of things are required to match ripper state, including looking backward sometimes to pull a state forward because of the nature of parse.y. This changes the structure from a backward look to a forward look by keeping a couple of stacks of state.
The parse.y grammar has the concept of a words separator that must delimit words in a word list literal. Prism previously didn't emit these in the token stream because they don't actually correspond to any source code. However, in order to better compare against the vendored grammars, it's much easier if we do emit them. This commit adds them into the token stream without actually touching the parser, so it barely effects anything except conformance. Since we have split up all those other tokens now and we have this in place, we now don't need any special handling: our tokens stream is pretty much exactly a superset of parse.y's token stream, meaning it's very easy to drive a parse.y grammar using prism's token stream provided you have a mapping of token names.
kddnewton
force-pushed
the
implicit-words-sep
branch
from
September 28, 2026 18:22
047f043 to
3b643ab
Compare
This branch has not been deployed
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.
The parse.y grammar has the concept of a words separator that must delimit words in a word list literal. Prism previously didn't emit these in the token stream because they don't actually correspond to any source code.
However, in order to better compare against the vendored grammars, it's much easier if we do emit them. This commit adds them into the token stream without actually touching the parser, so it barely effects anything except conformance.
Since we have split up all those other tokens now and we have this in place, we now don't need any special handling: our tokens stream is pretty much exactly a superset of parse.y's token stream, meaning it's very easy to drive a parse.y grammar using prism's token stream provided you have a mapping of token names.