Skip to content

Commit

Permalink
[spec] hex-escape punctuators
Browse files Browse the repository at this point in the history
Fixes 65
  • Loading branch information
ljharb committed Mar 22, 2024
1 parent 44ab978 commit 89f7fc2
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,6 @@ contributors: Jordan Harband
<emu-clause id="sec-regexp-regular-expression-objects" number="2">
<h1>RegExp (Regular Expression) Objects</h1>

<emu-clause id="sec-patterns" number="1">
<h1>Patterns</h1>

<h2>Syntax</h2>
<p>Each `\\u` |HexTrailSurrogate| for which the choice of associated `u` |HexLeadSurrogate| is ambiguous shall be associated with the nearest possible `u` |HexLeadSurrogate| that would otherwise have no corresponding `\\u` |HexTrailSurrogate|.</p>
<emu-grammar type="definition">
HexNonSurrogate ::
Hex4Digits [> but only if the MV of |Hex4Digits| is not in the inclusive interval from 0xD800 to 0xDFFF]

IdentityEscape[UnicodeMode] ::
[+UnicodeMode] SyntaxCharacter
[+UnicodeMode] `/` <ins>`,` `-` `=` `<` `>` `#` `&` `!` `%` `:` `;` `@` `~` `'` `"` `\``</ins>
<ins>[+UnicodeMode] WhiteSpace</ins>
[~UnicodeMode] SourceCharacter but not UnicodeIDContinue

DecimalEscape ::
NonZeroDigit DecimalDigits[~Sep]? [lookahead &notin; DecimalDigit]
</emu-grammar>
</emu-clause>

<emu-clause id="sec-properties-of-the-regexp-constructor" number="5">
<h1>Properties of the RegExp Constructor</h1>

Expand All @@ -55,9 +35,14 @@ contributors: Jordan Harband
1. Append code unit U+005C (REVERSE SOLIDUS) to _escapedList_.
1. Append code unit U+0078 (LATIN SMALL LETTER X) to _escapedList_.
1. Append code unit U+0033 (DIGIT THREE) to _escapedList_.
1. Append _c_ to _escapedList_.
1. Else if _toEscape_ contains _c_ or _c_ is matched by |WhiteSpace|, then
1. Append code unit U+005C (REVERSE SOLIDUS) to _escapedList_.
1. Append _c_ to _escapedList_.
1. Append code unit U+0078 (LATIN SMALL LETTER X) to _escapedList_.
1. Let _code_ be ℝ(! Call(%parseInt%, CodePointsToString(« _c_ »), « *16*<sub>𝔽</sub> »)) - 36.
1. Append the code unit whose numeric value is _code_ to _escapedList_.
1. Else,
1. Append _c_ to _escapedList_.
1. Return CodePointsToString(_escapedList_).
</emu-alg>

Expand Down

0 comments on commit 89f7fc2

Please sign in to comment.