Next: scheme lex syntax numbers, Previous: scheme lex syntax characters, Up: scheme lex syntax [Index]
String are represented by sequences of characters enclosed within
doublequotes ("). Within a string literal, various escape
sequences represent characters other than themselves. Escape sequences
always start with a backslash (\):
\aalarm, U+0007
\bbackspace, U+0008
\tcharacter tabulation, U+0009
\nlinefeed, U+000A
\vline tabulation, U+000B
\fformfeed, U+000C
\rreturn, U+000D
\"doublequote, U+0022
\backslash, U+005C
\<intraline whitespace><line ending> <intraline whitespace>nothing
\x<hex scalar value>;specified character (note the terminating semi–colon).
These escape sequences are case-sensitive, except that the alphabetic digits of a ?hex-scalar-value can be uppercase or lowercase.
Any other character in a string after a backslash is a syntax violation. Except for a line ending, any character outside of an escape sequence and not a doublequote stands for itself in the string literal. A line ending that does not follow a backslash stands for a linefeed character.
Examples:
"abc" U+0061, U+0062, U+0063
"\x41;bc" "Abc" ; U+0041, U+0062, U+0063
"\x41; bc" "A bc"
U+0041, U+0020, U+0062, U+0063
"\x41bc;" U+41BC
"\x41" &lexical exception
"\x;" &lexical exception
"\x41bx;" &lexical exception
"\x00000041;" "A" ; U+0041
"\x0010FFFF;" U+10FFFF
"\x00110000;" &lexical exception
out of range
"\x000000001;" U+0001
"\xD800;" &lexical exception
in excluded range
"A
bc" U+0041, U+000A, U+0062, U+0063
if no space occurs after the A