diff --git a/spec.html b/spec.html index 657112348d..0b6899937d 100644 --- a/spec.html +++ b/spec.html @@ -16440,7 +16440,7 @@

Static Semantics: MV

The MV of SignedInteger :: `-` DecimalDigits is the negative of the MV of |DecimalDigits|.
  • - The MV of DecimalDigit :: `0` or of HexDigit :: `0` or of OctalDigit :: `0` or of BinaryDigit :: `0` is 0. + The MV of DecimalDigit :: `0` or of HexDigit :: `0` or of OctalDigit :: `0` or of LegacyOctalEscapeSequence :: `0` or of BinaryDigit :: `0` is 0.
  • The MV of DecimalDigit :: `1` or of NonZeroDigit :: `1` or of HexDigit :: `1` or of OctalDigit :: `1` or of BinaryDigit :: `1` is 1. @@ -16595,7 +16595,7 @@

    Static Semantics: NumericValue

    - +

    String Literals

    A string literal is 0 or more Unicode code points enclosed in single or double quotes. Unicode code points may also be represented by an escape sequence. All code points may appear literally in a string literal except for the closing quote code points, U+005C (REVERSE SOLIDUS), U+000D (CARRIAGE RETURN), and U+000A (LINE FEED). Any code points may appear in the form of an escape sequence. String literals evaluate to ECMAScript String values. When generating these String values Unicode code points are UTF-16 encoded as defined in . Code points belonging to the Basic Multilingual Plane are encoded as a single code unit element of the string. All other code points are encoded as two code unit elements of the string.

    @@ -16632,11 +16632,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 @@ -16653,6 +16653,25 @@

    Syntax

    `x` `u` + LegacyOctalEscapeSequence :: + `0` [lookahead ∈ {`8`, `9`}] + NonZeroOctalDigit [lookahead ∉ OctalDigit] + ZeroToThree OctalDigit [lookahead ∉ OctalDigit] + FourToSeven OctalDigit + ZeroToThree OctalDigit OctalDigit + + NonZeroOctalDigit :: + OctalDigit but not `0` + + ZeroToThree :: one of + `0` `1` `2` `3` + + FourToSeven :: one of + `4` `5` `6` `7` + + NonOctalDecimalEscapeSequence :: one of + `8` `9` + HexEscapeSequence :: `x` HexDigit HexDigit @@ -16668,7 +16687,26 @@

    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`.

    - + +

    Static Semantics: Early Errors

    + + EscapeSequence :: LegacyOctalEscapeSequence + + 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 Legacy. + +

    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. SV produces String values for string literals through recursive application on 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, as described below or in .

      @@ -16865,6 +16903,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|.
    • @@ -16883,6 +16930,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|.
      • @@ -27100,7 +27180,7 @@

        Forbidden Extensions

        When processing strict mode code, an implementation must not relax the early error rules of .
      • - |TemplateEscapeSequence| must not be extended to include or as defined in . + |TemplateEscapeSequence| 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. @@ -45054,6 +45134,11 @@

        Lexical Grammar

        + + + + + @@ -45401,90 +45486,6 @@

        Additional ECMAScript Features for Web Browsers

        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` - - NonOctalDecimalEscapeSequence :: one of - `8` `9` - -

        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. -
        • -
        -
        -
        -

        HTML-like Comments

        The syntax and semantics of is extended as follows except that this extension is not allowed when parsing source code using the goal symbol |Module|:

        @@ -45689,7 +45690,7 @@

        Static Semantics: CharacterValue

        CharacterEscape :: LegacyOctalEscapeSequence - 1. Return the MV of |LegacyOctalEscapeSequence| (see ). + 1. Return the MV of |LegacyOctalEscapeSequence| (see ).
        @@ -46548,7 +46549,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 productions EscapeSequence :: LegacyOctalEscapeSequence and 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 ().