abra-lang
abra-lang copied to clipboard
Multiline strings
Other languages make use of a delimiter to denote a string in which newlines are allowed within the string literal. Javascript uses a backtick to denote this, among other things; python uses """. I think I like the triple quotes for this:
val input = """
x,x,o
_,x,o
o,_,x
"""
Double-quote characters should be allowed within multi-line string literals unescaped.
There should also be a new method on String, trimIndentation(): String:
val input = """
x,x,o
_,x,o
o,_,x
""".trimIndentation() // produces "x,x,o\n_,x,o\no,_,x"
val code = """
func abc() {
return 0
}
""".trimIndentation() // produces "func abc() {\n return 0\n}"