On this page
Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
Prism::Translation::Parser::Lexer
Accepts a list of prism tokens and converts them into the expected format for the parser gem.
Class methods 1
Instance methods 5
These constants represent flags in our lex state. We really, really don’t want to be using them and we really, really don’t want to be exposing them as part of our public API. Unfortunately, we don’t have another way of matching the exact tokens that the parser gem expects without them. We should find another way to do this, but in the meantime we’ll hide them from the documentation and mark them as private constants.
It is used to determine whether do is of the token type kDO or kDO_LAMBDA.
NOTE: In edge cases like ‘-> (foo = -> (bar) {}) do end`, please note that kDO is still returned instead of kDO_LAMBDA, which is expected: github.com/ruby/prism/pull/3046
The direct translating of types between the two lexers.
An array of tuples that contain prism tokens and their associated lex state when they were lexed.
A hash that maps offsets in bytes to offsets in characters.
The Parser::Source::Buffer that the tokens were lexed from.