diff --git a/AST.md b/AST.md index 7555620..6bb14a1 100644 --- a/AST.md +++ b/AST.md @@ -39,20 +39,21 @@ interface JSXNamespacedName <: Expression { JSX Expression Container ------------------------ -JSX adds empty "expression" type in order to allow comments in JSX text: +The expression container node contains statements with the same grammar as a generator body. Also it has a flag to indicate whether it is an expression. Any expression used as attribute value or inside JSX text should be wrapped by expression container: ```js -interface JSXEmptyExpression <: Node { - type: "JSXEmptyExpression"; +interface JSXExpressionContainer <: Node { + type: "JSXExpressionContainer"; + expression: Expression | JSXEmptyExpression | JSXStatementList; + isExpression: boolean; } ``` -Any expression used as attribute value or inside JSX text should is wrapped into expression container: - ```js -interface JSXExpressionContainer <: Node { - type: "JSXExpressionContainer"; - expression: Expression | JSXEmptyExpression; +interface JSXStatementList <: Node { + type: "JSXStatementList"; + body: [ Statement ]; + generator: boolean; } ``` diff --git a/README.md b/README.md index 1a67818..8df7da9 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ PrimaryExpression : - JSXElement - JSXFragment +- JSXGeneratorExpression __Elements__ @@ -114,10 +115,19 @@ JSXAttributeValue :
 - `"` JSXDoubleStringCharactersopt `"` - `'` JSXSingleStringCharactersopt `'` -- `{` AssignmentExpression `}` +- `{` JSXGeneratorExpression `}` - JSXElement - JSXFragment +JSXGeneratorExpression : + +- ObjectLiteral +- FunctionExpression +- ClassExpression +- GeneratorExpression +- AsyncFunctionExpression +- [lookahead ∉ { `{` }] StatementList[+Yield] + JSXDoubleStringCharacters :
 - JSXDoubleStringCharacter JSXDoubleStringCharactersopt @@ -157,7 +167,7 @@ JSXTextCharacter : JSXChildExpression : -- AssignmentExpression +- JSXGeneratorExpression - `...` AssignmentExpression __Whitespace and Comments__