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
476 stars 100 forks source link

Parentheses can be omitted in one-line pattern matching (Ruby-3.1 support) #329

Closed ojab closed 2 years ago

ojab commented 2 years ago

https://rubyreferences.github.io/rubychanges/3.1.html#parentheses-can-be-omitted-in-one-line-pattern-matching

[0, 1] => _, x

{y: 2} => y:

if {language: 'Ruby', version: '3.1'} in version: ('3.0'..)
  puts "Pattern-matching is cool"
end

should be parsed correctly

zenspider commented 2 years ago

This has been addressed in the latest release.