One can use \o{...} to denote a code point written in octal:
Or \x{...} and specify hexadecimal numbers:
To specity Unicode names, one can use \N{...}:
A string can span multiple lines:
For writing a string that has many double quotes, parenthesis, or similar characters, one can use alternative literals:
The Parser is aware of Unicode delimiters as well. Here are only a few examples:
Interpolation
Creating a String with embedded expressions, is called string interpolation:
Single quoted strings
Single quoted strings does not support escapes, nor interpolation.
For specifying a custom delimiter, one can use %q followed by any non-whitespace delimiter:
Another way of writing string literals, is by placing a colon in font of an alphanumeric string that begins with a letter.
Here-document
There must not be a space between the << and the token string. When the token string is double-quoted ("") or not quoted, the content will be interpolated like a double-quoted string:
If single quotes are used, then the here document will not support interpolation, like a normal single-quoted string:
The here document does not start immediately at the <<END token -- it starts on the next line. The <<END is actually an expression, whose value will be substituted by the contents of the here document. To further illustrate this fact, we can use the <<END inside a complex, nested expression:
"\o{101}" # == "A"
"\o{123}" # == "S"
"\o{12}" # == "\n"
"\o{1}" # string with one character with code point 1
"\x{41}" # == "A"
"\x{263a}" # == "☺"
"\N{WHITE SMILING FACE}" # == "☺"
"\N{GREEK CAPITAL LETTER GAMMA}" # == "Γ"
"hello
world" # same as "hello\nworld"
# Supports double quotes and nested parenthesis
%(hello ("world")) # same as "hello (\"world\")"
# Supports double quotes and nested brackets
%[hello ["world"]] # same as "hello [\"world\"]"
# Supports double quotes and nested curlies
%{hello {"world"}} # same as "hello {\"world\"}"
# Supports double quotes and nested angles
%<hello <"world">> # same as "hello <\"world\">"