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

Permit more control characters in comments #924

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

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

## unreleased

- Relax comment parsing; most control characters are again permitted.
- Allow newline after key/values in inline tables.
- Allow trailing comma in inline tables.
- Clarify where and how dotted keys define tables.
Expand Down
5 changes: 2 additions & 3 deletions toml.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ newline =/ %x0D.0A ; CRLF

;; Comment

comment = comment-start-symbol *allowed-comment-char
comment-start-symbol = %x23 ; #
allowed-comment-char = %x01-09 / %x0E-7F / non-ascii
non-ascii = %x80-D7FF / %xE000-10FFFF
non-eol = %x09 / %x20-7E / non-ascii

comment = comment-start-symbol *non-eol

;; Key-Value pairs

Expand Down
7 changes: 3 additions & 4 deletions toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,16 @@ should be easy to parse into data structures in a wide variety of languages.
## Comment

A hash symbol marks the rest of the line as a comment, except when inside a
string.
string. Comments may contain any Unicode code points except the following
control codes that could cause problems during editing or processing: U+0000,
and U+000A to U+000D.

```toml
# This is a full-line comment
key = "value" # This is a comment at the end of a line
another = "# This is not a comment"
```

eksortso marked this conversation as resolved.
Show resolved Hide resolved
Control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F)
are not permitted in comments.

## Key/Value Pair

The primary building block of a TOML document is the key/value pair.
Expand Down