seattlerb / ruby_parser

ruby_parser is a ruby parser written in pure ruby. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem.
http://www.zenspider.com/projects/ruby_parser.html
475 stars 102 forks source link

Does not parse new argument delegation syntax introduced in Ruby 2.7 #311

Closed orien closed 3 years ago

orien commented 3 years ago

In Ruby 2.7 a new syntax for delegating method arguments was introduced. https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

ruby_parser fails to pass this syntax.

RubyParser.new.parse <<~METHOD
  def foo(...)
    target(...)
  end
METHOD
Traceback (most recent call last):
       16: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
       15: from (irb):3
       14: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser.rb:33:in `process'
       13: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser.rb:33:in `each'
       12: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser.rb:36:in `block in process'
       11: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser_extras.rb:1317:in `process'
       10: from /ruby/2.7.1/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
        9: from /ruby/2.7.1/lib/ruby/2.7.0/timeout.rb:33:in `catch'
        8: from /ruby/2.7.1/lib/ruby/2.7.0/timeout.rb:33:in `catch'
        7: from /ruby/2.7.1/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
        6: from /ruby/2.7.1/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
        5: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser_extras.rb:1329:in `block in process'
        4: from (eval):3:in `do_parse'
        3: from (eval):3:in `_racc_do_parse_c'
        2: from /ruby/2.7.1/lib/ruby/gems/2.7.0/gems/ruby_parser-3.15.0/lib/ruby_parser_extras.rb:1304:in `on_error'
        1: from /ruby/2.7.1/lib/ruby/2.7.0/racc/parser.rb:544:in `on_error'
Racc::ParseError ((string):1 :: parse error on value "..." (tDOT3))
orien commented 3 years ago

@zenspider I notice you've started Ruby 2.7 support in b6fc7933796fa8072459a64c6f906e44afe8c9e1. Are there plans to support the new syntax? Can I help?

zenspider commented 3 years ago

I just stubbed it out. Help is welcome.

On Dec 4, 2020, at 16:38, Orien Madgwick notifications@github.com wrote:

 @zenspider I notice you've started Ruby 2.7 support in b6fc793. Are there plans to support the new syntax? Can I help?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

zenspider commented 3 years ago

@orien wanna take a whack at any of it?

orien commented 3 years ago

Unfortunately, my circumstances have changed and I don't time to dedicate.

schinery commented 3 years ago

I created https://github.com/ruby/racc/issues/146 for this issue as I wasn't sure if it was a problem with ruby_parser or racc. Hoping someone figures it out though 🙏🏻

zenspider commented 3 years ago

Definitely a problem in ruby_parser. Please close the racc ticket.

On Feb 12, 2021, at 06:43, Stuart Chinery notifications@github.com wrote:

 I created ruby/racc#146 for this issue as I wasn't sure if it was a problem with ruby_parser or racc. Hoping someone figures it out though 🙏🏻

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Jakanapes commented 3 years ago

Hit this issue today. Any progress?

dvandersluis commented 3 years ago

Likewise, is there any update?

mvz commented 3 years ago

Work is in progress in #316.

zenspider commented 3 years ago

Fixed and released. Sorry for the delay.

danleyden commented 3 years ago

Fixed and released. Sorry for the delay.

Thanks @zenspider. Appreciate the effort