diff --git a/.gitignore b/.gitignore index 02725415e..f62dce545 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,6 @@ lib/parser/ruby25.rb lib/parser/ruby26.rb lib/parser/ruby27.rb lib/parser/ruby28.rb +lib/parser/ruby30.rb lib/parser/macruby.rb lib/parser/rubymotion.rb diff --git a/Rakefile b/Rakefile index 449b91509..43df380e1 100644 --- a/Rakefile +++ b/Rakefile @@ -32,7 +32,7 @@ GENERATED_FILES = %w(lib/parser/lexer.rb lib/parser/ruby25.rb lib/parser/ruby26.rb lib/parser/ruby27.rb - lib/parser/ruby28.rb + lib/parser/ruby30.rb lib/parser/macruby.rb lib/parser/rubymotion.rb) diff --git a/lib/parser/all.rb b/lib/parser/all.rb index 70c2ab811..398df7808 100644 --- a/lib/parser/all.rb +++ b/lib/parser/all.rb @@ -10,4 +10,4 @@ require 'parser/ruby25' require 'parser/ruby26' require 'parser/ruby27' -require 'parser/ruby28' +require 'parser/ruby30' diff --git a/lib/parser/builders/default.rb b/lib/parser/builders/default.rb index 1b4656a89..26412ca08 100644 --- a/lib/parser/builders/default.rb +++ b/lib/parser/builders/default.rb @@ -103,7 +103,7 @@ class << self ## # AST compatibility attribute; arguments forwarding initially # didn't have support for leading arguments - # (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 2.8 + # (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0 # added support for any number of arguments in front of the `...`. # # If set to false (the default): @@ -120,7 +120,7 @@ class << self # s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg))) # # It does't matter that much on 2.7 (because there can't be any leading arguments), - # but on 2.8 it should be better enabled to use a single AST format. + # but on 3.0 it should be better enabled to use a single AST format. # # @return [Boolean] attr_accessor :emit_forward_arg @@ -1601,9 +1601,9 @@ def check_assignment_to_numparam(name, loc) end def check_reserved_for_numparam(name, loc) - # MRI < 2.8 accepts assignemnt to variables like _1 - # if it's not a numbererd parameter. MRI 2.8 and newer throws an error. - return if @parser.version < 28 + # MRI < 3.0 accepts assignemnt to variables like _1 + # if it's not a numbererd parameter. MRI 3.0 and newer throws an error. + return if @parser.version < 30 if name =~ /\A_([1-9])\z/ diagnostic :error, :reserved_for_numparam, { :name => name }, loc diff --git a/lib/parser/current.rb b/lib/parser/current.rb index 0bcc090be..ad295eb06 100644 --- a/lib/parser/current.rb +++ b/lib/parser/current.rb @@ -83,14 +83,14 @@ def warn_syntax_deviation(feature, version) require 'parser/ruby27' CurrentRuby = Ruby27 - when /^2\.8\./ - current_version = '2.8.0-dev' + when /^3\.0\./ + current_version = '3.0.0-dev' if RUBY_VERSION != current_version - warn_syntax_deviation 'parser/ruby28', current_version + warn_syntax_deviation 'parser/ruby30', current_version end - require 'parser/ruby28' - CurrentRuby = Ruby28 + require 'parser/ruby30' + CurrentRuby = Ruby30 else # :nocov: # Keep this in sync with released Ruby. diff --git a/lib/parser/ruby28.y b/lib/parser/ruby30.y similarity index 99% rename from lib/parser/ruby28.y rename to lib/parser/ruby30.y index 0899974a5..2b771e19b 100644 --- a/lib/parser/ruby28.y +++ b/lib/parser/ruby30.y @@ -1,4 +1,4 @@ -class Parser::Ruby28 +class Parser::Ruby30 token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS kTHEN kELSIF kELSE kCASE kWHEN kWHILE kUNTIL kFOR kBREAK kNEXT @@ -3034,7 +3034,7 @@ require 'parser' ---- inner def version - 28 + 30 end def default_encoding diff --git a/lib/parser/runner.rb b/lib/parser/runner.rb index a856325ae..a407dc8a2 100644 --- a/lib/parser/runner.rb +++ b/lib/parser/runner.rb @@ -113,9 +113,9 @@ def setup_option_parsing(opts) @parser_class = Parser::Ruby27 end - opts.on '--28', 'Parse as Ruby 2.8 would' do - require 'parser/ruby28' - @parser_class = Parser::Ruby28 + opts.on '--30', 'Parse as Ruby 3.0 would' do + require 'parser/ruby30' + @parser_class = Parser::Ruby30 end opts.on '--mac', 'Parse as MacRuby 0.12 would' do diff --git a/test/helper.rb b/test/helper.rb index 9e375d53c..d783daf00 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -18,7 +18,7 @@ ruby25.y ruby26.y ruby27.y - ruby28.y + ruby30.y ), File.expand_path('../../lib/parser', __FILE__)) diff --git a/test/parse_helper.rb b/test/parse_helper.rb index 09f47ea81..fc0f77382 100644 --- a/test/parse_helper.rb +++ b/test/parse_helper.rb @@ -7,7 +7,7 @@ module ParseHelper require 'parser/macruby' require 'parser/rubymotion' - ALL_VERSIONS = %w(1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 mac ios) + ALL_VERSIONS = %w(1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 3.0 mac ios) def setup @diagnostics = [] @@ -27,7 +27,7 @@ def parser_for_ruby_version(version) when '2.5' then parser = Parser::Ruby25.new when '2.6' then parser = Parser::Ruby26.new when '2.7' then parser = Parser::Ruby27.new - when '2.8' then parser = Parser::Ruby28.new + when '3.0' then parser = Parser::Ruby30.new when 'mac' then parser = Parser::MacRuby.new when 'ios' then parser = Parser::RubyMotion.new else raise "Unrecognized Ruby version #{version}"