diff --git a/spec.html b/spec.html index 4c869347727..e3289e17d95 100644 --- a/spec.html +++ b/spec.html @@ -14320,12 +14320,11 @@

Syntax

EscapeSequence :: CharacterEscapeSequence - `0` [lookahead <! DecimalDigit] + LegacyOctalEscapeSequence + NonOctalDecimalEscapeSequence HexEscapeSequence UnicodeEscapeSequence - -

A conforming implementation, when processing strict mode code, must not extend the syntax of |EscapeSequence| to include or as described in .

- + CharacterEscapeSequence :: SingleEscapeCharacter NonEscapeCharacter @@ -14342,6 +14341,21 @@

Syntax

`x` `u` + LegacyOctalEscapeSequence :: + OctalDigit [lookahead <! OctalDigit] + ZeroToThree OctalDigit [lookahead <! OctalDigit] + FourToSeven OctalDigit + ZeroToThree OctalDigit OctalDigit + + ZeroToThree :: one of + `0` `1` `2` `3` + + FourToSeven :: one of + `4` `5` `6` `7` + + NonOctalDecimalEscapeSequence :: one of + `8` `9` + HexEscapeSequence :: `x` HexDigit HexDigit @@ -14357,7 +14371,37 @@

Syntax

<LF> and <CR> cannot appear in a string literal, except as part of a |LineContinuation| to produce the empty code points sequence. The proper way to include either in the String value of a string literal is to use an escape sequence such as `\\n` or `\\u000A`.

- +

Supplemental Syntax

+

When processing an instance of the production LegacyOctalEscapeSequence :: OctalDigit the following production is used to refine the interpretation of |LegacyOctalEscapeSequence|.

+ + StrictZeroEscapeSequence :: + `0` [lookahead <! DecimalDigit] + + + +

Static Semantics: Early Errors

+ + EscapeSequence :: LegacyOctalEscapeSequence + +
    +
  • It is a Syntax Error if the source code matching this production is strict mode code and |EscapeSequence| is not covering a |StrictZeroEscapeSequence|.
  • +
+ + EscapeSequence :: NonOctalDecimalEscapeSequence + +
    +
  • It is a Syntax Error if the source code matching this production is strict mode code.
  • +
+ In non-strict code, this syntax is allowed, but deprecated. + +

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 enforce the above rules for such literals. For example, the following source text contains a Syntax Error:

+

+            function invalid() { "\7"; "use strict"; }
+          
+
+
+ +

Static Semantics: SV

