Skip to content

Commit

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

This PR supports `Parser::Ruby28`, the early adapters will be able to
try edge Ruby with RuboCop.

I will open a PR later to new Ruby 2.8 (3.0) syntax supported by Parser.
  • Loading branch information
koic authored and marcandre committed Jun 25, 2020
1 parent c2bc840 commit 4377a64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,7 @@
* [#31](https://github.com/rubocop-hq/rubocop-ast/pull/31): NodePattern now uses `param === node` to match params, which allows Regexp, Proc, Set in addition to Nodes and literals. ([@marcandre][])
* [#41](https://github.com/rubocop-hq/rubocop-ast/pull/41): Add `delimiters` and related predicates for `RegexpNode`. ([@owst][])
* [#46](https://github.com/rubocop-hq/rubocop-ast/pull/46): Basic support for [non-legacy AST output from parser](https://github.com/whitequark/parser/#usage). Note that there is no support (yet) in main RuboCop gem. ([@marcandre][])
* [#48](https://github.com/rubocop-hq/rubocop-ast/pull/48): Support `Parser::Ruby28` for Ruby 2.8 (3.0) parser. ([@koic][])

## 0.0.3 (2020-05-15)

Expand Down
5 changes: 5 additions & 0 deletions lib/rubocop/ast/processed_source.rb
Expand Up @@ -2,6 +2,7 @@

require 'digest/sha1'

# rubocop:disable Metrics/ClassLength
module RuboCop
module AST
# ProcessedSource contains objects which are generated by Parser
Expand Down Expand Up @@ -176,6 +177,9 @@ def parser_class(ruby_version)
when 2.7
require 'parser/ruby27'
Parser::Ruby27
when 2.8
require 'parser/ruby28'
Parser::Ruby28
else
raise ArgumentError,
"RuboCop found unknown Ruby version: #{ruby_version.inspect}"
Expand All @@ -201,3 +205,4 @@ def create_parser(ruby_version)
end
end
end
# rubocop:enable Metrics/ClassLength

0 comments on commit 4377a64

Please sign in to comment.