Skip to content
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
145 changes: 112 additions & 33 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -16163,8 +16163,6 @@ <h1>Names and Keywords</h1>
<emu-note>
<p>This standard specifies specific code point additions: U+0024 (DOLLAR SIGN) and U+005F (LOW LINE) are permitted anywhere in an |IdentifierName|, and the code points U+200C (ZERO WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER) are permitted anywhere after the first code point of an |IdentifierName|.</p>
</emu-note>
<p>Unicode escape sequences are permitted in an |IdentifierName|, where they contribute a single Unicode code point to the |IdentifierName|. The code point is expressed by the |CodePoint| of the |UnicodeEscapeSequence| (see <emu-xref href="#sec-literals-string-literals"></emu-xref>). The `\\` preceding the |UnicodeEscapeSequence| and the `u` and `{ }` code units, if they appear, do not contribute code points to the |IdentifierName|. A |UnicodeEscapeSequence| cannot be used to put a code point into an |IdentifierName| that would otherwise be illegal. In other words, if a `\\` |UnicodeEscapeSequence| sequence were replaced by the |SourceCharacter| it contributes, the result must still be a valid |IdentifierName| that has the exact same sequence of |SourceCharacter| elements as the original |IdentifierName|. All interpretations of |IdentifierName| within this specification are based upon their actual code points regardless of whether or not an escape sequence was used to contribute any particular code point.</p>
<p>Two |IdentifierName|s that are canonically equivalent according to the Unicode standard are <em>not</em> equal unless, after replacement of each |UnicodeEscapeSequence|, they are represented by the exact same sequence of code points.</p>
<h2>Syntax</h2>
<emu-grammar type="definition">
PrivateIdentifier ::
Expand All @@ -16175,15 +16173,21 @@ <h2>Syntax</h2>
IdentifierName IdentifierPart

