From 1d1cc707a12d9025c0b06af6d10c4864a4b2d312 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 | 144 +++++++++++++++++++++++++++--------------------------- 1 file changed, 71 insertions(+), 73 deletions(-) diff --git a/spec.html b/spec.html index 8056317b1e..6894980d96 100644 --- a/spec.html +++ b/spec.html @@ -11073,6 +11073,7 @@

Syntax

BinaryIntegerLiteral OctalIntegerLiteral HexIntegerLiteral + LegacyOctalIntegerLiteral BigIntLiteralSuffix :: `n` @@ -11085,6 +11086,7 @@

Syntax

DecimalIntegerLiteral :: `0` NonZeroDigit DecimalDigits? + NonOctalDecimalIntegerLiteral DecimalDigits :: DecimalDigit @@ -11118,6 +11120,19 @@

Syntax

BinaryDigit :: one of `0` `1` + NonOctalDecimalIntegerLiteral :: + `0` NonOctalDigit + LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit + NonOctalDecimalIntegerLiteral DecimalDigit + + LegacyOctalLikeDecimalIntegerLiteral :: + `0` OctalDigit + LegacyOctalLikeDecimalIntegerLiteral OctalDigit + + LegacyOctalIntegerLiteral :: + `0` OctalDigit + LegacyOctalIntegerLiteral OctalDigit + OctalIntegerLiteral :: `0o` OctalDigits `0O` OctalDigits @@ -11129,6 +11144,9 @@

Syntax

OctalDigit :: one of `0` `1` `2` `3` `4` `5` `6` `7` + NonOctalDigit :: one of + `8` `9` + HexIntegerLiteral :: `0x` HexDigits `0X` HexDigits @@ -11144,9 +11162,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

+ + NonDecimalIntegerLiteral :: 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.

    @@ -11162,6 +11192,9 @@

    Static Semantics: MV

  • The MV of NonDecimalIntegerLiteral :: HexIntegerLiteral is the MV of |HexIntegerLiteral|.
  • +
  • + The MV of NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral is the MV of |LegacyOctalIntegerLiteral|. +
  • The MV of DecimalLiteral :: DecimalIntegerLiteral `.` is the MV of |DecimalIntegerLiteral|.
  • @@ -11195,6 +11228,9 @@

    Static Semantics: MV

  • The MV of DecimalIntegerLiteral :: NonZeroDigit DecimalDigits is (the MV of |NonZeroDigit| × 10_n_) plus the MV of |DecimalDigits|, where _n_ is the mathematical integer number of code points in |DecimalDigits|.
  • +
  • + The MV of DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral is the MV of |NonOctalDecimalIntegerLiteral|. +
  • The MV of DecimalDigits :: DecimalDigit is the MV of |DecimalDigit|.
  • @@ -11238,10 +11274,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. @@ -11273,6 +11309,27 @@

    Static Semantics: MV

  • The MV of BinaryDigits :: BinaryDigits BinaryDigit is (the MV of |BinaryDigits| × 2) plus the MV of |BinaryDigit|.
  • +
  • + 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 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 OctalIntegerLiteral :: `0o` OctalDigits is the MV of |OctalDigits|.
  • @@ -24747,9 +24804,6 @@

    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 . -
  • |TemplateCharacter| must not be extended to include as defined in .
  • @@ -41554,9 +41608,13 @@

    Lexical Grammar

    + + + + @@ -41893,73 +41951,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 - NonDecimalIntegerLiteral BigIntLiteralSuffix - LegacyOctalIntegerLiteral - - LegacyOctalIntegerLiteral :: - `0` OctalDigit - LegacyOctalIntegerLiteral OctalDigit - - DecimalIntegerLiteral :: - `0` - NonZeroDigit DecimalDigits? - 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:

    + + NonDecimalIntegerLiteral :: 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|.

    @@ -43196,7 +43194,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 |LegacyOctalIntegerLiteral|, nor extend the syntax of |DecimalIntegerLiteral| to include |NonOctalDecimalIntegerLiteral|. + A conforming implementation, when processing strict mode code, must disallow instances of the productions NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral and DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral.
  • A conforming implementation, when processing strict mode code, may not extend the syntax of |EscapeSequence| to include |LegacyOctalEscapeSequence| as described in .