Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add JSXSpreadChild #59

Merged
merged 1 commit into from
Jul 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion AST.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ interface JSXExpressionContainer <: Node {
}
```

A JSX element uses a special form of an expression container for an iterator child who should be “spread out” inside an element’s children list:

```js
interface JSXSpreadChild <: Node {
type: "JSXSpreadChild",
expression: Expression
}
```

JSX Boundary Tags
-----------------

Expand Down Expand Up @@ -110,7 +119,7 @@ Finally, JSX element itself consists of opening element, list of children and op
interface JSXElement <: Expression {
type: "JSXElement",
openingElement: JSXOpeningElement,
children: [ Literal | JSXExpressionContainer | JSXElement ],
children: [ Literal | JSXExpressionContainer | JSXSpreadChild | JSXElement ],
closingElement: JSXClosingElement | null
}
```
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ JSXChild :

- JSXText
- JSXElement
- `{` AssignmentExpression<sub>opt</sub> `}`
- `{` JSXChildExpression `}`
Copy link
Contributor

@RReverser RReverser Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would put opt here. as it was before Technically it doesn't matter for the grammar, but would be cleaner to see that the content between braces is optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like that better too 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #61


JSXText :

Expand All @@ -148,6 +148,11 @@ JSXTextCharacter :

- SourceCharacter __but not one of `{`, `<`, `>` or `}`__

JSXChildExpression :

- AssignmentExpression<sub>opt</sub>
- `...` AssignmentExpression

__Whitespace and Comments__

_JSX uses the same punctuators and braces as ECMAScript. WhiteSpace, LineTerminators and Comments are generally allowed between any punctuators._
Expand Down