From 87c3f7e44ca77c8f00aaeb41c2fd36d76bf601f2 Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 31 Jul 2019 08:33:51 -0400 Subject: [PATCH] Normative: Make B.1.1 "Numeric Literals" normative. (Part of Annex B reform, see PR #1595.) --- spec.html | 142 +++++++++++++++++++++++++++--------------------------- 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/spec.html b/spec.html index 298964b4cd3..2d0ad9e65f6 100644 --- a/spec.html +++ b/spec.html @@ -13940,6 +13940,7 @@

Syntax

DecimalBigIntegerLiteral NonDecimalIntegerLiteral[+Sep] NonDecimalIntegerLiteral[+Sep] BigIntLiteralSuffix + LegacyOctalIntegerLiteral DecimalBigIntegerLiteral :: `0` BigIntLiteralSuffix @@ -13963,6 +13964,7 @@

Syntax

`0` NonZeroDigit NonZeroDigit NumericLiteralSeparator? DecimalDigits[+Sep] + NonOctalDecimalIntegerLiteral DecimalDigits[Sep] :: DecimalDigit @@ -14007,9 +14009,25 @@

Syntax

OctalDigits[?Sep] OctalDigit [+Sep] OctalDigits[+Sep] NumericLiteralSeparator OctalDigit + LegacyOctalIntegerLiteral :: + `0` OctalDigit + LegacyOctalIntegerLiteral OctalDigit + + NonOctalDecimalIntegerLiteral :: + `0` NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + `0` OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + OctalDigit :: one of `0` `1` `2` `3` `4` `5` `6` `7` + NonOctalDigit :: one of + `8` `9` + HexIntegerLiteral[Sep] :: `0x` HexDigits[?Sep] `0X` HexDigits[?Sep] @@ -14026,9 +14044,21 @@

Syntax

For example: `3in` is an error and not the two input elements `3` and `in`.

-

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

- + +

Static Semantics: Early Errors

+ + NumericLiteral :: LegacyOctalIntegerLiteral + + DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral + +
    +
  • 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. +
+ +

Static Semantics: MV

A numeric literal stands for a value of the Number type or the BigInt type.

    @@ -14123,10 +14153,10 @@

    Static Semantics: MV

    The MV of DecimalDigit :: `7` or of NonZeroDigit :: `7` or of HexDigit :: `7` or of OctalDigit :: `7` is 7.
  • - The MV of DecimalDigit :: `8` or of NonZeroDigit :: `8` or of HexDigit :: `8` is 8. + The MV of DecimalDigit :: `8` or of NonZeroDigit :: `8` or of NonOctalDigit :: `8` or of HexDigit :: `8` is 8.
  • - The MV of DecimalDigit :: `9` or of NonZeroDigit :: `9` or of HexDigit :: `9` is 9. + The MV of DecimalDigit :: `9` or of NonZeroDigit :: `9` or of NonOctalDigit :: `9` or of HexDigit :: `9` is 9.
  • The MV of HexDigit :: `a` or of HexDigit :: `A` is 10. @@ -14176,6 +14206,27 @@

    Static Semantics: MV

  • The MV of OctalDigits :: OctalDigits NumericLiteralSeparator OctalDigit is (the MV of |OctalDigits| × 8) plus the MV of |OctalDigit|.
  • +
  • + The MV of LegacyOctalIntegerLiteral :: `0` OctalDigit is the MV of |OctalDigit|. +
  • +
  • + The MV of LegacyOctalIntegerLiteral :: LegacyOctalIntegerLiteral OctalDigit is (the MV of |LegacyOctalIntegerLiteral| times 8) plus the MV of |OctalDigit|. +
  • +
  • + The MV of NonOctalDecimalIntegerLiteral :: `0` NonOctalDigit is the MV of |NonOctalDigit|. +
  • +
  • + The MV of NonOctalDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |NonOctalDigit|. +
  • +
  • + The MV of NonOctalDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral DecimalDigit is (the MV of |NonOctalDecimalIntegerLiteral| times 10) plus the MV of |DecimalDigit|. +
  • +
  • + The MV of LegacyOctalLikeDecimalIntegerLiteral :: `0` OctalDigit is the MV of |OctalDigit|. +
  • +
  • + The MV of LegacyOctalLikeDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral OctalDigit is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |OctalDigit|. +
  • The MV of HexIntegerLiteral :: `0x` HexDigits is the MV of |HexDigits|.
  • @@ -14204,6 +14255,10 @@

    Static Semantics: NumericValue

    1. Return 𝔽(MV of |NonDecimalIntegerLiteral|). + NumericLiteral :: LegacyOctalIntegerLiteral + + 1. Return 𝔽(MV of |LegacyOctalIntegerLiteral|). + NumericLiteral :: NonDecimalIntegerLiteral BigIntLiteralSuffix 1. Return the BigInt value that represents the MV of |NonDecimalIntegerLiteral|. @@ -24398,7 +24453,7 @@

    Forbidden Extensions

    The Syntactic Grammar must not be extended in any manner that allows the token `:` to immediately follow source text that matches the |BindingIdentifier| nonterminal symbol.
  • - When processing strict mode code, the syntax of |NumericLiteral| must not be extended to include and the syntax of |DecimalIntegerLiteral| must not be extended to include as described in . + When processing strict mode code, the syntax of |NumericLiteral| must not be extended to include |LegacyOctalIntegerLiteral| and the syntax of |DecimalIntegerLiteral| must not be extended to include |NonOctalDecimalIntegerLiteral| as described in .
  • |TemplateCharacter| must not be extended to include or as defined in . @@ -41255,7 +41310,11 @@

    Lexical Grammar

    + + + + @@ -41618,74 +41677,13 @@

    Additional Syntax

    Numeric Literals

    -

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

    -

    Syntax

    - - NumericLiteral :: - DecimalLiteral - DecimalBigIntegerLiteral - NonDecimalIntegerLiteral[+Sep] - NonDecimalIntegerLiteral[+Sep] BigIntLiteralSuffix - LegacyOctalIntegerLiteral - - LegacyOctalIntegerLiteral :: - `0` OctalDigit - LegacyOctalIntegerLiteral OctalDigit - - DecimalIntegerLiteral :: - `0` - NonZeroDigit - NonZeroDigit NumericLiteralSeparator? DecimalDigits[+Sep] - NonOctalDecimalIntegerLiteral - - NonOctalDecimalIntegerLiteral :: - `0` NonOctalDigit - LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit - NonOctalDecimalIntegerLiteral DecimalDigit - - LegacyOctalLikeDecimalIntegerLiteral :: - `0` OctalDigit - LegacyOctalLikeDecimalIntegerLiteral OctalDigit +

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

    + + NumericLiteral :: LegacyOctalIntegerLiteral - NonOctalDigit :: one of - `8` `9` + DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral - - -

    Static Semantics

    -
      -
    • - The MV of LegacyOctalIntegerLiteral :: `0` OctalDigit is the MV of |OctalDigit|. -
    • -
    • - The MV of LegacyOctalIntegerLiteral :: LegacyOctalIntegerLiteral OctalDigit is (the MV of |LegacyOctalIntegerLiteral| times 8) plus the MV of |OctalDigit|. -
    • -
    • - The MV of DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral is the MV of |NonOctalDecimalIntegerLiteral|. -
    • -
    • - The MV of NonOctalDecimalIntegerLiteral :: `0` NonOctalDigit is the MV of |NonOctalDigit|. -
    • -
    • - The MV of NonOctalDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |NonOctalDigit|. -
    • -
    • - The MV of NonOctalDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral DecimalDigit is (the MV of |NonOctalDecimalIntegerLiteral| times 10) plus the MV of |DecimalDigit|. -
    • -
    • - The MV of LegacyOctalLikeDecimalIntegerLiteral :: `0` OctalDigit is the MV of |OctalDigit|. -
    • -
    • - The MV of LegacyOctalLikeDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral OctalDigit is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |OctalDigit|. -
    • -
    • - The MV of NonOctalDigit :: `8` is 8. -
    • -
    • - The MV of NonOctalDigit :: `9` is 9. -
    • -
    -
    +

    and the productions for |LegacyOctalIntegerLiteral|, |NonOctalDecimalIntegerLiteral|, |LegacyOctalLikeDecimalIntegerLiteral|, and |NonOctalDigit|.

    @@ -42956,7 +42954,7 @@

    The Strict Mode of ECMAScript

    `implements`, `interface`, `let`, `package`, `private`, `protected`, `public`, `static`, and `yield` are reserved words within strict mode code. ().
  • - A conforming implementation, when processing strict mode code, must not extend, as described in , the syntax of |NumericLiteral| to include , nor extend the syntax of |DecimalIntegerLiteral| to include . + 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 .