IdentifierStart ::
IdentifierStartChar
`\` UnicodeEscapeSequence

IdentifierPart ::
IdentifierPartChar
`\` UnicodeEscapeSequence

IdentifierStartChar ::
UnicodeIDStart
`$`
`_`
`\` UnicodeEscapeSequence

IdentifierPart ::
IdentifierPartChar ::
UnicodeIDContinue
`$`
`\` UnicodeEscapeSequence
&lt;ZWNJ&gt;
&lt;ZWJ&gt;

Expand All @@ -16203,22 +16207,63 @@ <h2>Syntax</h2>

<emu-clause id="sec-identifier-names">
<h1>Identifier Names</h1>
<p>Unicode escape sequences are permitted in an |IdentifierName|, where they contribute a single Unicode code point to the |IdentifierName|. The code point is expressed by the |CodePoint| of the |UnicodeEscapeSequence| (see <emu-xref href="#sec-literals-string-literals"></emu-xref>). The `\\` preceding the |UnicodeEscapeSequence| and the `u` and `{ }` code units, if they appear, do not contribute code points to the |IdentifierName|. A |UnicodeEscapeSequence| cannot be used to put a code point into an |IdentifierName| that would otherwise be illegal. In other words, if a `\\` |UnicodeEscapeSequence| sequence were replaced by the |SourceCharacter| it contributes, the result must still be a valid |IdentifierName| that has the exact same sequence of |SourceCharacter| elements as the original |IdentifierName|. All interpretations of |IdentifierName| within this specification are based upon their actual code points regardless of whether or not an escape sequence was used to contribute any particular code point.</p>
<p>Two |IdentifierName|s that are canonically equivalent according to the Unicode standard are <em>not</em> equal unless, after replacement of each |UnicodeEscapeSequence|, they are represented by the exact same sequence of code points.</p>

<emu-clause id="sec-identifier-names-static-semantics-early-errors">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>IdentifierStart :: `\` UnicodeEscapeSequence</emu-grammar>
<ul>
<li>
It is a Syntax Error if the SV of |UnicodeEscapeSequence| is none of *"$"*, or *"_"*, or ! UTF16EncodeCodePoint(_cp_) for some Unicode code point _cp_ matched by the |UnicodeIDStart| lexical grammar production.
It is a Syntax Error if IdentifierCodePoint of |UnicodeEscapeSequence| is not some Unicode code point matched by the |IdentifierStartChar| lexical grammar production.
</li>
</ul>
<emu-grammar>IdentifierPart :: `\` UnicodeEscapeSequence</emu-grammar>
<ul>
<li>
It is a Syntax Error if the SV of |UnicodeEscapeSequence| is none of *"$"*, *"_"*, ! UTF16EncodeCodePoint(&lt;ZWNJ&gt;), ! UTF16EncodeCodePoint(&lt;ZWJ&gt;), or ! UTF16EncodeCodePoint(_cp_) for some Unicode code point _cp_ that would be matched by the |UnicodeIDContinue| lexical grammar production.
It is a Syntax Error if IdentifierCodePoint of |UnicodeEscapeSequence| is not some Unicode code point matched by the |IdentifierPartChar| lexical grammar production.
</li>
</ul>
</emu-clause>

<emu-clause id="sec-identifiercodepoints" type="sdo">
<h1>Static Semantics: IdentifierCodePoints</h1>
<dl class="header">
</dl>
<emu-grammar>IdentifierName :: IdentifierStart</emu-grammar>
<emu-alg>
1. Let _cp_ be IdentifierCodePoint of |IdentifierStart|.
1. Return &laquo; _cp_ &raquo;.
</emu-alg>
<emu-grammar>IdentifierName :: IdentifierName IdentifierPart</emu-grammar>
<emu-alg>
1. Let _cps_ be IdentifierCodePoints of the derived |IdentifierName|.
1. Let _cp_ be IdentifierCodePoint of |IdentifierPart|.
1. Return the list-concatenation of _cps_ and &laquo; _cp_ &raquo;.
</emu-alg>
</emu-clause>

<emu-clause id="sec-identifiercodepoint" type="sdo">
<h1>Static Semantics: IdentifierCodePoint</h1>
<dl class="header">
</dl>
<emu-grammar>IdentifierStart :: IdentifierStartChar</emu-grammar>
<emu-alg>
1. Return the code point matched by |IdentifierStartChar|.
</emu-alg>
<emu-grammar>IdentifierPart :: IdentifierPartChar</emu-grammar>
<emu-alg>
1. Return the code point matched by |IdentifierPartChar|.
</emu-alg>
<emu-grammar>UnicodeEscapeSequence :: `u` Hex4Digits</emu-grammar>
<emu-alg>
1. Return the code point whose numeric value is the MV of |Hex4Digits|.
</emu-alg>
<emu-grammar>UnicodeEscapeSequence :: `u{` CodePoint `}`</emu-grammar>
<emu-alg>
1. Return the code point whose numeric value is the MV of |CodePoint|.
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-keywords-and-reserved-words" oldids="sec-reserved-words,sec-keywords,sec-future-reserved-words">
Expand Down Expand Up @@ -17057,22 +17102,12 @@ <h2>Syntax</h2>

RegularExpressionFlags ::
[empty]
RegularExpressionFlags IdentifierPart
RegularExpressionFlags IdentifierPartChar
</emu-grammar>
<emu-note>
<p>Regular expression literals may not be empty; instead of representing an empty regular expression literal, the code unit sequence `//` starts a single-line comment. To specify an empty regular expression, use: `/(?:)/`.</p>
</emu-note>

<emu-clause id="sec-literals-regular-expression-literals-static-semantics-early-errors">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>RegularExpressionFlags :: RegularExpressionFlags IdentifierPart</emu-grammar>
<ul>
<li>
It is a Syntax Error if |IdentifierPart| contains a Unicode escape sequence.
</li>
</ul>
</emu-clause>

<emu-clause id="sec-static-semantics-bodytext" type="sdo">
<h1>Static Semantics: BodyText</h1>
<dl class="header">
Expand Down Expand Up @@ -17676,8 +17711,7 @@ <h1>Static Semantics: StringValue</h1>
IdentifierName IdentifierPart
</emu-grammar>
<emu-alg>
1. Let _idText_ be the source text matched by |IdentifierName|.
1. Let _idTextUnescaped_ be the result of replacing any occurrences of `\\` |UnicodeEscapeSequence| in _idText_ with the code point represented by the |UnicodeEscapeSequence|.
1. Let _idTextUnescaped_ be IdentifierCodePoints of |IdentifierName|.
1. Return ! CodePointsToString(_idTextUnescaped_).
</emu-alg>
<emu-grammar>
Expand Down Expand Up @@ -34244,19 +34278,14 @@ <h2>Syntax</h2>
RegExpIdentifierName[?UnicodeMode] RegExpIdentifierPart[?UnicodeMode]

RegExpIdentifierStart[UnicodeMode] ::
UnicodeIDStart
`$`
`_`
IdentifierStartChar
`\` RegExpUnicodeEscapeSequence[+UnicodeMode]
[~UnicodeMode] UnicodeLeadSurrogate UnicodeTrailSurrogate

RegExpIdentifierPart[UnicodeMode] ::
UnicodeIDContinue
`$`
IdentifierPartChar
`\` RegExpUnicodeEscapeSequence[+UnicodeMode]
[~UnicodeMode] UnicodeLeadSurrogate UnicodeTrailSurrogate
&lt;ZWNJ&gt;
&lt;ZWJ&gt;

RegExpUnicodeEscapeSequence[UnicodeMode] ::
[+UnicodeMode] `u` HexLeadSurrogate `\u` HexTrailSurrogate
Expand Down Expand Up @@ -34418,25 +34447,25 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>RegExpIdentifierStart :: `\` RegExpUnicodeEscapeSequence</emu-grammar>
<ul>
<li>
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is not the code point value of *"$"*, *"_"*, or some code point matched by the |UnicodeIDStart| lexical grammar production.
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is not the code point value of some code point matched by the |IdentifierStartChar| lexical grammar production.
</li>
</ul>
<emu-grammar>RegExpIdentifierStart :: UnicodeLeadSurrogate UnicodeTrailSurrogate</emu-grammar>
<ul>
<li>
It is a Syntax Error if the result of performing UTF16SurrogatePairToCodePoint on the two code points matched by |UnicodeLeadSurrogate| and |UnicodeTrailSurrogate| respectively is not matched by the |UnicodeIDStart| lexical grammar production.
It is a Syntax Error if RegExpIdentifierCodePoint of |RegExpIdentifierStart| is not matched by the |UnicodeIDStart| lexical grammar production.
</li>
</ul>
<emu-grammar>RegExpIdentifierPart :: `\` RegExpUnicodeEscapeSequence</emu-grammar>
<ul>
<li>
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is not the code point value of *"$"*, *"_"*, &lt;ZWNJ&gt;, &lt;ZWJ&gt;, or some code point matched by the |UnicodeIDContinue| lexical grammar production.
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is not the code point value of some code point matched by the |IdentifierPartChar| lexical grammar production.
</li>
</ul>
<emu-grammar>RegExpIdentifierPart :: UnicodeLeadSurrogate UnicodeTrailSurrogate</emu-grammar>
<ul>
<li>
It is a Syntax Error if the result of performing UTF16SurrogatePairToCodePoint on the two code points matched by |UnicodeLeadSurrogate| and |UnicodeTrailSurrogate| respectively is not matched by the |UnicodeIDContinue| lexical grammar production.
It is a Syntax Error if RegExpIdentifierCodePoint of |RegExpIdentifierPart| is not matched by the |UnicodeIDContinue| lexical grammar production.
</li>
</ul>
<emu-grammar>UnicodePropertyValueExpression :: UnicodePropertyName `=` UnicodePropertyValue</emu-grammar>
Expand Down Expand Up @@ -34719,11 +34748,59 @@ <h1>Static Semantics: CapturingGroupName</h1>
RegExpIdentifierName RegExpIdentifierPart
</emu-grammar>
<emu-alg>
1. Let _idText_ be the source text matched by |RegExpIdentifierName|.
1. Let _idTextUnescaped_ be the result of replacing any occurrences of `\\` |RegExpUnicodeEscapeSequence| in _idText_ with the code point represented by the |RegExpUnicodeEscapeSequence|.
1. Let _idTextUnescaped_ be RegExpIdentifierCodePoints of |RegExpIdentifierName|.
1. Return ! CodePointsToString(_idTextUnescaped_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-regexpidentifiercodepoints" type="sdo">
<h1>Static Semantics: RegExpIdentifierCodePoints</h1>
<dl class="header">
</dl>
<emu-grammar>RegExpIdentifierName :: RegExpIdentifierStart</emu-grammar>
<emu-alg>
1. Let _cp_ be RegExpIdentifierCodePoint of |RegExpIdentifierStart|.
1. Return &laquo; _cp_ &raquo;.
</emu-alg>
<emu-grammar>RegExpIdentifierName :: RegExpIdentifierName RegExpIdentifierPart</emu-grammar>
<emu-alg>
1. Let _cps_ be RegExpIdentifierCodePoints of the derived |RegExpIdentifierName|.
1. Let _cp_ be RegExpIdentifierCodePoint of |RegExpIdentifierPart|.
1. Return the list-concatenation of _cps_ and &laquo; _cp_ &raquo;.
</emu-alg>
</emu-clause>

<emu-clause id="sec-regexpidentifiercodepoint" type="sdo">
<h1>Static Semantics: RegExpIdentifierCodePoint</h1>
<dl class="header">
</dl>
<emu-grammar>RegExpIdentifierStart :: IdentifierStartChar</emu-grammar>
<emu-alg>
1. Return the code point matched by |IdentifierStartChar|.
</emu-alg>
<emu-grammar>RegExpIdentifierPart :: IdentifierPartChar</emu-grammar>
<emu-alg>
1. Return the code point matched by |IdentifierPartChar|.
</emu-alg>
<emu-grammar>
RegExpIdentifierStart :: `\` RegExpUnicodeEscapeSequence

RegExpIdentifierPart :: `\` RegExpUnicodeEscapeSequence
</emu-grammar>
<emu-alg>
1. Return the code point whose numeric value is the CharacterValue of |RegExpUnicodeEscapeSequence|.
</emu-alg>
<emu-grammar>
RegExpIdentifierStart :: UnicodeLeadSurrogate UnicodeTrailSurrogate

RegExpIdentifierPart :: UnicodeLeadSurrogate UnicodeTrailSurrogate
</emu-grammar>
<emu-alg>
1. Let _lead_ be the code unit whose numeric value is that of the code point matched by |UnicodeLeadSurrogate|.
1. Let _trail_ be the code unit whose numeric value is that of the code point matched by |UnicodeTrailSurrogate|.
1. Return UTF16SurrogatePairToCodePoint(_lead_, _trail_).
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-pattern-semantics">
Expand Down Expand Up @@ -46020,6 +46097,8 @@ <h1>Lexical Grammar</h1>
<emu-prodref name="IdentifierName"></emu-prodref>
<emu-prodref name="IdentifierStart"></emu-prodref>
<emu-prodref name="IdentifierPart"></emu-prodref>
<emu-prodref name="IdentifierStartChar"></emu-prodref>
<emu-prodref name="IdentifierPartChar"></emu-prodref>
<emu-prodref name="UnicodeIDStart"></emu-prodref>
<emu-prodref name="UnicodeIDContinue"></emu-prodref>
<emu-prodref name="ReservedWord"></emu-prodref>
Expand Down