Skip to content

Commit

Permalink
Support Parser::Ruby33
Browse files Browse the repository at this point in the history
Parser gem has been started development for Ruby 3.3 (edge Ruby).
whitequark/parser#904

And this PR update to require Parser 3.2.1.0 or higher, which contains `Parser::Ruby33`.
https://github.com/whitequark/parser/blob/master/CHANGELOG.md#v3210-2023-02-09
  • Loading branch information
koic authored and bbatsov committed Feb 10, 2023
1 parent 1b758f2 commit 92b7547
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/new_support_ruby_3_3_parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#256](https://github.com/rubocop-hq/rubocop-ast/pull/256): Support `Parser::Ruby33` for Ruby 3.3 parser (experimental). ([@koic][])
3 changes: 3 additions & 0 deletions lib/rubocop/ast/processed_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ def parser_class(ruby_version)
when 3.2
require 'parser/ruby32'
Parser::Ruby32
when 3.3
require 'parser/ruby33'
Parser::Ruby33
else
raise ArgumentError,
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
Expand Down
2 changes: 1 addition & 1 deletion rubocop-ast.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Gem::Specification.new do |s|
'rubygems_mfa_required' => 'true'
}

s.add_runtime_dependency('parser', '>= 3.1.1.0')
s.add_runtime_dependency('parser', '>= 3.2.1.0')

s.add_development_dependency('bundler', '>= 1.15.0', '< 3.0')

Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
let(:ruby_version) { 3.2 }
end

RSpec.shared_context 'ruby 3.3', :ruby33 do
let(:ruby_version) { 3.3 }
end

# ...
module DefaultRubyVersion
extend RSpec::SharedContext
Expand Down

0 comments on commit 92b7547

Please sign in to comment.