On 23/10/2007, David Teller <[EMAIL PROTECTED]> wrote: > Hello list, > > I'm still fighting the syntax of JS2. Attempting to feed it into a > parser generator (menhir, for the moment), has already allowed me to > find a few typoes in the spec and a few useless variables in the > reference implementation, which is all I have to show for the moment. > That and the fact that all XML* productions seem absent from the RI. > > At the moment, though, I'm being puzzled by rule 317: > > ExpressionStatement > | ListExpression (allowColon, allowIn) > [if lookahead not in { "function", "let", "{" }] > > Besides the fact that this rule is annoying to implement, does it > actually mean what it intends ? In addition to blocks, it also prevents > an assignment to an object pattern from starting the ListExpression. Is > that desired ?
It's there to prevent the grammar from being ambiguous. "function", "let" and "{" have different meaning in statement context from expression context. If the ExpressionStatement construct allowed them, then they would be ambigous in statement context, they could have either the statement or the expression semantics. So, in order to prevent this ambiguity, they are not allowed in ExpressionStatement. -- David "liorean" Andersson _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss