From 6504e6648ee1108ae3d19d48c3fcb7e42d23edbd Mon Sep 17 00:00:00 2001
From: Michael Dyck
Date: Wed, 10 Feb 2016 16:59:23 -0500
Subject: [PATCH] Editorial: Tweak the syntax of grammatical parameters.
(Make things more explicit, and establish a clearer parallel
between rhs-guard syntax and rhs-nonterminal use syntax.)
See https://bugs.ecmascript.org/show_bug.cgi?id=2794
and https://github.com/tc39/ecma262/issues/374
---
spec.html | 246 ++++++++++++++++++++++++++++--------------------------
1 file changed, 129 insertions(+), 117 deletions(-)
diff --git a/spec.html b/spec.html
index 8cb09c73538..8253a38ba4e 100644
--- a/spec.html
+++ b/spec.html
@@ -536,7 +536,7 @@ Grammar Notation
StatementList :
ReturnStatement
- ExpressionStatement[In]
+ ExpressionStatement[+In]
is equivalent to saying:
@@ -544,10 +544,22 @@ Grammar Notation
ReturnStatement
ExpressionStatement_In
+ and
+
+ StatementList :
+ ReturnStatement
+ ExpressionStatement[~In]
+
+ is equivalent to:
+
+ StatementList :
+ ReturnStatement
+ ExpressionStatement
+
A nonterminal reference may have both a parameter list and an “opt” suffix. For example:
VariableDeclaration :
- BindingIdentifier Initializer[In]?
+ BindingIdentifier Initializer[+In]?
is an abbreviation for:
@@ -10353,17 +10365,17 @@ Rules of Automatic Semicolon Insertion
ReturnStatement[Yield] :
`return` `;`
- `return` [no LineTerminator here] Expression[In, ?Yield] `;`
+ `return` [no LineTerminator here] Expression[+In, ?Yield] `;`
ThrowStatement[Yield] :
- `throw` [no LineTerminator here] Expression[In, ?Yield] `;`
+ `throw` [no LineTerminator here] Expression[+In, ?Yield] `;`
ArrowFunction[In, Yield] :
ArrowParameters[?Yield] [no LineTerminator here] `=>` ConciseBody[?In]
YieldExpression[In] :
- `yield` [no LineTerminator here] `*` AssignmentExpression[?In, Yield]
- `yield` [no LineTerminator here] AssignmentExpression[?In, Yield]
+ `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield]
+ `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield]
The practical effect of these restricted productions is as follows:
@@ -10649,12 +10661,12 @@ Syntax
CoverParenthesizedExpressionAndArrowParameterList[?Yield] #parencover
CoverParenthesizedExpressionAndArrowParameterList[Yield] :
- `(` Expression[In, ?Yield] `)`
+ `(` Expression[+In, ?Yield] `)`
`(` `)`
`(` `...` BindingIdentifier[?Yield] `)`
`(` `...` BindingPattern[?Yield] `)`
- `(` Expression[In, ?Yield] `,` `...` BindingIdentifier[?Yield] `)`
- `(` Expression[In, ?Yield] `,` `...` BindingPattern[?Yield] `)`
+ `(` Expression[+In, ?Yield] `,` `...` BindingIdentifier[?Yield] `)`
+ `(` Expression[+In, ?Yield] `,` `...` BindingPattern[?Yield] `)`
Supplemental Syntax
When processing the production
@@ -10664,7 +10676,7 @@
Supplemental Syntax
the interpretation of |CoverParenthesizedExpressionAndArrowParameterList| is refined using the following grammar:
ParenthesizedExpression[Yield] :
- `(` Expression[In, ?Yield] `)`
+ `(` Expression[+In, ?Yield] `)`
@@ -10674,9 +10686,9 @@ Semantics
Static Semantics: CoveredParenthesizedExpression
- CoverParenthesizedExpressionAndArrowParameterList[Yield] : `(` Expression[In, ?Yield] `)`
+ CoverParenthesizedExpressionAndArrowParameterList[Yield] : `(` Expression[+In, ?Yield] `)`
- 1. Return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using either |ParenthesizedExpression| or |ParenthesizedExpression[Yield]| as the goal symbol depending upon whether the [Yield] grammar parameter was present when |CoverParenthesizedExpressionAndArrowParameterList| was matched.
+ 1. Return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using either |ParenthesizedExpression[~Yield]| or |ParenthesizedExpression[+Yield]| as the goal symbol depending upon whether the [Yield] grammar parameter was present when |CoverParenthesizedExpressionAndArrowParameterList| was matched.
@@ -10839,9 +10851,9 @@ Syntax
`[` ElementList[?Yield] `,` Elision? `]`
ElementList[Yield] :
- Elision? AssignmentExpression[In, ?Yield]
+ Elision? AssignmentExpression[+In, ?Yield]
Elision? SpreadElement[?Yield]
- ElementList[?Yield] `,` Elision? AssignmentExpression[In, ?Yield]
+ ElementList[?Yield] `,` Elision? AssignmentExpression[+In, ?Yield]
ElementList[?Yield] `,` Elision? SpreadElement[?Yield]
Elision :
@@ -10849,7 +10861,7 @@ Syntax
Elision `,`
SpreadElement[Yield] :
- `...` AssignmentExpression[In, ?Yield]
+ `...` AssignmentExpression[+In, ?Yield]
@@ -10973,7 +10985,7 @@ Syntax
PropertyDefinition[Yield] :
IdentifierReference[?Yield]
CoverInitializedName[?Yield]
- PropertyName[?Yield] `:` AssignmentExpression[In, ?Yield]
+ PropertyName[?Yield] `:` AssignmentExpression[+In, ?Yield]
MethodDefinition[?Yield]
PropertyName[Yield] :
@@ -10986,10 +10998,10 @@ Syntax
NumericLiteral
ComputedPropertyName[Yield] :
- `[` AssignmentExpression[In, ?Yield] `]`
+ `[` AssignmentExpression[+In, ?Yield] `]`
CoverInitializedName[Yield] :
- IdentifierReference[?Yield] Initializer[In, ?Yield]
+ IdentifierReference[?Yield] Initializer[+In, ?Yield]
Initializer[In, Yield] :
`=` AssignmentExpression[?In, ?Yield]
@@ -11261,15 +11273,15 @@ Syntax
TemplateLiteral[Yield] :
NoSubstitutionTemplate
- TemplateHead Expression[In, ?Yield] TemplateSpans[?Yield]
+ TemplateHead Expression[+In, ?Yield] TemplateSpans[?Yield]
TemplateSpans[Yield] :
TemplateTail
TemplateMiddleList[?Yield] TemplateTail
TemplateMiddleList[Yield] :
- TemplateMiddle Expression[In, ?Yield]
- TemplateMiddleList[?Yield] TemplateMiddle Expression[In, ?Yield]
+ TemplateMiddle Expression[+In, ?Yield]
+ TemplateMiddleList[?Yield] TemplateMiddle Expression[+In, ?Yield]
@@ -11544,7 +11556,7 @@ Syntax
MemberExpression[Yield] :
PrimaryExpression[?Yield]
- MemberExpression[?Yield] `[` Expression[In, ?Yield] `]`
+ MemberExpression[?Yield] `[` Expression[+In, ?Yield] `]`
MemberExpression[?Yield] `.` IdentifierName
MemberExpression[?Yield] TemplateLiteral[?Yield]
SuperProperty[?Yield]
@@ -11552,7 +11564,7 @@ Syntax
`new` MemberExpression[?Yield] Arguments[?Yield]
SuperProperty[Yield] :
- `super` `[` Expression[In, ?Yield] `]`
+ `super` `[` Expression[+In, ?Yield] `]`
`super` `.` IdentifierName
MetaProperty :
@@ -11569,7 +11581,7 @@ Syntax
MemberExpression[?Yield] Arguments[?Yield]
SuperCall[?Yield]
CallExpression[?Yield] Arguments[?Yield]
- CallExpression[?Yield] `[` Expression[In, ?Yield] `]`
+ CallExpression[?Yield] `[` Expression[+In, ?Yield] `]`
CallExpression[?Yield] `.` IdentifierName
CallExpression[?Yield] TemplateLiteral[?Yield]
@@ -11581,10 +11593,10 @@ Syntax
`(` ArgumentList[?Yield] `)`
ArgumentList[Yield] :
- AssignmentExpression[In, ?Yield]
- `...` AssignmentExpression[In, ?Yield]
- ArgumentList[?Yield] `,` AssignmentExpression[In, ?Yield]
- ArgumentList[?Yield] `,` `...` AssignmentExpression[In, ?Yield]
+ AssignmentExpression[+In, ?Yield]
+ `...` AssignmentExpression[+In, ?Yield]
+ ArgumentList[?Yield] `,` AssignmentExpression[+In, ?Yield]
+ ArgumentList[?Yield] `,` `...` AssignmentExpression[+In, ?Yield]
LeftHandSideExpression[Yield] :
NewExpression[?Yield]
@@ -13037,7 +13049,7 @@ Syntax
RelationalExpression[?In, ?Yield] `<=` ShiftExpression[?Yield]
RelationalExpression[?In, ?Yield] `>=` ShiftExpression[?Yield]
RelationalExpression[?In, ?Yield] `instanceof` ShiftExpression[?Yield]
- [+In] RelationalExpression[In, ?Yield] `in` ShiftExpression[?Yield]
+ [+In] RelationalExpression[+In, ?Yield] `in` ShiftExpression[?Yield]
The [In] grammar parameter is needed to avoid confusing the `in` operator in a relational expression with the `in` operator in a `for` statement.
@@ -13428,7 +13440,7 @@ Syntax
ConditionalExpression[In, Yield] :
LogicalORExpression[?In, ?Yield]
- LogicalORExpression[?In, ?Yield] `?` AssignmentExpression[In, ?Yield] `:` AssignmentExpression[?In, ?Yield]
+ LogicalORExpression[?In, ?Yield] `?` AssignmentExpression[+In, ?Yield] `:` AssignmentExpression[?In, ?Yield]
The grammar for a |ConditionalExpression| in ECMAScript is slightly different from that in C and Java, which each allow the second subexpression to be an |Expression| but restrict the third expression to be a |ConditionalExpression|. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the centre expression.
@@ -13612,11 +13624,11 @@ Supplemental Syntax
Elision? AssignmentElement[?Yield]
AssignmentProperty[Yield] :
- IdentifierReference[?Yield] Initializer[In, ?Yield]?
+ IdentifierReference[?Yield] Initializer[+In, ?Yield]?
PropertyName[?Yield] `:` AssignmentElement[?Yield]
AssignmentElement[Yield] :
- DestructuringAssignmentTarget[?Yield] Initializer[In, ?Yield]?
+ DestructuringAssignmentTarget[?Yield] Initializer[+In, ?Yield]?
AssignmentRestElement[Yield] :
`...` DestructuringAssignmentTarget[?Yield]
@@ -13802,7 +13814,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
1. Let _v_ be ? GetValue(_defaultValue_).
1. Else, let _v_ be _value_.
1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then
- 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern| or |AssignmentPattern[Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
+ 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
1. Return the result of performing DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with _v_ as the argument.
1. If |Initializer| is present and _value_ is *undefined* and IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then
1. Let _hasNameProperty_ be ? HasOwnProperty(_v_, `"name"`).
@@ -13833,7 +13845,7 @@ Runtime Semantics: IteratorDestructuringAssignmentEvaluation
1. Increment _n_ by 1.
1. If |DestructuringAssignmentTarget| is neither an |ObjectLiteral| nor an |ArrayLiteral|, then
1. Return ? PutValue(_lref_, _A_).
- 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern| or |AssignmentPattern[Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
+ 1. Let _nestedAssignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
1. Return the result of performing DestructuringAssignmentEvaluation of _nestedAssignmentPattern_ with _A_ as the argument.
@@ -13853,7 +13865,7 @@ Runtime Semantics: KeyedDestructuringAssignmentEvaluation
1. Let _rhsValue_ be ? GetValue(_defaultValue_).
1. Else, let _rhsValue_ be _v_.
1. If |DestructuringAssignmentTarget| is an |ObjectLiteral| or an |ArrayLiteral|, then
- 1. Let _assignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern| or |AssignmentPattern[Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
+ 1. Let _assignmentPattern_ be the parse of the source text corresponding to |DestructuringAssignmentTarget| using either |AssignmentPattern[~Yield]| or |AssignmentPattern[+Yield]| as the goal symbol depending upon whether this |AssignmentElement| has the [Yield] parameter.
1. Return the result of performing DestructuringAssignmentEvaluation of _assignmentPattern_ with _rhsValue_ as the argument.
1. If |Initializer| is present and _v_ is *undefined* and IsAnonymousFunctionDefinition(|Initializer|) and IsIdentifierRef of |DestructuringAssignmentTarget| are both *true*, then
1. Let _hasNameProperty_ be ? HasOwnProperty(_rhsValue_, `"name"`).
@@ -13933,9 +13945,9 @@ Syntax
DebuggerStatement
Declaration[Yield] :
- HoistableDeclaration[?Yield]
- ClassDeclaration[?Yield]
- LexicalDeclaration[In, ?Yield]
+ HoistableDeclaration[?Yield, ~Default]
+ ClassDeclaration[?Yield, ~Default]
+ LexicalDeclaration[+In, ?Yield]
HoistableDeclaration[Yield, Default] :
FunctionDeclaration[?Yield, ?Default]
@@ -14629,7 +14641,7 @@ Variable Statement
Syntax
VariableStatement[Yield] :
- `var` VariableDeclarationList[In, ?Yield] `;`
+ `var` VariableDeclarationList[+In, ?Yield] `;`
VariableDeclarationList[In, Yield] :
VariableDeclaration[?In, ?Yield]
@@ -14764,10 +14776,10 @@ Syntax
BindingElement[Yield] :
SingleNameBinding[?Yield]
- BindingPattern[?Yield] Initializer[In, ?Yield]?
+ BindingPattern[?Yield] Initializer[+In, ?Yield]?
SingleNameBinding[Yield] :
- BindingIdentifier[?Yield] Initializer[In, ?Yield]?
+ BindingIdentifier[?Yield] Initializer[+In, ?Yield]?
BindingRestElement[Yield] :
`...` BindingIdentifier[?Yield]
@@ -15198,7 +15210,7 @@ Expression Statement
Syntax
ExpressionStatement[Yield] :
- [lookahead <! {`{`, `function`, `class`, `let [`}] Expression[In, ?Yield] `;`
+ [lookahead <! {`{`, `function`, `class`, `let [`}] Expression[+In, ?Yield] `;`
An |ExpressionStatement| cannot start with a U+007B (LEFT CURLY BRACKET) because that might make it ambiguous with a |Block|. Also, an |ExpressionStatement| cannot start with the `function` or `class` keywords because that would make it ambiguous with a |FunctionDeclaration|, a |GeneratorDeclaration|, or a |ClassDeclaration|. An |ExpressionStatement| cannot start with the two token sequence `let [` because that would make it ambiguous with a `let` |LexicalDeclaration| whose first |LexicalBinding| was an |ArrayBindingPattern|.
@@ -15221,8 +15233,8 @@ The `if` Statement
Syntax
IfStatement[Yield, Return] :
- `if` `(` Expression[In, ?Yield] `)` Statement[?Yield, ?Return] `else` Statement[?Yield, ?Return]
- `if` `(` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
+ `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return] `else` Statement[?Yield, ?Return]
+ `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
Each `else` for which the choice of associated `if` is ambiguous shall be associated with the nearest possible `if` that would otherwise have no corresponding `else`.
@@ -15359,17 +15371,17 @@ Iteration Statements
Syntax
IterationStatement[Yield, Return] :
- `do` Statement[?Yield, ?Return] `while` `(` Expression[In, ?Yield] `)` `;`
- `while` `(` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead <! {`let [`}] Expression[?Yield]? `;` Expression[In, ?Yield]? `;` Expression[In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` `var` VariableDeclarationList[?Yield] `;` Expression[In, ?Yield]? `;` Expression[In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` LexicalDeclaration[?Yield] Expression[In, ?Yield]? `;` Expression[In, ?Yield]? `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead <! {`let [`}] LeftHandSideExpression[?Yield] `in` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` `var` ForBinding[?Yield] `in` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` ForDeclaration[?Yield] `in` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` [lookahead != `let` ] LeftHandSideExpression[?Yield] `of` AssignmentExpression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` `var` ForBinding[?Yield] `of` AssignmentExpression[In, ?Yield] `)` Statement[?Yield, ?Return]
- `for` `(` ForDeclaration[?Yield] `of` AssignmentExpression[In, ?Yield] `)` Statement[?Yield, ?Return]
+ `do` Statement[?Yield, ?Return] `while` `(` Expression[+In, ?Yield] `)` `;`
+ `while` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` [lookahead <! {`let [`}] Expression[~In, ?Yield]? `;` Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
+ `for` `(` `var` VariableDeclarationList[~In, ?Yield] `;` Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
+ `for` `(` LexicalDeclaration[~In, ?Yield] Expression[+In, ?Yield]? `;` Expression[+In, ?Yield]? `)` Statement[?Yield, ?Return]
+ `for` `(` [lookahead <! {`let [`}] LeftHandSideExpression[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` `var` ForBinding[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` ForDeclaration[?Yield] `in` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` [lookahead != `let` ] LeftHandSideExpression[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` `var` ForBinding[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
+ `for` `(` ForDeclaration[?Yield] `of` AssignmentExpression[+In, ?Yield] `)` Statement[?Yield, ?Return]
ForDeclaration[Yield] :
LetOrConst ForBinding[?Yield]
@@ -16278,7 +16290,7 @@ Syntax
ReturnStatement[Yield] :
`return` `;`
- `return` [no LineTerminator here] Expression[In, ?Yield] `;`
+ `return` [no LineTerminator here] Expression[+In, ?Yield] `;`
A `return` statement causes a function to cease execution and return a value to the caller. If |Expression| is omitted, the return value is *undefined*. Otherwise, the return value is the value of |Expression|.
@@ -16306,7 +16318,7 @@ The `with` Statement
Syntax
WithStatement[Yield, Return] :
- `with` `(` Expression[In, ?Yield] `)` Statement[?Yield, ?Return]
+ `with` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return]
The `with` statement adds an object Environment Record for a computed object to the lexical environment of the running execution context. It then executes a statement using this augmented lexical environment. Finally, it restores the original lexical environment.
@@ -16409,7 +16421,7 @@ The `switch` Statement
Syntax
SwitchStatement[Yield, Return] :
- `switch` `(` Expression[In, ?Yield] `)` CaseBlock[?Yield, ?Return]
+ `switch` `(` Expression[+In, ?Yield] `)` CaseBlock[?Yield, ?Return]
CaseBlock[Yield, Return] :
`{` CaseClauses[?Yield, ?Return]? `}`
@@ -16420,7 +16432,7 @@ Syntax
CaseClauses[?Yield, ?Return] CaseClause[?Yield, ?Return]
CaseClause[Yield, Return] :
- `case` Expression[In, ?Yield] `:` StatementList[?Yield, ?Return]?
+ `case` Expression[+In, ?Yield] `:` StatementList[?Yield, ?Return]?
DefaultClause[Yield, Return] :
`default` `:` StatementList[?Yield, ?Return]?
@@ -16829,7 +16841,7 @@ Syntax
LabelledItem[Yield, Return] :
Statement[?Yield, ?Return]
- FunctionDeclaration[?Yield]
+ FunctionDeclaration[?Yield, ~Default]
A |Statement| may be prefixed by a label. Labelled statements are only used in conjunction with labelled `break` and `continue` statements. ECMAScript has no `goto` statement. A |Statement| can be part of a |LabelledStatement|, which itself can be part of a |LabelledStatement|, and so on. The labels introduced this way are collectively referred to as the “current label set” when describing the semantics of individual statements.
@@ -17080,7 +17092,7 @@ The `throw` Statement
Syntax
ThrowStatement[Yield] :
- `throw` [no LineTerminator here] Expression[In, ?Yield] `;`
+ `throw` [no LineTerminator here] Expression[+In, ?Yield] `;`
@@ -17385,11 +17397,11 @@ Function Definitions
Syntax
FunctionDeclaration[Yield, Default] :
- `function` BindingIdentifier[?Yield] `(` FormalParameters `)` `{` FunctionBody `}`
- [+Default] `function` `(` FormalParameters `)` `{` FunctionBody `}`
+ `function` BindingIdentifier[?Yield] `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
+ [+Default] `function` `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
FunctionExpression :
- `function` BindingIdentifier? `(` FormalParameters `)` `{` FunctionBody `}`
+ `function` BindingIdentifier[~Yield]? `(` FormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
StrictFormalParameters[Yield] :
FormalParameters[?Yield]
@@ -17417,7 +17429,7 @@ Syntax
FunctionStatementList[?Yield]
FunctionStatementList[Yield] :
- StatementList[?Yield, Return]?
+ StatementList[?Yield, +Return]?
@@ -17929,8 +17941,8 @@ Syntax
CoverParenthesizedExpressionAndArrowParameterList[?Yield] #parencover
ConciseBody[In] :
- [lookahead != `{` ] AssignmentExpression[?In]
- `{` FunctionBody `}`
+ [lookahead != `{` ] AssignmentExpression[?In, ~Yield]
+ `{` FunctionBody[~Yield] `}`
Supplemental Syntax
When the production
@@ -17961,10 +17973,10 @@
Static Semantics: Early Errors
ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
-
- If the [Yield] grammar parameter is present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters[Yield]| as the goal symbol.
+ If the [Yield] grammar parameter is present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters[+Yield]| as the goal symbol.
-
- If the [Yield] grammar parameter is not present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters| as the goal symbol.
+ If the [Yield] grammar parameter is not present on |ArrowParameters|, it is a Syntax Error if the lexical token sequence matched by |CoverParenthesizedExpressionAndArrowParameterList[?Yield]| cannot be parsed with no tokens left over using |ArrowFormalParameters[~Yield]| as the goal symbol.
-
All early errors rules for |ArrowFormalParameters| and its derived productions also apply to CoveredFormalsList of |CoverParenthesizedExpressionAndArrowParameterList[?Yield]|.
@@ -18075,8 +18087,8 @@
Static Semantics: CoveredFormalsList
`(` Expression `,` `...` BindingPattern `)`
- 1. If the [Yield] grammar parameter is present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using |ArrowFormalParameters[Yield]| as the goal symbol.
- 1. If the [Yield] grammar parameter is not present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList| using |ArrowFormalParameters| as the goal symbol.
+ 1. If the [Yield] grammar parameter is present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using |ArrowFormalParameters[+Yield]| as the goal symbol.
+ 1. If the [Yield] grammar parameter is not present for |CoverParenthesizedExpressionAndArrowParameterList[Yield]|, return the result of parsing the lexical token stream matched by |CoverParenthesizedExpressionAndArrowParameterList[Yield]| using |ArrowFormalParameters[~Yield]| as the goal symbol.
@@ -18180,13 +18192,13 @@ Method Definitions
Syntax
MethodDefinition[Yield] :
- PropertyName[?Yield] `(` StrictFormalParameters `)` `{` FunctionBody `}`
+ PropertyName[?Yield] `(` StrictFormalParameters[~Yield] `)` `{` FunctionBody[~Yield] `}`
GeneratorMethod[?Yield]
- `get` PropertyName[?Yield] `(` `)` `{` FunctionBody `}`
- `set` PropertyName[?Yield] `(` PropertySetParameterList `)` `{` FunctionBody `}`
+ `get` PropertyName[?Yield] `(` `)` `{` FunctionBody[~Yield] `}`
+ `set` PropertyName[?Yield] `(` PropertySetParameterList `)` `{` FunctionBody[~Yield] `}`
PropertySetParameterList :
- FormalParameter
+ FormalParameter[~Yield]
@@ -18376,22 +18388,22 @@ Generator Function Definitions
Syntax
GeneratorMethod[Yield] :
- `*` PropertyName[?Yield] `(` StrictFormalParameters[Yield] `)` `{` GeneratorBody `}`
+ `*` PropertyName[?Yield] `(` StrictFormalParameters[+Yield] `)` `{` GeneratorBody `}`
GeneratorDeclaration[Yield, Default] :
- `function` `*` BindingIdentifier[?Yield] `(` FormalParameters[Yield] `)` `{` GeneratorBody `}`
- [+Default] `function` `*` `(` FormalParameters[Yield] `)` `{` GeneratorBody `}`
+ `function` `*` BindingIdentifier[?Yield] `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
+ [+Default] `function` `*` `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
GeneratorExpression :
- `function` `*` BindingIdentifier[Yield]? `(` FormalParameters[Yield] `)` `{` GeneratorBody `}`
+ `function` `*` BindingIdentifier[+Yield]? `(` FormalParameters[+Yield] `)` `{` GeneratorBody `}`
GeneratorBody :
- FunctionBody[Yield]
+ FunctionBody[+Yield]
YieldExpression[In] :
`yield`
- `yield` [no LineTerminator here] AssignmentExpression[?In, Yield]
- `yield` [no LineTerminator here] `*` AssignmentExpression[?In, Yield]
+ `yield` [no LineTerminator here] AssignmentExpression[?In, +Yield]
+ `yield` [no LineTerminator here] `*` AssignmentExpression[?In, +Yield]
The syntactic context immediately following `yield` requires use of the |InputElementRegExpOrTemplateTail| lexical goal.
@@ -19015,11 +19027,11 @@ Runtime Semantics: ClassDefinitionEvaluation
1. If |ClassHeritage_opt| is present and _protoParent_ is not *null*, then
1. Let _constructor_ be the result of parsing the source text
constructor(... args){ super (...args);}
- using the syntactic grammar with the goal symbol |MethodDefinition|.
+ using the syntactic grammar with the goal symbol |MethodDefinition[~Yield]|.
1. Else,
1. Let _constructor_ be the result of parsing the source text
constructor( ){ }
- using the syntactic grammar with the goal symbol |MethodDefinition|.
+ using the syntactic grammar with the goal symbol |MethodDefinition[~Yield]|.
1. Set the running execution context's LexicalEnvironment to _classScope_.
1. Let _constructorInfo_ be the result of performing DefineMethod for _constructor_ with arguments _proto_ and _constructorParent_ as the optional _functionPrototype_ argument.
1. Assert: _constructorInfo_ is not an abrupt completion.
@@ -19430,7 +19442,7 @@ Syntax
ScriptBody?
ScriptBody :
- StatementList
+ StatementList[~Yield, ~Return]
@@ -19737,7 +19749,7 @@ Syntax
ModuleItem :
ImportDeclaration
ExportDeclaration
- StatementListItem
+ StatementListItem[~Yield, ~Return]
@@ -21009,7 +21021,7 @@ Syntax
StringLiteral
ImportedBinding :
- BindingIdentifier
+ BindingIdentifier[~Yield]
@@ -21155,11 +21167,11 @@ Syntax
`export` `*` FromClause `;`
`export` ExportClause FromClause `;`
`export` ExportClause `;`
- `export` VariableStatement
- `export` Declaration
- `export` `default` HoistableDeclaration[Default]
- `export` `default` ClassDeclaration[Default]
- `export` `default` [lookahead <! {`function`, `class`}] AssignmentExpression[In] `;`
+ `export` VariableStatement[~Yield]
+ `export` Declaration[~Yield]
+ `export` `default` HoistableDeclaration[~Yield, +Default]
+ `export` `default` ClassDeclaration[~Yield, +Default]
+ `export` `default` [lookahead <! {`function`, `class`}] AssignmentExpression[+In, ~Yield] `;`
ExportClause :
`{` `}`
@@ -21628,7 +21640,7 @@ Forbidden Extensions
The behaviour of the following methods must not be extended except as specified in ECMA-402: `Object.prototype.toLocaleString`, `Array.prototype.toLocaleString`, `Number.prototype.toLocaleString`, `Date.prototype.toLocaleDateString`, `Date.prototype.toLocaleString`, `Date.prototype.toLocaleTimeString`, `String.prototype.localeCompare`, `%TypedArray%.prototype.toLocaleString`.
- The RegExp pattern grammars in and must not be extended to recognize any of the source characters A-Z or a-z as |IdentityEscape[U]| when the U grammar parameter is present.
+ The RegExp pattern grammars in and must not be extended to recognize any of the source characters A-Z or a-z as |IdentityEscape[+U]| when the U grammar parameter is present.
The Syntactic Grammar must not be extended in any manner that allows the token `:` to immediate follow source text that matches the |BindingIdentifier| nonterminal symbol.
@@ -23006,12 +23018,12 @@ Runtime Semantics: CreateDynamicFunction(_constructor_, _newTarget_, _kind_,
1. If _newTarget_ is *undefined*, let _newTarget_ be _constructor_.
1. If _kind_ is `"normal"`, then
- 1. Let _goal_ be the grammar symbol |FunctionBody|.
- 1. Let _parameterGoal_ be the grammar symbol |FormalParameters|.
+ 1. Let _goal_ be the grammar symbol |FunctionBody[~Yield]|.
+ 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[~Yield]|.
1. Let _fallbackProto_ be `"%FunctionPrototype%"`.
1. Else,
1. Let _goal_ be the grammar symbol |GeneratorBody|.
- 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[Yield]|.
+ 1. Let _parameterGoal_ be the grammar symbol |FormalParameters[+Yield]|.
1. Let _fallbackProto_ be `"%Generator%"`.
1. Let _argCount_ be the number of elements in _args_.
1. Let _P_ be the empty String.
@@ -28740,10 +28752,10 @@ Runtime Semantics: RegExpInitialize ( _obj_, _pattern_, _flags_ )
1. If _F_ contains any code unit other than `"g"`, `"i"`, `"m"`, `"u"`, or `"y"` or if it contains the same code unit more than once, throw a *SyntaxError* exception.
1. If _F_ contains `"u"`, let _BMP_ be *false*; else let _BMP_ be *true*.
1. If _BMP_ is *true*, then
- 1. Parse _P_ using the grammars in and interpreting each of its 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not applied to the elements. The goal symbol for the parse is |Pattern|. Throw a *SyntaxError* exception if _P_ did not conform to the grammar, if any elements of _P_ were not matched by the parse, or if any Early Error conditions exist.
+ 1. Parse _P_ using the grammars in and interpreting each of its 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not applied to the elements. The goal symbol for the parse is |Pattern[~U]|. Throw a *SyntaxError* exception if _P_ did not conform to the grammar, if any elements of _P_ were not matched by the parse, or if any Early Error conditions exist.
1. Let _patternCharacters_ be a List whose elements are the code unit elements of _P_.
1. Else,
- 1. Parse _P_ using the grammars in and interpreting _P_ as UTF-16 encoded Unicode code points (). The goal symbol for the parse is |Pattern[U]|. Throw a *SyntaxError* exception if _P_ did not conform to the grammar, if any elements of _P_ were not matched by the parse, or if any Early Error conditions exist.
+ 1. Parse _P_ using the grammars in and interpreting _P_ as UTF-16 encoded Unicode code points (). The goal symbol for the parse is |Pattern[+U]|. Throw a *SyntaxError* exception if _P_ did not conform to the grammar, if any elements of _P_ were not matched by the parse, or if any Early Error conditions exist.
1. Let _patternCharacters_ be a List whose elements are the code points resulting from applying UTF-16 decoding to _P_'s sequence of elements.
1. Set the value of _obj_'s [[OriginalSource]] internal slot to _P_.
1. Set the value of _obj_'s [[OriginalFlags]] internal slot to _F_.
@@ -28768,7 +28780,7 @@ Runtime Semantics: RegExpCreate ( _P_, _F_ )
Runtime Semantics: EscapeRegExpPattern ( _P_, _F_ )
When the abstract operation EscapeRegExpPattern with arguments _P_ and _F_ is called, the following occurs:
- 1. Let _S_ be a String in the form of a |Pattern| (|Pattern[U]| if _F_ contains `"u"`) equivalent to _P_ interpreted as UTF-16 encoded Unicode code points (), in which certain code points are escaped as described below. _S_ may or may not be identical to _P_; however, the internal procedure that would result from evaluating _S_ as a |Pattern| (|Pattern[U]| if _F_ contains `"u"`) must behave identically to the internal procedure given by the constructed object's [[RegExpMatcher]] internal slot. Multiple calls to this abstract operation using the same values for _P_ and _F_ must produce identical results.
+ 1. Let _S_ be a String in the form of a |Pattern[~U]| (|Pattern[+U]| if _F_ contains `"u"`) equivalent to _P_ interpreted as UTF-16 encoded Unicode code points (), in which certain code points are escaped as described below. _S_ may or may not be identical to _P_; however, the internal procedure that would result from evaluating _S_ as a |Pattern[~U]| (|Pattern[+U]| if _F_ contains `"u"`) must behave identically to the internal procedure given by the constructed object's [[RegExpMatcher]] internal slot. Multiple calls to this abstract operation using the same values for _P_ and _F_ must produce identical results.
1. The code points `/` or any |LineTerminator| occurring in the pattern shall be escaped in _S_ as necessary to ensure that the String value formed by concatenating the Strings `"/"`, _S_, `"/"`, and _F_ can be parsed (in an appropriate lexical context) as a |RegularExpressionLiteral| that behaves identically to the constructed regular expression. For example, if _P_ is `"/"`, then _S_ could be `"\\/"` or `"\\u002F"`, among other possibilities, but not `"/"`, because `///` followed by _F_ would be parsed as a |SingleLineComment| rather than a |RegularExpressionLiteral|. If _P_ is the empty String, this specification can be met by letting _S_ be `"(?:)"`.
1. Return _S_.
@@ -35898,11 +35910,11 @@ Regular Expressions Patterns
Syntax
Term[U] ::
- [+U] Assertion[U]
- [+U] Atom[U]
- [+U] Atom[U] Quantifier
+ [+U] Assertion[+U]
+ [+U] Atom[+U]
+ [+U] Atom[+U] Quantifier
[~U] QuantifiableAssertion Quantifier
- [~U] Assertion
+ [~U] Assertion[~U]
[~U] ExtendedAtom Quantifier
[~U] ExtendedAtom
@@ -35911,20 +35923,20 @@ Syntax
`$`
`\` `b`
`\` `B`
- [+U] `(` `?` `=` Disjunction[U] `)`
- [+U] `(` `?` `!` Disjunction[U] `)`
+ [+U] `(` `?` `=` Disjunction[+U] `)`
+ [+U] `(` `?` `!` Disjunction[+U] `)`
[~U] QuantifiableAssertion
QuantifiableAssertion ::
- `(` `?` `=` Disjunction `)`
- `(` `?` `!` Disjunction `)`
+ `(` `?` `=` Disjunction[~U] `)`
+ `(` `?` `!` Disjunction[~U] `)`
ExtendedAtom ::
`.`
- `\` AtomEscape
- CharacterClass
- `(` Disjunction `)`
- `(` `?` `:` Disjunction `)`
+ `\` AtomEscape[~U]
+ CharacterClass[~U]
+ `(` Disjunction[~U] `)`
+ `(` `?` `:` Disjunction[~U] `)`
InvalidBracedQuantifier
ExtendedPatternCharacter
@@ -35940,7 +35952,7 @@ Syntax
[+U] DecimalEscape
[~U] DecimalEscape [> but only if the integer value of |DecimalEscape| is <= _NcapturingParens_]
CharacterClassEscape
- CharacterEscape
+ CharacterEscape[~U]
CharacterEscape[U] ::
ControlEscape
@@ -36724,12 +36736,12 @@ FunctionDeclarations in IfStatement Statement Clauses
The following augments the |IfStatement| production in :
IfStatement[Yield, Return] :
- `if` `(` Expression[In, ?Yield] `)` FunctionDeclaration[?Yield] `else` Statement[?Yield, ?Return]
- `if` `(` Expression[In, ?Yield] `)` Statement[?Yield, ?Return] `else` FunctionDeclaration[?Yield]
- `if` `(` Expression[In, ?Yield] `)` FunctionDeclaration[?Yield] `else` FunctionDeclaration[?Yield]
- `if` `(` Expression[In, ?Yield] `)` FunctionDeclaration[?Yield]
+ `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default] `else` Statement[?Yield, ?Return]
+ `if` `(` Expression[+In, ?Yield] `)` Statement[?Yield, ?Return] `else` FunctionDeclaration[?Yield, ~Default]
+ `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default] `else` FunctionDeclaration[?Yield, ~Default]
+ `if` `(` Expression[+In, ?Yield] `)` FunctionDeclaration[?Yield, ~Default]
- This production only applies when parsing non-strict code. Code matching this production is processed as if each matching occurrence of |FunctionDeclaration[?Yield]| was the sole |StatementListItem| of a |BlockStatement| occupying that position in the source code. The semantics of such a synthetic |BlockStatement| includes the web legacy compatibility semantics specified in .
+ This production only applies when parsing non-strict code. Code matching this production is processed as if each matching occurrence of |FunctionDeclaration[?Yield, ~Default]| was the sole |StatementListItem| of a |BlockStatement| occupying that position in the source code. The semantics of such a synthetic |BlockStatement| includes the web legacy compatibility semantics specified in .