Skip to content

Commit

Permalink
! Added tentative 3.2 support.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/ruby_parser/dev/": change = 13656]
  • Loading branch information
zenspider committed Jan 10, 2023
1 parent 8cd0871 commit 8c8f5bb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Manifest.txt
Expand Up @@ -31,6 +31,8 @@ lib/ruby30_parser.rb
lib/ruby30_parser.y
lib/ruby31_parser.rb
lib/ruby31_parser.y
lib/ruby32_parser.rb
lib/ruby32_parser.y
lib/ruby3_parser.yy
lib/ruby_lexer.rb
lib/ruby_lexer.rex
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Expand Up @@ -15,7 +15,7 @@ Hoe.add_include_dirs "../../oedipus_lex/dev/lib"
Hoe.add_include_dirs "../../ruby2ruby/dev/lib"

V2 = %w[20 21 22 23 24 25 26 27]
V3 = %w[30 31]
V3 = %w[30 31 32]

VERS = V2 + V3

Expand Down Expand Up @@ -296,6 +296,7 @@ ruby_parse "2.6.9"
ruby_parse "2.7.5"
ruby_parse "3.0.3"
ruby_parse "3.1.1"
ruby_parse "3.2.0"

task :debug => :isolate do
ENV["V"] ||= VERS.last
Expand Down
2 changes: 2 additions & 0 deletions lib/ruby3_parser.yy
Expand Up @@ -4,6 +4,8 @@
class Ruby30Parser
#elif V == 31
class Ruby31Parser
#elif V == 32
class Ruby32Parser
#else
fail "version not specified or supported on code generation"
#endif
Expand Down
2 changes: 2 additions & 0 deletions lib/ruby_parser.rb
Expand Up @@ -81,10 +81,12 @@ class SyntaxError < RuntimeError; end
require "ruby27_parser"
require "ruby30_parser"
require "ruby31_parser"
require "ruby32_parser"

class RubyParser # HACK
VERSIONS.clear # also a HACK caused by racc namespace issues

class V32 < ::Ruby32Parser; end
class V31 < ::Ruby31Parser; end
class V30 < ::Ruby30Parser; end
class V27 < ::Ruby27Parser; end
Expand Down
14 changes: 14 additions & 0 deletions test/test_ruby_parser.rb
Expand Up @@ -5478,6 +5478,10 @@ def test_defs_endless_command_rescue
end
end

module TestRubyParserShared32Plus
include TestRubyParserShared31Plus
end

class Minitest::Test
def skip s = "blah"
warn "ignoring skip for %s: %s" % [name, s]
Expand Down Expand Up @@ -5829,6 +5833,16 @@ def setup
end
end

class TestRubyParserV32 < RubyParserTestCase
include TestRubyParserShared32Plus

def setup
super

self.processor = RubyParser::V32.new
end
end

RubyParser::VERSIONS.each do |klass|
v = klass.version
describe "block args arity #{v}" do
Expand Down

0 comments on commit 8c8f5bb

Please sign in to comment.