EcmaScript语法中的[Yield, Await, In, Return]是什么

What are [Yield, Await, In, Return] in EcmaScript grammar

EcmaScript 中的许多作品都给出了以下 "modifiers":

[Yield, Await, In, Return]

这里有几个例子:

ArrayLiteral[Yield, Await]:
  ...

ElementList[Yield, Await]:
 ... AssignmentExpression[+In, ?Yield, ?Await]

我在规范中搜索了解释,特别是 Grammar Notation 部分,但找不到。它应该在那里。有人可以指出相关段落并提供简短解释吗?

Section 5.1.5: Grammar Notation -

A production may be parameterized by a subscripted annotation of the form “[parameters]”, which may appear as a suffix to the nonterminal symbol defined by the production. “parameters” may be either a single name or a comma separated list of names. A parameterized production is shorthand for a set of productions defining all combinations of the parameter names, preceded by an underscore, appended to the parameterized nonterminal symbol. This means that:

StatementList[Return]:
   ReturnStatement
   ExpressionStatement

is a convenient abbreviation for:

StatementList:
   ReturnStatement
   ExpressionStatement
StatementList_Return:
   ReturnStatement
   ExpressionStatement

and that:

StatementList[Return, In]:
   ReturnStatement
   ExpressionStatement

is an abbreviation for:

StatementList:
   ReturnStatement
   ExpressionStatement
StatementList_Return:
   ReturnStatement
   ExpressionStatement
StatementList_In:
   ReturnStatement
   ExpressionStatement
StatementList_Return_In:
   ReturnStatement
   ExpressionStatement

Multiple parameters produce a combinatory number of productions, not all of which are necessarily referenced in a complete grammar.

它从那里继续讨论参数化右侧、添加“opt”等。

(在搜索时,不要只查找 [Return] 等具体内容,因为它们可以而且通常确实出现在 [Yield, Await, Return][?Yield, ?Await, ?Return] 之类的组中,就像在语法中一样Block.)

Section 12.1.1: Identifiers - Static Semantics: Early Errors -

It is a Syntax Error if this production has a [Yield] parameter and StringValue of Identifier is "yield".

It is a Syntax Error if this production has an [Await] parameter and StringValue of Identifier is "await".

Section 12.10: Relational Operators-

The [In] grammar parameter is needed to avoid confusing the in operator in a relational expression with the in operator in a for statement.