diff --git a/spec/message.abnf b/spec/message.abnf index 30c3415584..278402d1bc 100644 --- a/spec/message.abnf +++ b/spec/message.abnf @@ -36,11 +36,12 @@ quoted-char = %x0-5B ; omit \ / %x7D-D7FF ; omit surrogates / %xE000-10FFFF -; based on https://www.w3.org/TR/xml/#NT-Nmtoken, -; but cannot start with U+002D HYPHEN-MINUS or U+003A COLON ":" +; literals that do not require quoting +; containing no whitespace and with a restricted range of characters unquoted = unquoted-start *name-char unquoted-start = name-start / DIGIT / "." / %xB7 / %x300-36F / %x203F-2040 + / "-" ( DIGIT / "." ) ; reserve sigils for private-use by implementations diff --git a/spec/syntax.md b/spec/syntax.md index 099d5a4696..5492bd5821 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -605,9 +605,10 @@ Implementations MUST NOT distinguish between _quoted_ and _unquoted_ literals that have the same sequence of code points. _Unquoted_ literals have a much more restricted range that -is intentionally close to the XML's [Nmtoken](https://www.w3.org/TR/xml/#NT-Nmtoken), -with the restriction that it MUST NOT start with `-` or `:`, -as those would conflict with _function_ start characters. +is intentionally close to XML's [Nmtoken](https://www.w3.org/TR/xml/#NT-Nmtoken). +To make _unquoted_ literals distinct from _function_ names, +a literal MUST be quoted if it begins with a `:` +or if it begins with a `-` that is **not** followed by a `.` or a digit. ```abnf literal = quoted / unquoted @@ -621,6 +622,7 @@ quoted-char = %x0-5B ; omit \ unquoted = unquoted-start *name-char unquoted-start = name-start / DIGIT / "." / %xB7 / %x300-36F / %x203F-2040 + / "-" ( DIGIT / "." ) ``` ### Names