Skip to content

Commit

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

And this PR update to require Parser 3.3.0.4 or higher, which contains `Parser::Ruby34`.
https://github.com/whitequark/parser/blob/master/CHANGELOG.md#not-released-2024-01-15
  • Loading branch information
koic committed Jan 15, 2024
1 parent f9e6682 commit 7beabb9
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_4_parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#276](https://github.com/rubocop-hq/rubocop-ast/pull/276): Support `Parser::Ruby34` for Ruby 3.4 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 @@ -268,6 +268,9 @@ def parser_class(ruby_version)
when 3.3
require 'parser/ruby33'
Parser::Ruby33
when 3.4
require 'parser/ruby34'
Parser::Ruby34
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.2.1.0')
s.add_runtime_dependency('parser', '>= 3.3.0.4')

##### Do NOT add `rubocop` (or anything depending on `rubocop`) here. See Gemfile
end
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
let(:ruby_version) { 3.3 }
end

RSpec.shared_context 'ruby 3.4', :ruby34 do
let(:ruby_version) { 3.4 }
end

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

0 comments on commit 7beabb9

Please sign in to comment.