Skip to content

Commit

Permalink
Editorial: Copy EscapeSequence to TemplateEscapeSequence
Browse files Browse the repository at this point in the history
... and replace the former with the latter in TemplateCharacter.

The spec prohibits applying the B.1.2 extensions
to EscapeSequence when it appears in TemplateCharacter;
this change accomplishes that in the grammar rather than in prose.

(This makes it a little easier to 'mainline' the B.1.2 extensions
in the next commit.)
  • Loading branch information
jmdyck committed Jun 10, 2021
1 parent 5656412 commit 060cad7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -14608,6 +14608,9 @@ <h1>Static Semantics: SV</h1>
<li>
The SV of <emu-grammar>UnicodeEscapeSequence :: `u{` CodePoint `}`</emu-grammar> is the result of performing UTF16EncodeCodePoint on the MV of |CodePoint|.
</li>
<li>
The SV of <emu-grammar>TemplateEscapeSequence :: `0`</emu-grammar> is the String value consisting of the code unit 0x0000 (NULL).
</li>
</ul>
</emu-clause>

Expand Down Expand Up @@ -14734,12 +14737,18 @@ <h2>Syntax</h2>

TemplateCharacter ::
`$` [lookahead != `{`]
`\` EscapeSequence
`\` TemplateEscapeSequence
`\` NotEscapeSequence
LineContinuation
LineTerminatorSequence
SourceCharacter but not one of ``` or `\` or `$` or LineTerminator

TemplateEscapeSequence ::
CharacterEscapeSequence
`0` [lookahead &lt;! DecimalDigit]
HexEscapeSequence
UnicodeEscapeSequence

NotEscapeSequence ::
`0` DecimalDigit
DecimalDigit but not `0`
Expand All @@ -14759,7 +14768,6 @@ <h2>Syntax</h2>
CodePoint ::
HexDigits[~Sep] [> but only if MV of |HexDigits| &le; 0x10FFFF]
</emu-grammar>
<p>A conforming implementation must not use the extended definition of |EscapeSequence| described in <emu-xref href="#sec-additional-syntax-string-literals"></emu-xref> when parsing a |TemplateCharacter|.</p>
<emu-note>
<p>|TemplateSubstitutionTail| is used by the |InputElementTemplateTail| alternative lexical goal.</p>
</emu-note>
Expand Down Expand Up @@ -14790,7 +14798,7 @@ <h1>Static Semantics: TV and TRV</h1>
The TV of <emu-grammar>TemplateCharacter :: `$`</emu-grammar> is the String value consisting of the code unit 0x0024 (DOLLAR SIGN).
</li>
<li>
The TV of <emu-grammar>TemplateCharacter :: `\` EscapeSequence</emu-grammar> is the SV of |EscapeSequence|.
The TV of <emu-grammar>TemplateCharacter :: `\` TemplateEscapeSequence</emu-grammar> is the SV of |TemplateEscapeSequence|.
</li>
<li>
The TV of <emu-grammar>TemplateCharacter :: `\` NotEscapeSequence</emu-grammar> is *undefined*.
Expand All @@ -14811,13 +14819,13 @@ <h1>Static Semantics: TV and TRV</h1>
The TRV of <emu-grammar>TemplateCharacter :: `$`</emu-grammar> is the String value consisting of the code unit 0x0024 (DOLLAR SIGN).
</li>
<li>
The TRV of <emu-grammar>TemplateCharacter :: `\` EscapeSequence</emu-grammar> is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |EscapeSequence|.
The TRV of <emu-grammar>TemplateCharacter :: `\` TemplateEscapeSequence</emu-grammar> is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |TemplateEscapeSequence|.
</li>
<li>
The TRV of <emu-grammar>TemplateCharacter :: `\` NotEscapeSequence</emu-grammar> is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |NotEscapeSequence|.
</li>
<li>
The TRV of <emu-grammar>EscapeSequence :: `0`</emu-grammar> is the String value consisting of the code unit 0x0030 (DIGIT ZERO).
The TRV of <emu-grammar>TemplateEscapeSequence :: `0`</emu-grammar> is the String value consisting of the code unit 0x0030 (DIGIT ZERO).
</li>
<li>
The TRV of <emu-grammar>NotEscapeSequence :: `0` DecimalDigit</emu-grammar> is the string-concatenation of the code unit 0x0030 (DIGIT ZERO) and the TRV of |DecimalDigit|.
Expand Down Expand Up @@ -14896,7 +14904,7 @@ <h1>Static Semantics: TV and TRV</h1>
</li>
</ul>
<emu-note>
<p>TV excludes the code units of |LineContinuation| while TRV includes them. &lt;CR&gt;&lt;LF&gt; and &lt;CR&gt; |LineTerminatorSequence|s are normalized to &lt;LF&gt; for both TV and TRV. An explicit |EscapeSequence| is needed to include a &lt;CR&gt; or &lt;CR&gt;&lt;LF&gt; sequence.</p>
<p>TV excludes the code units of |LineContinuation| while TRV includes them. &lt;CR&gt;&lt;LF&gt; and &lt;CR&gt; |LineTerminatorSequence|s are normalized to &lt;LF&gt; for both TV and TRV. An explicit |TemplateEscapeSequence| is needed to include a &lt;CR&gt; or &lt;CR&gt;&lt;LF&gt; sequence.</p>
</emu-note>
</emu-clause>
</emu-clause>
Expand Down Expand Up @@ -41446,6 +41454,7 @@ <h1>Lexical Grammar</h1>
<emu-prodref name="TemplateTail"></emu-prodref>
<emu-prodref name="TemplateCharacters"></emu-prodref>
<emu-prodref name="TemplateCharacter"></emu-prodref>
<emu-prodref name="TemplateEscapeSequence"></emu-prodref>
<emu-prodref name="NotEscapeSequence"></emu-prodref>
<emu-prodref name="NotCodePoint"></emu-prodref>
<emu-prodref name="CodePoint"></emu-prodref>
Expand Down Expand Up @@ -41797,7 +41806,7 @@ <h2>Syntax</h2>
NonOctalDecimalEscapeSequence :: one of
`8` `9`
</emu-grammar>
<p>This definition of |EscapeSequence| is not used in strict mode or when parsing |TemplateCharacter|.</p>
<p>This definition of |EscapeSequence| is not used in strict mode.</p>
<emu-note>
<p>It is possible for string literals to precede a Use Strict Directive that places the enclosing code in <emu-xref href="#sec-strict-mode-code">strict mode</emu-xref>, and implementations must take care to not use this extended definition of |EscapeSequence| with such literals. For example, attempting to parse the following source text must fail:</p>
<pre><code class="javascript">
Expand Down

0 comments on commit 060cad7

Please sign in to comment.