From ab7495887ccd0f567d8a220e1a5ab0ca6fdbd16f Mon Sep 17 00:00:00 2001 From: Dave Ostroske Date: Tue, 10 Jan 2023 16:12:19 -0500 Subject: [PATCH] Permit more control characters in comments (#924) Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com> Co-authored-by: Pradyun Gedam --- CHANGELOG.md | 1 + toml.abnf | 5 ++--- toml.md | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a7620f5..199c3131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/toml.abnf b/toml.abnf index 01eabd6b..499f5ee0 100644 --- a/toml.abnf +++ b/toml.abnf @@ -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 diff --git a/toml.md b/toml.md index c6947177..34c6481c 100644 --- a/toml.md +++ b/toml.md @@ -52,8 +52,9 @@ key = "value" # This is a comment at the end of a line another = "# This is not a comment" ``` -Control characters other than tab (U+0000 to U+0008, U+000A to U+001F, U+007F) -are not permitted in comments. +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. ## Key/Value Pair