Skip to content

Commit 603a846

Browse files
Martin JambonMartin Jambon
Martin Jambon
authored and
Martin Jambon
committed
Remove redundant 'jsx_string' rule. Now there's just one 'string' rule
used everywhere, which tolerates unescaped newlines.
1 parent 80669a6 commit 603a846

File tree

5 files changed

+20246
-20285
lines changed

5 files changed

+20246
-20285
lines changed

grammar.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ module.exports = grammar({
6161
$._jsx_attribute_value,
6262
$._jsx_identifier,
6363
$._lhs_expression,
64-
$._string,
6564
],
6665

6766
conflicts: $ => [
@@ -569,7 +568,7 @@ module.exports = grammar({
569568
),
570569

571570
_jsx_attribute_value: $ => choice(
572-
$.jsx_string,
571+
$.string,
573572
$.jsx_expression,
574573
$._jsx_element,
575574
$.jsx_fragment
@@ -811,7 +810,7 @@ module.exports = grammar({
811810
// 2020), and perhaps will be valid in javascript as well in the
812811
// future.
813812
//
814-
_string: $ => choice(
813+
string: $ => choice(
815814
seq(
816815
'"',
817816
repeat(choice(
@@ -830,9 +829,6 @@ module.exports = grammar({
830829
)
831830
),
832831

833-
string: $ => $._string,
834-
jsx_string: $ => $._string,
835-
836832
escape_sequence: $ => token.immediate(seq(
837833
'\\',
838834
choice(

src/grammar.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,7 @@
23372337
"members": [
23382338
{
23392339
"type": "SYMBOL",
2340-
"name": "jsx_string"
2340+
"name": "string"
23412341
},
23422342
{
23432343
"type": "SYMBOL",
@@ -4411,7 +4411,7 @@
44114411
]
44124412
}
44134413
},
4414-
"_string": {
4414+
"string": {
44154415
"type": "CHOICE",
44164416
"members": [
44174417
{
@@ -4488,14 +4488,6 @@
44884488
}
44894489
]
44904490
},
4491-
"string": {
4492-
"type": "SYMBOL",
4493-
"name": "_string"
4494-
},
4495-
"jsx_string": {
4496-
"type": "SYMBOL",
4497-
"name": "_string"
4498-
},
44994491
"escape_sequence": {
45004492
"type": "IMMEDIATE_TOKEN",
45014493
"content": {
@@ -5989,8 +5981,7 @@
59895981
"_jsx_attribute_name",
59905982
"_jsx_attribute_value",
59915983
"_jsx_identifier",
5992-
"_lhs_expression",
5993-
"_string"
5984+
"_lhs_expression"
59945985
],
59955986
"supertypes": [
59965987
"_statement",

src/node-types.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,11 +1488,11 @@
14881488
"named": true
14891489
},
14901490
{
1491-
"type": "jsx_string",
1491+
"type": "property_identifier",
14921492
"named": true
14931493
},
14941494
{
1495-
"type": "property_identifier",
1495+
"type": "string",
14961496
"named": true
14971497
}
14981498
]
@@ -1719,21 +1719,6 @@
17191719
}
17201720
}
17211721
},
1722-
{
1723-
"type": "jsx_string",
1724-
"named": true,
1725-
"fields": {},
1726-
"children": {
1727-
"multiple": true,
1728-
"required": false,
1729-
"types": [
1730-
{
1731-
"type": "escape_sequence",
1732-
"named": true
1733-
}
1734-
]
1735-
}
1736-
},
17371722
{
17381723
"type": "labeled_statement",
17391724
"named": true,

0 commit comments

Comments
 (0)