-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add proposed fragment changes #93
Changes from 3 commits
aac60d5
448fea4
f317675
a3bd36d
62bd1f9
6bf1219
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,14 +126,40 @@ interface JSXText <: Node { | |
JSX Element | ||
----------- | ||
|
||
Finally, JSX element itself consists of opening element, list of children and optional closing element: | ||
JSX element itself consists of opening element, list of children and optional closing element: | ||
|
||
```js | ||
interface JSXElement <: Expression { | ||
type: "JSXElement", | ||
openingElement: JSXOpeningElement, | ||
children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement ], | ||
closingElement: JSXClosingElement | null | ||
children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment ]; | ||
closingElement: JSXClosingElement | null; | ||
} | ||
``` | ||
|
||
JSX Fragment | ||
------------ | ||
|
||
JSX fragment itself consists of an opening fragment, list of children, and closing fragment: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. Feels like the grammar is weird in these. |
||
|
||
```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"; | ||
} | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 : | ||
|
||
- <> JSXChildren<sub>opt</sub> </> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use the ` character around each token with a space between.
So the formatting comes out like this:
The point of this is because we build this on top of the normal tokenizing in JavaScript. These individual tokens already exist but there's no E.g. this is valid: let fragment = <>
< // comment
/ /* another comment */ >; |
||
|
||
JSXElementName : | ||
|
||
- JSXIdentifier | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A JSX element consists of
maybe?