5.1.2. String Literals

Felix provides literals for four types of string as follows, indicated by the denoted prefix.
typeprefix
<none>string
r, Rstring
w, Wwstring
u, Uustring
c, Ccharcp
Note that literals of type charcp denote a C pointer to a null terminated array, not a string. The array is constructed the same way as for a standard string, except that a NULL byte is appended to the result.

The prefix is followed by the string which is delimited by the following quotation marks:

namecodemark
single-quoteq'
double-quoted"
tripled-single-quoteqqq'''
tripled-double-quoteddd"""
Triple quoted string may span lines, singly quoted strings may not.

The r or R prefix designates a raw string, which consists of the whole of the string up to the next matching delimiter, there is no escape processing.

Other string process escapes as follows.

EscapeResult
\a7, ASCII Bell
\b8, ASCII Backspace
\t9, ASCII Tab
\n10, ASCII Linefeed
\v11, ASCII Vertical Tab
\f12, ASCII Form Feed
\r13, ASCII Carriage Return
\e33, ASCII Escape
\\\
\""
\''
\ See Notes
\oSee Notes
\dSee Notes
\xSee Notes
\uSee Notes
\USee Notes
The escape slosh followed by spaces and a newline is elided and can be used in a triple quotes string to distinguish trailing whitespace which is included in the string, and that which is not.

The escapes \o, \d and \x are octal, decimal, and hex code point encodings. They encode a single character from the octal, decimal, or hex numeric digits following, respectively, up to the first non-digit or the encoding limits 3, 3, 2 respectively.

The \u and \U escapes are used to interpret longer hex escapes, up to 4 or 8 digits respectively. However whereas in a ustring literal the numeric value is a single character, in a string it is replaced by the UTF8 encoding of the value.

Therefore, unicode strings, whether stored in a string or ustring, have the same interpretation as unicode, provided the all characters presented literally or via \o, \d or \x encodings, have unicode value less than 128 (that is, they're plain ASCII).

The intepretation of wstring literals is platform independent and undefined by Felix at this time.

Note that C style octal escapes are NOT ALLOWED.

If an escape code is followed by any character other than those listed, the result is undefined. The current implementation preserves the sequence (including the leading slosh).