wesleywiser / toml-rust

MIT License
0 stars 0 forks source link

Implement Basic Strings #3

Open wesleywiser opened 9 years ago

wesleywiser commented 9 years ago

Basic strings are surrounded by quotation marks. Any Unicode character may be used except those that must be escaped: quotation mark, backslash, and the control characters (U+0000 to U+001F).

"I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."

For convenience, some popular characters have a compact escape sequence.

\b         - backspace       (U+0008)
\t         - tab             (U+0009)
\n         - linefeed        (U+000A)
\f         - form feed       (U+000C)
\r         - carriage return (U+000D)
\"         - quote           (U+0022)
\/         - slash           (U+002F)
\\         - backslash       (U+005C)
\uXXXX     - unicode         (U+XXXX)
\UXXXXXXXX - unicode         (U+XXXXXXXX)
wesleywiser commented 9 years ago

Any Unicode character may be escaped with the \uXXXX or\UXXXXXXXX forms. Note that the escape codes must be valid Unicode code points.

Other special characters are reserved and, if used, TOML should produce an error.