From 9fed3876c936dc79e5a11924596ae4347f603f6c Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Mon, 10 May 2021 00:11:34 -0400 Subject: [PATCH] Editorial: Copy EscapeSequence to TemplateEscapeSequence (#1867) ... 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.) --- spec.html | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/spec.html b/spec.html index cb4de79dd1..657112348d 100644 --- a/spec.html +++ b/spec.html @@ -16874,6 +16874,9 @@

Static Semantics: SV

  • The SV of UnicodeEscapeSequence :: `u{` CodePoint `}` is the result of performing UTF16EncodeCodePoint on the MV of |CodePoint|.
  • +
  • + The SV of TemplateEscapeSequence :: `0` is the String value consisting of the code unit 0x0000 (NULL). +
  • @@ -17000,12 +17003,18 @@

    Syntax

    TemplateCharacter :: `$` [lookahead != `{`] - `\` EscapeSequence + `\` TemplateEscapeSequence `\` NotEscapeSequence LineContinuation LineTerminatorSequence SourceCharacter but not one of ``` or `\` or `$` or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + `0` [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + NotEscapeSequence :: `0` DecimalDigit DecimalDigit but not `0` @@ -17025,7 +17034,6 @@

    Syntax

    CodePoint :: HexDigits[~Sep] [> but only if MV of |HexDigits| ≤ 0x10FFFF] -

    A conforming implementation must not use the extended definition of |EscapeSequence| described in when parsing a |TemplateCharacter|.

    |TemplateSubstitutionTail| is used by the |InputElementTemplateTail| alternative lexical goal.

    @@ -17056,7 +17064,7 @@

    Static Semantics: TV

    The TV of TemplateCharacter :: `$` is the String value consisting of the code unit 0x0024 (DOLLAR SIGN).
  • - The TV of TemplateCharacter :: `\` EscapeSequence is the SV of |EscapeSequence|. + The TV of TemplateCharacter :: `\` TemplateEscapeSequence is the SV of |TemplateEscapeSequence|.
  • The TV of TemplateCharacter :: `\` NotEscapeSequence is *undefined*. @@ -17096,13 +17104,13 @@

    Static Semantics: TRV

    The TRV of TemplateCharacter :: `$` is the String value consisting of the code unit 0x0024 (DOLLAR SIGN).
  • - The TRV of TemplateCharacter :: `\` EscapeSequence is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |EscapeSequence|. + The TRV of TemplateCharacter :: `\` TemplateEscapeSequence is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |TemplateEscapeSequence|.
  • The TRV of TemplateCharacter :: `\` NotEscapeSequence is the string-concatenation of the code unit 0x005C (REVERSE SOLIDUS) and the TRV of |NotEscapeSequence|.
  • - The TRV of EscapeSequence :: `0` is the String value consisting of the code unit 0x0030 (DIGIT ZERO). + The TRV of TemplateEscapeSequence :: `0` is the String value consisting of the code unit 0x0030 (DIGIT ZERO).
  • The TRV of NotEscapeSequence :: `0` DecimalDigit is the string-concatenation of the code unit 0x0030 (DIGIT ZERO) and the TRV of |DecimalDigit|. @@ -17181,7 +17189,7 @@

    Static Semantics: TRV

  • -

    TV excludes the code units of |LineContinuation| while TRV includes them. <CR><LF> and <CR> |LineTerminatorSequence|s are normalized to <LF> for both TV and TRV. An explicit |EscapeSequence| is needed to include a <CR> or <CR><LF> sequence.

    +

    TV excludes the code units of |LineContinuation| while TRV includes them. <CR><LF> and <CR> |LineTerminatorSequence|s are normalized to <LF> for both TV and TRV. An explicit |TemplateEscapeSequence| is needed to include a <CR> or <CR><LF> sequence.

    @@ -27092,7 +27100,7 @@

    Forbidden Extensions

    When processing strict mode code, an implementation must not relax the early error rules of .
  • - |TemplateCharacter| must not be extended to include or as defined in . + |TemplateEscapeSequence| must not be extended to include or as defined in .
  • When processing strict mode code, the extensions defined in , , , and must not be supported. @@ -45068,6 +45076,7 @@

    Lexical Grammar

    + @@ -45419,7 +45428,7 @@

    Syntax

    NonOctalDecimalEscapeSequence :: one of `8` `9` -

    This definition of |EscapeSequence| is not used in strict mode or when parsing |TemplateCharacter|.

    +

    This definition of |EscapeSequence| is not used in strict mode.

    It is possible for string literals to precede a Use Strict Directive that places the enclosing code in strict mode, 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: