Closed zenspider closed 4 years ago
9995 % rake debug R='a = 1, *[]'
s(:lasgn, :a, s(:svalue, s(:array, s(:lit, 1), s(:splat, s(:array)))))
9996 % rake debug R='a = *[], *[]'
s(:lasgn, :a, s(:svalue, s(:array, s(:splat, s(:array)), s(:splat, s(:array)))))
9997 % rake debug R='a = 1, *[], *[]'
#<Racc::ParseError: env:1 :: parse error on value "," (tCOMMA)>
I've just bumped into a variation of this when attempting to run flog over code that contains a splatted array in a list of exceptions passed to rescue
so something like
rescue FirstException, *EXCEPTIONS, ThirdException => e
I've got a failing test on my fork of ruby_parser here https://github.com/eightbitraptor/ruby_parser/commit/08ba65638dd93f7900422905a9797f32602d0d37 and a repro script here: https://gist.github.com/eightbitraptor/f30b6a2c10f174f0f1fbdd0e23617f5c but it's not clear to me yet how to fix this.
I bumped into another variation of this error:
RubyParser.new.parse("a = 1, *[:b,:c,:d], {}")
I believe this is entirely fixed