Skip to content

Instantly share code, notes, and snippets.

@olivernn
Created October 21, 2016 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivernn/9e61a52aaa05656210b839d9c8594bd8 to your computer and use it in GitHub Desktop.
Save olivernn/9e61a52aaa05656210b839d9c8594bd8 to your computer and use it in GitHub Desktop.
RubyWat Implicit String Concatenation
'abc'
[:program,
[[:string_literal, [:string_content, [:@tstring_content, "abc", [1, 1]]]]]]
'a' 'b' 'c'
[:program,
[[:string_concat,
[:string_concat,
[:string_literal, [:string_content, [:@tstring_content, "a", [1, 1]]]],
[:string_literal, [:string_content, [:@tstring_content, "b", [1, 5]]]]],
[:string_literal, [:string_content, [:@tstring_content, "c", [1, 9]]]]]]]
require 'ripper'
require 'pp'
puts "'abc'"
pp Ripper.sexp("'abc'")
puts "\n'a' 'b' 'c'"
pp Ripper.sexp("'a' 'b' 'c'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment