Skip to content

Commit

Permalink
Normative: Make B.1.1 "Numeric Literals" normative.
Browse files Browse the repository at this point in the history
(Part of Annex B reform, see PR #1595.)
  • Loading branch information
jmdyck committed Feb 24, 2020
1 parent 2431eb3 commit b04196f
Showing 1 changed file with 71 additions and 73 deletions.
144 changes: 71 additions & 73 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -11171,6 +11171,7 @@ <h2>Syntax</h2>
BinaryIntegerLiteral
OctalIntegerLiteral
HexIntegerLiteral
LegacyOctalIntegerLiteral

BigIntLiteralSuffix ::
`n`
Expand All @@ -11183,6 +11184,7 @@ <h2>Syntax</h2>
DecimalIntegerLiteral ::
`0`
NonZeroDigit DecimalDigits?
NonOctalDecimalIntegerLiteral

DecimalDigits ::
DecimalDigit
Expand Down Expand Up @@ -11216,6 +11218,19 @@ <h2>Syntax</h2>
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
Expand All @@ -11227,6 +11242,9 @@ <h2>Syntax</h2>
OctalDigit :: one of
`0` `1` `2` `3` `4` `5` `6` `7`

NonOctalDigit :: one of
`8` `9`

HexIntegerLiteral ::
`0x` HexDigits
`0X` HexDigits
Expand All @@ -11242,9 +11260,21 @@ <h2>Syntax</h2>
<emu-note>
<p>For example: `3in` is an error and not the two input elements `3` and `in`.</p>
</emu-note>
<p>A conforming implementation, when processing strict mode code, must not extend, as described in <emu-xref href="#sec-additional-syntax-numeric-literals"></emu-xref>, the syntax of |NumericLiteral| to include <emu-xref href="#prod-annexB-LegacyOctalIntegerLiteral"></emu-xref>, nor extend the syntax of |DecimalIntegerLiteral| to include <emu-xref href="#prod-annexB-NonOctalDecimalIntegerLiteral"></emu-xref>.</p>

<emu-clause id="sec-static-semantics-mv">
<emu-clause id="sec-numeric-literals-early-errors">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>
NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral

DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral
</emu-grammar>
<ul>
<li>It is a Syntax Error if the source code matching this production is strict mode code.</li>
</ul>
<emu-note>In non-strict code, this syntax is allowed, but deprecated.</emu-note>
</emu-clause>

<emu-clause id="sec-static-semantics-mv" oldids="sec-additional-syntax-numeric-literals-status-semantics">
<h1>Static Semantics: MV</h1>
<p>A numeric literal stands for a value of the Number type or the BigInt type.</p>
<ul>
Expand All @@ -11260,6 +11290,9 @@ <h1>Static Semantics: MV</h1>
<li>
The MV of <emu-grammar>NonDecimalIntegerLiteral :: HexIntegerLiteral</emu-grammar> is the MV of |HexIntegerLiteral|.
</li>
<li>
The MV of <emu-grammar>NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral</emu-grammar> is the MV of |LegacyOctalIntegerLiteral|.
</li>
<li>
The MV of <emu-grammar>DecimalLiteral :: DecimalIntegerLiteral `.`</emu-grammar> is the MV of |DecimalIntegerLiteral|.
</li>
Expand Down Expand Up @@ -11293,6 +11326,9 @@ <h1>Static Semantics: MV</h1>
<li>
The MV of <emu-grammar>DecimalIntegerLiteral :: NonZeroDigit DecimalDigits</emu-grammar> is (the MV of |NonZeroDigit| &times; 10<sub>ℝ</sub><sup>_n_</sup>) plus the MV of |DecimalDigits|, where _n_ is the mathematical integer number of code points in |DecimalDigits|.
</li>
<li>
The MV of <emu-grammar>DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral</emu-grammar> is the MV of |NonOctalDecimalIntegerLiteral|.
</li>
<li>
The MV of <emu-grammar>DecimalDigits :: DecimalDigit</emu-grammar> is the MV of |DecimalDigit|.
</li>
Expand Down Expand Up @@ -11336,10 +11372,10 @@ <h1>Static Semantics: MV</h1>
The MV of <emu-grammar>DecimalDigit :: `7`</emu-grammar> or of <emu-grammar>NonZeroDigit :: `7`</emu-grammar> or of <emu-grammar>HexDigit :: `7`</emu-grammar> or of <emu-grammar>OctalDigit :: `7`</emu-grammar> is 7<sub>ℝ</sub>.
</li>
<li>
The MV of <emu-grammar>DecimalDigit :: `8`</emu-grammar> or of <emu-grammar>NonZeroDigit :: `8`</emu-grammar> or of <emu-grammar>HexDigit :: `8`</emu-grammar> is 8<sub>ℝ</sub>.
The MV of <emu-grammar>DecimalDigit :: `8`</emu-grammar> or of <emu-grammar>NonZeroDigit :: `8`</emu-grammar> or of <emu-grammar>NonOctalDigit :: `8`</emu-grammar> or of <emu-grammar>HexDigit :: `8`</emu-grammar> is 8<sub>ℝ</sub>.
</li>
<li>
The MV of <emu-grammar>DecimalDigit :: `9`</emu-grammar> or of <emu-grammar>NonZeroDigit :: `9`</emu-grammar> or of <emu-grammar>HexDigit :: `9`</emu-grammar> is 9<sub>ℝ</sub>.
The MV of <emu-grammar>DecimalDigit :: `9`</emu-grammar> or of <emu-grammar>NonZeroDigit :: `9`</emu-grammar> or of <emu-grammar>NonOctalDigit :: `9`</emu-grammar> or of <emu-grammar>HexDigit :: `9`</emu-grammar> is 9<sub>ℝ</sub>.
</li>
<li>
The MV of <emu-grammar>HexDigit :: `a`</emu-grammar> or of <emu-grammar>HexDigit :: `A`</emu-grammar> is 10<sub>ℝ</sub>.
Expand Down Expand Up @@ -11371,6 +11407,27 @@ <h1>Static Semantics: MV</h1>
<li>
The MV of <emu-grammar>BinaryDigits :: BinaryDigits BinaryDigit</emu-grammar> is (the MV of |BinaryDigits| &times; 2<sub>ℝ</sub>) plus the MV of |BinaryDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: `0` NonOctalDigit</emu-grammar> is the MV of |NonOctalDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit</emu-grammar> is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10<sub>ℝ</sub>) plus the MV of |NonOctalDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral DecimalDigit</emu-grammar> is (the MV of |NonOctalDecimalIntegerLiteral| times 10<sub>ℝ</sub>) plus the MV of |DecimalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalLikeDecimalIntegerLiteral :: `0` OctalDigit</emu-grammar> is the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalLikeDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral OctalDigit</emu-grammar> is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10<sub>ℝ</sub>) plus the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalIntegerLiteral :: `0` OctalDigit</emu-grammar> is the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalIntegerLiteral :: LegacyOctalIntegerLiteral OctalDigit</emu-grammar> is (the MV of |LegacyOctalIntegerLiteral| times 8<sub>ℝ</sub>) plus the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>OctalIntegerLiteral :: `0o` OctalDigits</emu-grammar> is the MV of |OctalDigits|.
</li>
Expand Down Expand Up @@ -24902,9 +24959,6 @@ <h1>Forbidden Extensions</h1>
<li>
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.
</li>
<li>
When processing strict mode code, the syntax of |NumericLiteral| must not be extended to include <emu-xref href="#prod-annexB-LegacyOctalIntegerLiteral"></emu-xref> and the syntax of |DecimalIntegerLiteral| must not be extended to include <emu-xref href="#prod-annexB-NonOctalDecimalIntegerLiteral"></emu-xref> as described in <emu-xref href="#sec-additional-syntax-numeric-literals"></emu-xref>.
</li>
<li>
|TemplateCharacter| must not be extended to include <emu-xref href="#prod-annexB-LegacyOctalEscapeSequence"></emu-xref> as defined in <emu-xref href="#sec-additional-syntax-string-literals"></emu-xref>.
</li>
Expand Down Expand Up @@ -41638,9 +41692,13 @@ <h1>Lexical Grammar</h1>
<emu-prodref name="BinaryIntegerLiteral"></emu-prodref>
<emu-prodref name="BinaryDigits"></emu-prodref>
<emu-prodref name="BinaryDigit"></emu-prodref>
<emu-prodref name="NonOctalDecimalIntegerLiteral"></emu-prodref>
<emu-prodref name="LegacyOctalLikeDecimalIntegerLiteral"></emu-prodref>
<emu-prodref name="LegacyOctalIntegerLiteral"></emu-prodref>
<emu-prodref name="OctalIntegerLiteral"></emu-prodref>
<emu-prodref name="OctalDigits"></emu-prodref>
<emu-prodref name="OctalDigit"></emu-prodref>
<emu-prodref name="NonOctalDigit"></emu-prodref>
<emu-prodref name="HexIntegerLiteral"></emu-prodref>
<emu-prodref name="HexDigits"></emu-prodref>
<emu-prodref name="HexDigit"></emu-prodref>
Expand Down Expand Up @@ -41982,73 +42040,13 @@ <h1>Additional Syntax</h1>

<emu-annex id="sec-additional-syntax-numeric-literals">
<h1>Numeric Literals</h1>
<p>The syntax and semantics of <emu-xref href="#sec-literals-numeric-literals"></emu-xref> is extended as follows except that this extension is not allowed for strict mode code:</p>
<h2>Syntax</h2>
<emu-grammar type="definition">
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
<p>The following syntax from <emu-xref href="#sec-literals-numeric-literals"></emu-xref>, and its associated semantics, used to be normative optional:</p>
<emu-grammar>
NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral

NonOctalDigit :: one of
`8` `9`
DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral
</emu-grammar>

<emu-annex id="sec-additional-syntax-numeric-literals-status-semantics">
<h1>Static Semantics</h1>
<ul>
<li>
The MV of <emu-grammar>LegacyOctalIntegerLiteral :: `0` OctalDigit</emu-grammar> is the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalIntegerLiteral :: LegacyOctalIntegerLiteral OctalDigit</emu-grammar> is (the MV of |LegacyOctalIntegerLiteral| times 8) plus the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral</emu-grammar> is the MV of |NonOctalDecimalIntegerLiteral|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: `0` NonOctalDigit</emu-grammar> is the MV of |NonOctalDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit</emu-grammar> is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |NonOctalDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral DecimalDigit</emu-grammar> is (the MV of |NonOctalDecimalIntegerLiteral| times 10) plus the MV of |DecimalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalLikeDecimalIntegerLiteral :: `0` OctalDigit</emu-grammar> is the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>LegacyOctalLikeDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral OctalDigit</emu-grammar> is (the MV of |LegacyOctalLikeDecimalIntegerLiteral| times 10) plus the MV of |OctalDigit|.
</li>
<li>
The MV of <emu-grammar>NonOctalDigit :: `8`</emu-grammar> is 8.
</li>
<li>
The MV of <emu-grammar>NonOctalDigit :: `9`</emu-grammar> is 9.
</li>
</ul>
</emu-annex>
<p>and the productions for |LegacyOctalIntegerLiteral|, |NonOctalDecimalIntegerLiteral|, |LegacyOctalLikeDecimalIntegerLiteral|, and |NonOctalDigit|.</p>
</emu-annex>

<emu-annex id="sec-additional-syntax-string-literals">
Expand Down Expand Up @@ -43292,7 +43290,7 @@ <h1>The Strict Mode of ECMAScript</h1>
`implements`, `interface`, `let`, `package`, `private`, `protected`, `public`, `static`, and `yield` are reserved words within strict mode code. (<emu-xref href="#sec-keywords-and-reserved-words"></emu-xref>).
</li>
<li>
A conforming implementation, when processing strict mode code, must not extend, as described in <emu-xref href="#sec-additional-syntax-numeric-literals"></emu-xref>, 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 <emu-grammar>NonDecimalIntegerLiteral :: LegacyOctalIntegerLiteral</emu-grammar> and <emu-grammar>DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral</emu-grammar>.
</li>
<li>
A conforming implementation, when processing strict mode code, may not extend the syntax of |EscapeSequence| to include |LegacyOctalEscapeSequence| as described in <emu-xref href="#sec-additional-syntax-string-literals"></emu-xref>.
Expand Down

0 comments on commit b04196f

Please sign in to comment.