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

[spec] handle surrogate pairs #71

Merged
merged 1 commit into from
Mar 28, 2024
Merged
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
21 changes: 8 additions & 13 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,16 @@ contributors: Jordan Harband
1. Let _punctuators_ be the string-concatenation of *"(){}[]|,.?\*+-^$=<>/#&!%:;@~'`"*, the code unit 0x0022 (QUOTATION MARK), and the code unit 0x005C (REVERSE SOLIDUS).
1. Let _toEscape_ be StringToCodePoints(_punctuators_).
1. If _toEscape_ contains _c_ or _c_ is matched by |WhiteSpace|, then
1. Append the code point U+005C (REVERSE SOLIDUS) to _codePoints_.
1. Let _hex_ be Number::toString(𝔽(_c_), 16).
1. If the length of _hex_ is 1 or 2, then
1. Set _hex_ to StringPad(_hex_, 2, *"0"*, ~start~).
1. If _c_ ≤ 0xFF, then
1. Append the code point U+005C (REVERSE SOLIDUS) to _codePoints_.
1. Append the code point U+0078 (LATIN SMALL LETTER X) to _codePoints_.
1. Let _hex_ be Number::toString(𝔽(_c_), 16).
1. Set _hex_ to StringPad(_hex_, 2, *"0"*, ~start~).
1. Append the code points in StringToCodePoints(_hex_) to _codePoints_.
1. Else if the length of _hex_ is 3 or 4, then
1. Set _hex_ to StringPad(_hex_, 4, *"0"*, ~start~).
1. Append the code point U+0075 (LATIN SMALL LETTER U) to _codePoints_.
1. Append the code points in StringToCodePoints(_hex_) to _codePoints_.
1. Else,
1. Append the code point U+0075 (LATIN SMALL LETTER U) to _codePoints_.
1. Append the code point U+007B (LEFT CURLY BRACKET) to _codePoints_.
1. Append the code points in StringToCodePoints(_hex_) to _codePoints_.
1. Append the code point U+007D (RIGHT CURLY BRACKET) to _codePoints_.
1. Let _codeUnits_ be UTF16EncodeCodePoint(_c_).
1. For each code unit _cu_ of _codeUnits_, do
1. Let _escape_ be UnicodeEscape(_cu_).
1. Append the code points in StringToCodePoints(_escape_) to _codePoints_.
1. Else,
1. Append _c_ to _codePoints_.
1. Return _codePoints_.
Expand Down
Loading