Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re #571, allow raw tabs in basic and MLB strings #627

Merged
merged 4 commits into from
Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Clarify in ABNF that UTF-16 surrogate code points (U+D800 - U+DFFF) are not
allowed in strings or comments.
* Allow raw tab characters in basic strings and multi-line basic strings.

## 0.5.0 / 2018-07-11

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ multi-line literal. All strings must contain only valid UTF-8 characters.

**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, U+007F).
control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F).

```toml
str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF."
Expand Down Expand Up @@ -314,8 +314,10 @@ str3 = """\
```

Any Unicode character may be used except those that must be escaped: backslash
and the control characters (U+0000 to U+001F, U+007F). Quotation marks need not
be escaped unless their presence would create a premature closing delimiter.
and the control characters other than tab, line feed, and carriage return
(U+0000 to U+0008, U+000B, U+000C, U+000E to U+001F, U+007F). Quotation marks
need not be escaped unless their presence would create a premature closing
delimiter.

If you're a frequent specifier of Windows paths or regular expressions, then
having to escape backslashes quickly becomes tedious and error prone. To help,
Expand Down
4 changes: 2 additions & 2 deletions toml.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ basic-string = quotation-mark *basic-char quotation-mark
quotation-mark = %x22 ; "

basic-char = basic-unescaped / escaped
basic-unescaped = %x20-21 / %x23-5B / %x5D-7E / non-ascii
basic-unescaped = wschar / %x21 / %x23-5B / %x5D-7E / non-ascii
escaped = escape escape-seq-char

escape = %x5C ; \
Expand All @@ -86,7 +86,7 @@ ml-basic-string-delim = 3quotation-mark

ml-basic-body = *( ml-basic-char / newline / ( escape ws newline ) )
ml-basic-char = ml-basic-unescaped / escaped
ml-basic-unescaped = %x20-5B / %x5D-7E / non-ascii
ml-basic-unescaped = wschar / %x21-5B / %x5D-7E / non-ascii

;; Literal String

Expand Down