stzdoc - strings syntax
Raw Strings
`this is a raw string`
⊣`this is a raw string with a ` back-quote in it⊣`
A raw string does no escaping or interpolation.
It is denoted between back-quotes ` or with an 'end of string' marker that can be any valid string. In the example above the ⊣ is entirely arbitrary.
Escaping Strings
'this is an\n\tescaping string'
⊣'it's an\n\tescaping string⊣'
An escaping string replaces character after a backslash \ with a character. The list of characters are:
\n newline
\r carriage-return
\t tab
\7777 octal unicode code point
\xFFFF hexadecimal unicode code point
Interpolating Strings
name = 'World'
"This is an interpolating string. Hello ~{name}, ~(name), ~[name], ~“name” ~‘name’ ~xnamex ~⊣name⊣\nwhich also does escaping"
end"This is an interpolating string. Hello ~{name}, ~(name), ~[name], ~“name” ~‘name’ ~xnamex ~⊣name⊣\nwhich also does escaping\nend"
An interpolated string is split up by the compiler to substitute statements between the string parts. A substitution begins with a ~ followed by a bracket opener or any other character. The following statements will be executed and then it is framed with a bracket closer or the same character started with.