diff --git a/AST.md b/AST.md index 9f66d0b..8400fb8 100644 --- a/AST.md +++ b/AST.md @@ -126,17 +126,43 @@ interface JSXText <: Node { JSX Element ----------- -Finally, JSX element itself consists of opening element, list of children and optional closing element: +JSX element consists of opening element, list of children and optional closing element: ```js interface JSXElement <: Expression { type: "JSXElement"; openingElement: JSXOpeningElement; - children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement ]; + children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment ]; closingElement: JSXClosingElement | null; } ``` +JSX Fragment +------------ + +JSX fragment consists of an opening fragment, list of children, and closing fragment: + +```js +interface JSXFragment <: Expression { + type: "JSXFragment"; + openingFragment: JSXOpeningFragment; + children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment ]; + closingFragment: JSXClosingFragment; +} +``` + +```js +interface JSXOpeningFragment <: Node { + type: "JSXOpeningFragment"; +} +``` + +```js +interface JSXClosingFragment <: Node { + type: "JSXClosingFragment"; +} +``` + Tools that work with JSX AST ---------------------------- diff --git a/README.md b/README.md index c9a6747..4932bc2 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ _JSX extends the PrimaryExpression in the [ECMAScript 6th Edition (ECMA-262)](ht PrimaryExpression : - JSXElement +- JSXFragment __Elements__ @@ -60,6 +61,10 @@ JSXClosingElement : - `<` `/` JSXElementName `>` +JSXFragment : + +- `<` `>` JSXChildrenopt `<` `/` `>` + JSXElementName : - JSXIdentifier