ruby / prism

Prism Ruby parser
https://ruby.github.io/prism/
MIT License
792 stars 134 forks source link

`Prism::Translation::RubyParser` - Interpolation in adjacent strings #2836

Closed presidentbeef closed 1 month ago

presidentbeef commented 1 month ago

RubyParser combines adjacent strings into a single :dstr. (RubyParser pretty much avoids nested :dstrs as much as possible.)

> RubyParser.new.parse('"#{1}" " "')
 => s(:dstr, "", s(:evstr, s(:lit, 1)), s(:str, " ")) 
> Prism::Translation::RubyParser.parse('"#{1}" " "')
 => s(:dstr, "", s(:dstr, "", s(:evstr, s(:lit, 1))), s(:str, " ")) 

(Prism 0.29)