Strings
Strings in God must be valid UTF-8, and this validation should be done by the implementer. For compliance with this specification, a lack of this behavior for any reason (technical limitation or otherwise) MUST be documented.
Standard Strings
Represented by a pair of double quotes with any amount of (valid UTF-8) text inside it.
greeting = "Hello, how are you?";
Multi-line
Strings that span across multiple lines are supported. They are declared using
two sets of single quotes; one at the beginning and one at the end.
about-me = ''
Let me tell you
about myself!
'';
Multi-line string are also indentation aware; The indentation of the contained string is calculated relative to the furthest left column which contains meaningful (non-whitespace) text.
my-string = ''
There are four spaces before this,
but the they will not be preserved.
'';
# produces:
# "There are four spaces before this,\n but they will not be preserved.\n"
Escaping
Yog can escape (double) quotes in a regular string using a backslash (\) before it. This is the same
for line-feeds, carriage returns and tab characters (\n,\r,\t).
To escape any character, prefix it with ''\
height = "6'2\"\n";
# produces:
# 6'2"\n
greeting = ''
I said ''\'Hello!''\'
to them.
'';
# produces:
# "I said 'Hello!'"\n to them."
Additional notes
Unlike in Nix, there is no string interpolation here. The data represented
is purely static, and the implementater should have to do no computation
or transformation of values.