I've updated the grammar to fix the bugs Waldemar and Jon pointed out:
http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival
ElementList : // See 11.1.4
Elisionopt InitialValue
ElementList , Elisionopt InitialValue
PropertyAssignment : // See 11.1.5
PropertyName : InitialValue
ArgumentList : // See 11.2
InitialValue
ArgumentList , InitialValue
Initialiser : // See 12.2
= InitialValue
InitialiserNoIn : // See 12.2
= InitialValueNoIn
InitialValue :
AssignmentExpression
CallWithBlockArguments
Statement :
...
CallWithBlockArguments
LeftHandSideExpression = CallWithBlockArguments
LeftHandSideExpression AssignmentOperator CallWithBlockArguments
PrimaryExpression :
...
( CallWithBlockArguments )
CallWithBlockArguments :
MemberExpression [no LineTerminator here] BlockArguments
BlockArguments :
BlockLambda
BlockArguments [no LineTerminator here] BlockLambda
BlockArguments [no LineTerminator here] ( Expression )
BlockLambda :
{ | BlockParameterListopt | StatementListopt }
BlockParameterList :
BlockParameter
BlockParameterList , BlockParameter
BlockParameter :
Identifier BlockParameterInitialiseropt
Pattern BlockParameterInitialiseropt
BlockParameterInitialiser :
= BitwiseXorExpression
The idea is to restrict paren-free block-lambda-argument-bearing calls (we knew
those were trouble if not confined!) to only certain contexts:
* as an initial value for
* a property in an initialiser,
* an argument in a parenthesized call,
* a parameter default value,
* a variable declaration initialiser;
* the entirety of the expression in an expression statement;
* the right-hand side of an assignment operator following a left-hand-side
expression, the assignment making a complete expression statement;
* parenthesized as a primary expression.
So you can go paren-free in the obvious places. Anywhere hinky, like the
condition of an if statement (see
http://wiki.ecmascript.org/doku.php?id=strawman:paren_free and thanks to
Waldemar for pointing this out) you have to parenthesize.
This seems to check out without conflicts in Bison, although I tested only a
reduced sub-grammar of ES5.
/be_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss