Skip to content

Instantly share code, notes, and snippets.

@DarkDimius
Created September 19, 2019 15:02
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 DarkDimius/bd9293f6150897f23fdc7fd85dcc973a to your computer and use it in GitHub Desktop.
Save DarkDimius/bd9293f6150897f23fdc7fd85dcc973a to your computer and use it in GitHub Desktop.
class <emptyTree><<C <root>>> < ()
a = "part 1 of heredoc ".concat("not a heredoc".+("eom part\n").to_s()).concat("\n").concat("eom part\n").concat("EOM\n").concat("part 2 of heredoc\n").to_s()
b = "oweqijfoiwjefqwoefij\n"
def foo<<C <todo sym>>>(&<blk>)
begin
c = "oqweijfoqwiejf\n"
<self>.puts(c)
end
end
<self>.puts(a)
<self>.puts(b)
<self>.foo()
end
{
"type" : "Begin",
"stmts" : [
{
"type" : "Assign",
"lhs" : {
"type" : "LVarLhs",
"name" : "a"
},
"rhs" : {
"type" : "DString",
"nodes" : [
{
"type" : "DString",
"nodes" : [
{
"type" : "String",
"val" : "part 1 of heredoc "
},
{
"type" : "Begin",
"stmts" : [
{
"type" : "Send",
"receiver" : {
"type" : "DString",
"nodes" : [
{
"type" : "String",
"val" : "not a heredoc"
}
]
},
"method" : "+",
"args" : [
{
"type" : "DString",
"nodes" : [
{
"type" : "DString",
"nodes" : [
{
"type" : "String",
"val" : "eom part\n"
}
]
}
]
}
]
}
]
},
{
"type" : "String",
"val" : "\n"
},
{
"type" : "String",
"val" : "eom part\n"
},
{
"type" : "String",
"val" : "EOM\n"
},
{
"type" : "String",
"val" : "part 2 of heredoc\n"
}
]
}
]
}
},
{
"type" : "Assign",
"lhs" : {
"type" : "LVarLhs",
"name" : "b"
},
"rhs" : {
"type" : "DString",
"nodes" : [
{
"type" : "DString",
"nodes" : [
{
"type" : "String",
"val" : "oweqijfoiwjefqwoefij\n"
}
]
}
]
}
},
{
"type" : "DefMethod",
"name" : "foo",
"args" : null,
"body" : {
"type" : "Begin",
"stmts" : [
{
"type" : "Assign",
"lhs" : {
"type" : "LVarLhs",
"name" : "c"
},
"rhs" : {
"type" : "DString",
"nodes" : [
{
"type" : "DString",
"nodes" : [
{
"type" : "String",
"val" : "oqweijfoqwiejf\n"
}
]
}
]
}
},
{
"type" : "Send",
"receiver" : null,
"method" : "puts",
"args" : [
{
"type" : "LVar",
"name" : "c"
}
]
}
]
}
},
{
"type" : "Send",
"receiver" : null,
"method" : "puts",
"args" : [
{
"type" : "LVar",
"name" : "a"
}
]
},
{
"type" : "Send",
"receiver" : null,
"method" : "puts",
"args" : [
{
"type" : "LVar",
"name" : "b"
}
]
},
{
"type" : "Send",
"receiver" : null,
"method" : "foo",
"args" : [
]
}
]
}
a = <<EOD
part 1 of heredoc #{ "not a heredoc" + <<EOM }
eom part
EOM
part 2 of heredoc
EOD
b = <<-EOD
oweqijfoiwjefqwoefij
EOD
def foo
c = <<~EOD
oqweijfoqwiejf
EOD
puts c
end
puts a
puts b
foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment