Skip to content

Commit

Permalink
Normative: Fully specify legal escape sequences in RegExp capture gro…
Browse files Browse the repository at this point in the history
…up names (#1869)

This commit makes the Early Errors for RegExpIdentifierStart and RegExpIdentifierPart fully specified, with the semantics that Unicode escape sequences of the form `\u LeadSurrogate \u TrailSurrogate` as well as `\u { CodePoint }` are legal in named capture group names for both Unicode and non-Unicode regular expressions.

Fixes #1861
  • Loading branch information
bakkot authored and ljharb committed Apr 2, 2020
1 parent 3c6dbe6 commit 249c466
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -30885,7 +30885,7 @@ <h2>Syntax</h2>
`.`
`\` AtomEscape[?U, ?N]
CharacterClass[?U]
`(` GroupSpecifier[?U] Disjunction[?U, ?N] `)`
`(` GroupSpecifier Disjunction[?U, ?N] `)`
`(` `?` `:` Disjunction[?U, ?N] `)`

SyntaxCharacter :: one of
Expand All @@ -30898,7 +30898,7 @@ <h2>Syntax</h2>
DecimalEscape
CharacterClassEscape[?U]
CharacterEscape[?U]
[+N] `k` GroupName[?U]
[+N] `k` GroupName

CharacterEscape[U] ::
ControlEscape
Expand All @@ -30915,27 +30915,27 @@ <h2>Syntax</h2>
`a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
`A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`

GroupSpecifier[U] ::
GroupSpecifier ::
[empty]
`?` GroupName[?U]
`?` GroupName

GroupName[U] ::
`&lt;` RegExpIdentifierName[?U] `&gt;`
GroupName ::
`&lt;` RegExpIdentifierName `&gt;`

RegExpIdentifierName[U] ::
RegExpIdentifierStart[?U]
RegExpIdentifierName[?U] RegExpIdentifierPart[?U]
RegExpIdentifierName ::
RegExpIdentifierStart
RegExpIdentifierName RegExpIdentifierPart

RegExpIdentifierStart[U] ::
RegExpIdentifierStart ::
UnicodeIDStart
`$`
`_`
`\` RegExpUnicodeEscapeSequence[?U]
`\` RegExpUnicodeEscapeSequence[+U]

RegExpIdentifierPart[U] ::
RegExpIdentifierPart ::
UnicodeIDContinue
`$`
`\` RegExpUnicodeEscapeSequence[?U]
`\` RegExpUnicodeEscapeSequence[+U]
&lt;ZWNJ&gt;
&lt;ZWJ&gt;

Expand Down Expand Up @@ -31086,13 +31086,13 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>RegExpIdentifierStart[U] :: `\` RegExpUnicodeEscapeSequence[?U]</emu-grammar>
<ul>
<li>
It is a Syntax Error if the SV of |RegExpUnicodeEscapeSequence| is none of *"$"*, or *"_"*, or the UTF16Encoding of a code point matched by the |UnicodeIDStart| lexical grammar production.
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is none of *"$"*, or *"_"*, or the UTF16Encoding of a code point matched by the |UnicodeIDStart| lexical grammar production.
</li>
</ul>
<emu-grammar>RegExpIdentifierPart[U] :: `\` RegExpUnicodeEscapeSequence[?U]</emu-grammar>
<ul>
<li>
It is a Syntax Error if the SV of |RegExpUnicodeEscapeSequence| is none of *"$"*, or *"_"*, or the UTF16Encoding of either &lt;ZWNJ&gt; or &lt;ZWJ&gt;, or the UTF16Encoding of a Unicode code point that would be matched by the |UnicodeIDContinue| lexical grammar production.
It is a Syntax Error if the CharacterValue of |RegExpUnicodeEscapeSequence| is none of *"$"*, or *"_"*, or the UTF16Encoding of either &lt;ZWNJ&gt; or &lt;ZWJ&gt;, or the UTF16Encoding of a Unicode code point that would be matched by the |UnicodeIDContinue| lexical grammar production.
</li>
</ul>
<emu-grammar>UnicodePropertyValueExpression :: UnicodePropertyName `=` UnicodePropertyValue</emu-grammar>
Expand Down

0 comments on commit 249c466

Please sign in to comment.