A string literal stands for a value of the String type. The String value (SV) of the literal is described in terms of String values contributed by the various parts of the string literal. As part of this process, some Unicode code points within the string literal are interpreted as having a mathematical value (MV), as described below or in .

    @@ -14397,9 +14441,6 @@

    Static Semantics: SV

  • The SV of SingleStringCharacter :: LineContinuation is the empty String.
  • -
  • - The SV of EscapeSequence :: `0` is the String value consisting of the code unit 0x0000 (NULL). -
  • The SV of CharacterEscapeSequence :: SingleEscapeCharacter is the String value consisting of the code unit whose value is determined by the |SingleEscapeCharacter| according to .
  • @@ -14554,6 +14595,15 @@

    Static Semantics: SV

  • The SV of NonEscapeCharacter :: SourceCharacter but not one of EscapeCharacter or LineTerminator is the result of performing UTF16EncodeCodePoint on the code point value of |SourceCharacter|.
  • +
  • + The SV of EscapeSequence :: LegacyOctalEscapeSequence is the String value consisting of the code unit whose value is the MV of |LegacyOctalEscapeSequence|. +
  • +
  • + The SV of NonOctalDecimalEscapeSequence :: `8` is the String value consisting of the code unit 0x0038 (DIGIT EIGHT). +
  • +
  • + The SV of NonOctalDecimalEscapeSequence :: `9` is the String value consisting of the code unit 0x0039 (DIGIT NINE). +
  • The SV of HexEscapeSequence :: `x` HexDigit HexDigit is the String value consisting of the code unit whose value is the MV of |HexEscapeSequence|.
  • @@ -14572,6 +14622,39 @@

    Static Semantics: SV

    Static Semantics: MV

      +
    • + The MV of LegacyOctalEscapeSequence :: ZeroToThree OctalDigit is (8 times the MV of |ZeroToThree|) plus the MV of |OctalDigit|. +
    • +
    • + The MV of LegacyOctalEscapeSequence :: FourToSeven OctalDigit is (8 times the MV of |FourToSeven|) plus the MV of |OctalDigit|. +
    • +
    • + The MV of LegacyOctalEscapeSequence :: ZeroToThree OctalDigit OctalDigit is (64 (that is, 82) times the MV of |ZeroToThree|) plus (8 times the MV of the first |OctalDigit|) plus the MV of the second |OctalDigit|. +
    • +
    • + The MV of ZeroToThree :: `0` is 0. +
    • +
    • + The MV of ZeroToThree :: `1` is 1. +
    • +
    • + The MV of ZeroToThree :: `2` is 2. +
    • +
    • + The MV of ZeroToThree :: `3` is 3. +
    • +
    • + The MV of FourToSeven :: `4` is 4. +
    • +
    • + The MV of FourToSeven :: `5` is 5. +
    • +
    • + The MV of FourToSeven :: `6` is 6. +
    • +
    • + The MV of FourToSeven :: `7` is 7. +
    • The MV of HexEscapeSequence :: `x` HexDigit HexDigit is (16 times the MV of the first |HexDigit|) plus the MV of the second |HexDigit|.
    • @@ -24464,7 +24547,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 . + |TemplateCharacter| must not be extended to include |LegacyOctalEscapeSequence| or |NonOctalDecimalEscapeSequence| as defined in .
    • When processing strict mode code, the extensions defined in , , , and must not be supported. @@ -41337,9 +41420,16 @@

      Lexical Grammar

      + + + + +

      When processing an instance of the production the following production is used to refine the interpretation of |LegacyOctalEscapeSequence|.

      + +

       

      @@ -41686,86 +41776,13 @@

      Additional Syntax

      String Literals

      -

      The syntax and semantics of is extended as follows except that this extension is not allowed for strict mode code:

      -

      Syntax

      - - EscapeSequence :: - CharacterEscapeSequence - LegacyOctalEscapeSequence - NonOctalDecimalEscapeSequence - HexEscapeSequence - UnicodeEscapeSequence - - LegacyOctalEscapeSequence :: - OctalDigit [lookahead <! OctalDigit] - ZeroToThree OctalDigit [lookahead <! OctalDigit] - FourToSeven OctalDigit - ZeroToThree OctalDigit OctalDigit - - ZeroToThree :: one of - `0` `1` `2` `3` - - FourToSeven :: one of - `4` `5` `6` `7` +

      The following syntax from , and its associated semantics, used to be normative optional:

      + + EscapeSequence :: LegacyOctalEscapeSequence - NonOctalDecimalEscapeSequence :: one of - `8` `9` + EscapeSequence :: NonOctalDecimalEscapeSequence -

      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:

      -
      
      -          function invalid() { "\7"; "use strict"; }
      -        
      -
      - - -

      Static Semantics

      -
        -
      • - The SV of EscapeSequence :: LegacyOctalEscapeSequence is the String value consisting of the code unit whose value is the MV of |LegacyOctalEscapeSequence|. -
      • -
      • - The MV of LegacyOctalEscapeSequence :: ZeroToThree OctalDigit is (8 times the MV of |ZeroToThree|) plus the MV of |OctalDigit|. -
      • -
      • - The MV of LegacyOctalEscapeSequence :: FourToSeven OctalDigit is (8 times the MV of |FourToSeven|) plus the MV of |OctalDigit|. -
      • -
      • - The MV of LegacyOctalEscapeSequence :: ZeroToThree OctalDigit OctalDigit is (64 (that is, 82) times the MV of |ZeroToThree|) plus (8 times the MV of the first |OctalDigit|) plus the MV of the second |OctalDigit|. -
      • -
      • - The SV of NonOctalDecimalEscapeSequence :: `8` is the String value consisting of the code unit 0x0038 (DIGIT EIGHT). -
      • -
      • - The SV of NonOctalDecimalEscapeSequence :: `9` is the String value consisting of the code unit 0x0039 (DIGIT NINE). -
      • -
      • - The MV of ZeroToThree :: `0` is 0. -
      • -
      • - The MV of ZeroToThree :: `1` is 1. -
      • -
      • - The MV of ZeroToThree :: `2` is 2. -
      • -
      • - The MV of ZeroToThree :: `3` is 3. -
      • -
      • - The MV of FourToSeven :: `4` is 4. -
      • -
      • - The MV of FourToSeven :: `5` is 5. -
      • -
      • - The MV of FourToSeven :: `6` is 6. -
      • -
      • - The MV of FourToSeven :: `7` is 7. -
      • -
      -
      +

      and the productions for |LegacyOctalEscapeSequence|, |ZeroToThree|, and |FourToSeven|.

      @@ -41972,7 +41989,7 @@

      Static Semantics: CharacterValue

      CharacterEscape :: LegacyOctalEscapeSequence - 1. Return the MV of |LegacyOctalEscapeSequence| (see ). + 1. Return the MV of |LegacyOctalEscapeSequence| (see ).
      @@ -42955,7 +42972,7 @@

      The Strict Mode of ECMAScript

      A conforming implementation, when processing strict mode code, must disallow instances of the productions NumericLiteral :: LegacyOctalIntegerLiteral and DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral.
    • - A conforming implementation, when processing strict mode code, may not extend the syntax of |EscapeSequence| to include or as described in . + A conforming implementation, when processing strict mode code, must disallow instances of the production EscapeSequence :: LegacyOctalEscapeSequence that do not cover a |StrictZeroEscapeSequence|, and instances of the production EscapeSequence :: NonOctalDecimalEscapeSequence.
    • Assignment to an undeclared identifier or otherwise unresolvable reference does not create a property in the global object. When a simple assignment occurs within strict mode code, its |LeftHandSideExpression| must not evaluate to an unresolvable Reference. If it does a *ReferenceError* exception is thrown (). The |LeftHandSideExpression| also may not be a reference to a data property with the attribute value { [[Writable]]: *false* }, to an accessor property with the attribute value { [[Set]]: *undefined* }, nor to a non-existent property of an object whose [[Extensible]] internal slot has the value *false*. In these cases a `TypeError` exception is thrown ().