Skip to content

Commit c4f5c8f

Browse files
authored
Allow nested anonymous elements (JSX fragments) (#139)
Co-authored-by: Martin Jambon <Martin Jambon>
1 parent 3d54934 commit c4f5c8f

File tree

5 files changed

+20676
-20492
lines changed

5 files changed

+20676
-20492
lines changed

grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ module.exports = grammar({
508508
_jsx_child: $ => choice(
509509
$.jsx_text,
510510
$._jsx_element,
511+
$.jsx_fragment,
511512
$.jsx_expression
512513
),
513514

src/grammar.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,10 @@
20782078
"type": "SYMBOL",
20792079
"name": "_jsx_element"
20802080
},
2081+
{
2082+
"type": "SYMBOL",
2083+
"name": "jsx_fragment"
2084+
},
20812085
{
20822086
"type": "SYMBOL",
20832087
"name": "jsx_expression"
@@ -4551,7 +4555,7 @@
45514555
},
45524556
{
45534557
"type": "PATTERN",
4554-
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
4558+
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
45554559
},
45564560
{
45574561
"type": "STRING",
@@ -4713,7 +4717,7 @@
47134717
},
47144718
{
47154719
"type": "PATTERN",
4716-
"value": "[^/\\\\\\[\\n]"
4720+
"value": "[^\\/\\\\\\[\\n]"
47174721
}
47184722
]
47194723
}
@@ -5222,13 +5226,13 @@
52225226
"members": [
52235227
{
52245228
"type": "PATTERN",
5225-
"value": "[^\\x00-\\x1F\\s0-9:;`\"'@#.,|^&<=>+\\-*/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
5229+
"value": "[^\\x00-\\x1F\\s0-9:;`\"'@#.,|^&<=>+\\-*\\/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
52265230
},
52275231
{
52285232
"type": "REPEAT",
52295233
"content": {
52305234
"type": "PATTERN",
5231-
"value": "[^\\x00-\\x1F\\s:;`\"'@#.,|^&<=>+\\-*/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
5235+
"value": "[^\\x00-\\x1F\\s:;`\"'@#.,|^&<=>+\\-*\\/\\\\%?!~()\\[\\]{}\\uFEFF\\u2060\\u200B\\u00A0]|\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}"
52325236
}
52335237
}
52345238
]

src/node-types.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,10 @@
15591559
"type": "jsx_expression",
15601560
"named": true
15611561
},
1562+
{
1563+
"type": "jsx_fragment",
1564+
"named": true
1565+
},
15621566
{
15631567
"type": "jsx_self_closing_element",
15641568
"named": true
@@ -1609,6 +1613,10 @@
16091613
"type": "jsx_expression",
16101614
"named": true
16111615
},
1616+
{
1617+
"type": "jsx_fragment",
1618+
"named": true
1619+
},
16121620
{
16131621
"type": "jsx_self_closing_element",
16141622
"named": true

0 commit comments

Comments
 (0)