pnathan / pp-toml

Paul's Parser for Tom's Own Minimal Language
https://github.com/mojombo/toml
Other
19 stars 3 forks source link

Literal strings #11

Open pnathan opened 9 years ago

pnathan commented 9 years ago

snip from the spec

TOML supports literal strings where there is no escaping allowed at all.
+**Literal strings** are surrounded by single quotes. Like basic strings, they
+must appear on a single line:
+
+```toml
+# What you see is what you get.
+winpath  = 'C:\Users\nodejs\templates'
+winpath2 = '\\ServerX\admin$\system32\'
+quoted   = 'Tom "Dubs" Preston-Werner'
+regex    = '<\i\c*\s*>'
+```
+
+Since there is no escaping, there is no way to write a single quote inside a
+literal string enclosed by single quotes. Luckily, TOML supports a multi-line
+version of literal strings that solves this problem. **Multi-line literal
+strings** are surrounded by three single quotes on each side and allow newlines.
+Like literal strings, there is no escaping whatsoever. If the first character
+after the opening delimiter is a newline (`0x0A`), then it is trimmed. All other
+content between the delimiters is interpreted as-is without modification.
pnathan commented 2 years ago

""" and ''' strings exist - "basic" and 'literal'