Can anyone explain how the following production expands into *
and async
keywords:
BindingIdentifier[Yield, Await]:
Identifier
[~Yield]yield
[~Await]await
Based on the TypeScript parsing code I see that it checks for *
and async
keywords, so I assume here that BindingIdentifier_Yield
matches *identifier
and BindingIdentifier_Await
matches async identifier
but I can't seem to trace that expansion using the above grammar.
I know I can expand the identifiers [Yield, Await]
according to the spec:
A production may be parameterized by a subscripted annotation of the form “[parameters]”... 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
So the above is expanded into:
BindingIdentifier:
Identifier
[~Yield]yield
[~Await]await
BindingIdentifier_Yield:
Identifier
[~Yield]yield
[~Await]await
BindingIdentifier_Await:
Identifier
[~Yield]yield
[~Await]await
But how then BindingIdentifier_Yield
and BindingIdentifier_Await
is expanded into *
and async
? I suspect that the explanation is here:
[~Yield]yield
[~Await]await
but I'm not sure. Any help is welcome!