From e2d0e4b744ed6c478414ee33331853ab7e73c6fb Mon Sep 17 00:00:00 2001 From: Clement Hoang Date: Thu, 9 Nov 2017 14:38:05 +0000 Subject: [PATCH 1/2] Update spec with jsx generation expressions --- AST.md | 14 ++++++++++++-- README.md | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/AST.md b/AST.md index 7555620..7e43f87 100644 --- a/AST.md +++ b/AST.md @@ -47,12 +47,22 @@ interface JSXEmptyExpression <: Node { } ``` -Any expression used as attribute value or inside JSX text should is wrapped into expression container: +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 is wrapped into expression container: ```js interface JSXExpressionContainer <: Node { type: "JSXExpressionContainer"; - expression: Expression | JSXEmptyExpression; + expression: Expression | JSXEmptyExpression | JSXBlockStatement; + isExpression: boolean; +} +``` + +From `BlockStatement`, this inherits `body: [ Statement ];`. + +```js +interface JSXBlockStatement <: BlockStatement { + type: "JSXStatementList"; + generator: boolean; } ``` diff --git a/README.md b/README.md index 1a67818..9995dc5 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ PrimaryExpression : - JSXElement - JSXFragment +- JSXGeneratorExpressionContainer __Elements__ @@ -115,9 +116,21 @@ JSXAttributeValue :
 - `"` JSXDoubleStringCharactersopt `"` - `'` JSXSingleStringCharactersopt `'` - `{` AssignmentExpression `}` +- JSXGeneratorExpressionContainer - JSXElement - JSXFragment +JSXGeneratorExpressionContainer : +- `*` `{` JSXGeneratorExpressionopt `}` + +JSXGeneratorExpression : +- ObjectLiteral +- FunctionExpression +- ClassExpression +- GeneratorExpression +- AsyncFunctionExpression +- FunctionBody[+Yield, ~Await, ~Return] + JSXDoubleStringCharacters :
 - JSXDoubleStringCharacter JSXDoubleStringCharactersopt @@ -145,6 +158,7 @@ JSXChild : - JSXText - JSXElement - JSXFragment +- JSXGeneratorExpressionContainer - `{` JSXChildExpressionopt `}` JSXText : From 68a5183e3281b51ca9f112d8b343a8b95d4c3337 Mon Sep 17 00:00:00 2001 From: Clement Hoang Date: Mon, 13 Nov 2017 18:06:25 -0800 Subject: [PATCH 2/2] Disambiguate * in JSXText --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9995dc5..71f2815 100644 --- a/README.md +++ b/README.md @@ -164,10 +164,11 @@ JSXChild : JSXText : - JSXTextCharacter JSXTextopt +- [lookahead ∉ { `{` }] `*` JSXTextopt JSXTextCharacter : -- SourceCharacter __but not one of `{`, `<`, `>` or `}`__ +- SourceCharacter __but not one of `*`, `{`, `<`, `>` or `}`__ JSXChildExpression :