mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
This PR updates the fallback version for `Prism::Translation::ParserCurrent` from 3.4 to 4.0. Currently, the fallback resolves to `Parser34`, as shown below: ```console $ ruby -v -rprism -rprism/translation/parser_current -e 'p Prism::Translation::ParserCurrent' ruby 3.0.7p220 (2024-04-23 revision https://github.com/ruby/prism/commit/724a071175) [x86_64-darwin23] warning: `Prism::Translation::Current` is loading Prism::Translation::Parser34, but you are running 3.0. Prism::Translation::Parser34 ``` Following the comment "Keep this in sync with released Ruby.", it seems like the right time to set this to Ruby 4.0, which is scheduled for release this week. https://github.com/ruby/prism/commit/115f0a118c
27 lines
665 B
Ruby
27 lines
665 B
Ruby
# frozen_string_literal: true
|
|
# :markup: markdown
|
|
# typed: ignore
|
|
|
|
#
|
|
module Prism
|
|
module Translation
|
|
case RUBY_VERSION
|
|
when /^3\.3\./
|
|
ParserCurrent = Parser33
|
|
when /^3\.4\./
|
|
ParserCurrent = Parser34
|
|
when /^3\.5\./, /^4\.0\./
|
|
ParserCurrent = Parser40
|
|
when /^4\.1\./
|
|
ParserCurrent = Parser41
|
|
else
|
|
# Keep this in sync with released Ruby.
|
|
parser = Parser40
|
|
major, minor, _patch = Gem::Version.new(RUBY_VERSION).segments
|
|
warn "warning: `Prism::Translation::Current` is loading #{parser.name}, " \
|
|
"but you are running #{major}.#{minor}."
|
|
ParserCurrent = parser
|
|
end
|
|
end
|
|
end
|