Skip to content

Commit 76dc3e3

Browse files
authored
doc: resolve inconsistency in banned chars in escaped form (#450)
Also add it explicitly to the spec grammar to make it clear that escaped forms are also affected
1 parent 646dafc commit 76dc3e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

SPEC.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,8 @@ considered _a single newline_.
819819
### Disallowed Literal Code Points
820820

821821
The following code points may not appear literally anywhere in the document.
822-
They may be represented in Strings (but not Raw Strings) using [Unicode Escapes](#escapes) (`\u{...}`).
822+
They may be represented in Strings (but not Raw Strings) using [Unicode Escapes](#escapes) (`\u{...}`,
823+
except for non Unicode Scalar Value, which can't be represented even as escapes).
823824

824825
* The codepoints `U+0000-0008` or the codepoints `U+000E-001F` (various
825826
control characters).
@@ -876,9 +877,13 @@ disallowed-keyword-identifiers := 'true' | 'false' | 'null' | 'inf' | '-inf' | '
876877
quoted-string := '"' single-line-string-body '"' | '"""' newline multi-line-string-body newline (unicode-space | ws-escape)* '"""'
877878
single-line-string-body := (string-character - newline)*
878879
multi-line-string-body := (('"' | '""')? string-character)*
879-
string-character := '\\' (["\\bfnrts] | 'u{' hex-digit{1, 6} '}') | ws-escape | [^\\"] - disallowed-literal-code-points
880+
string-character := '\\' (["\\bfnrts] | 'u{' hex-unicode '}') | ws-escape | [^\\"] - disallowed-literal-code-points
880881
ws-escape := '\\' (unicode-space | newline)+
881882
hex-digit := [0-9a-fA-F]
883+
hex-unicode := hex-digit{1, 6} - surrogates
884+
surrogates := [dD][8-9a-fA-F]hex-digit{2}
885+
// U+D800-DFFF: D 8 00
886+
// D F FF
882887
883888
raw-string := '#' raw-string-quotes '#' | '#' raw-string '#'
884889
raw-string-quotes := '"' single-line-raw-string-body '"' | '"""' newline multi-line-raw-string-body newline unicode-space* '"""'

0 commit comments

Comments
 (0)