Escape sequences

The usual C escape sequences are recognized. For example, to set the thousands_sep to the single quote character, an escape sequence must be used:

thousands_sep = \'

The recognized escape sequences are:

The octal character may have from 1 to 3 octal digits (digits must be in the range [0, 7]. The parser will read as many digits as it can to interpret a valid octal number. For example:

\18

This is the character '\1' followed by the character '8'.

\17

But this is the single character '\17'.

The hexadecimal and universal character formats are all identical with each other, and have slightly relaxed syntax compared to the formats specified in the standard. The x (or u or U) is followed by zero to sizeof(charT)*CHAR_BIT/4 hexadecimal digits. charT is char when reading narrow data, and wchar_t when reading wide data (even when reading wide data from a narrow file). On Macintosh and Windows this translates to 0 to 2 digits when reading a char, and from 0 to 4 digits when reading a wchar_t. Parsing the character is terminated when either the digit limit has been reached, or a non-hexadecimal digit has been reached. If there are 0 valid digits, then the character is read as '\0'. Example (assume a 8 bit char and 16 bit wchar_t):

\x01234

When reading narrow data this is the following sequence of 4 char's: '\1' '2' '3' '4'

The '\x01' is read as one character, but the following '2' is not included because a 8 bit char can only hold 2 hex digits.

When reading wide data the above example parses to the following two wchar_t's: L'\x123' L'4'

The '\x0123' is read as one wchar_t, but the following '4' is not included because a 16 bit wchar_t can only hold 4 hex digits.