@willbooster/tree-sitter-rust 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/grammar.js +27 -12
- package/package.json +1 -1
- package/src/node-types.json +5 -4
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -105,6 +105,7 @@ const TOKEN_TREE_NON_SPECIAL_PUNCTUATION = [
|
|
|
105
105
|
|
|
106
106
|
const primitiveTypes = [...numericTypes, 'bool', 'str', 'char'];
|
|
107
107
|
const reservedIdentifiers = ['default', 'union', 'gen', 'raw'];
|
|
108
|
+
const fieldIdentifierKeywords = [...reservedIdentifiers, ...primitiveTypes, 'auto'];
|
|
108
109
|
|
|
109
110
|
// oxlint-disable-next-line unicorn/prefer-module -- This package is CommonJS, so tree-sitter loads grammar.js as CommonJS.
|
|
110
111
|
module.exports = grammar({
|
|
@@ -142,6 +143,9 @@ module.exports = grammar({
|
|
|
142
143
|
],
|
|
143
144
|
|
|
144
145
|
conflicts: ($) => [
|
|
146
|
+
[$.field_initializer_list, $.block],
|
|
147
|
+
[$._declaration_statement, $.shorthand_field_initializer, $.field_initializer],
|
|
148
|
+
[$._expression_except_range, $.shorthand_field_initializer],
|
|
145
149
|
[$._declaration_statement, $.attributed_expression],
|
|
146
150
|
[$._expression_except_range, $.struct_expression],
|
|
147
151
|
[$.function_modifiers, $.modified_trait_bound],
|
|
@@ -1096,7 +1100,7 @@ module.exports = grammar({
|
|
|
1096
1100
|
'name',
|
|
1097
1101
|
choice(
|
|
1098
1102
|
$._type_identifier,
|
|
1099
|
-
prec.dynamic(-1, alias(choice(...primitiveTypes), $.type_identifier)),
|
|
1103
|
+
prec.dynamic(-1, alias(choice(...primitiveTypes, ...reservedIdentifiers), $.type_identifier)),
|
|
1100
1104
|
alias($.scoped_type_identifier_in_expression_position, $.scoped_type_identifier),
|
|
1101
1105
|
$.generic_type_with_turbofish
|
|
1102
1106
|
)
|
|
@@ -1112,12 +1116,20 @@ module.exports = grammar({
|
|
|
1112
1116
|
'}'
|
|
1113
1117
|
),
|
|
1114
1118
|
|
|
1115
|
-
shorthand_field_initializer: ($) =>
|
|
1119
|
+
shorthand_field_initializer: ($) =>
|
|
1120
|
+
seq(repeat($.attribute_item), choice($.identifier, alias(choice(...fieldIdentifierKeywords), $.identifier))),
|
|
1116
1121
|
|
|
1117
1122
|
field_initializer: ($) =>
|
|
1118
1123
|
seq(
|
|
1119
1124
|
repeat($.attribute_item),
|
|
1120
|
-
field(
|
|
1125
|
+
field(
|
|
1126
|
+
'field',
|
|
1127
|
+
choice(
|
|
1128
|
+
$._field_identifier,
|
|
1129
|
+
alias(choice(...fieldIdentifierKeywords), $.field_identifier),
|
|
1130
|
+
alias(/[0-9][0-9_]*/, $.integer_literal)
|
|
1131
|
+
)
|
|
1132
|
+
),
|
|
1121
1133
|
':',
|
|
1122
1134
|
field('value', $._expression)
|
|
1123
1135
|
),
|
|
@@ -1394,15 +1406,18 @@ module.exports = grammar({
|
|
|
1394
1406
|
negative_literal: ($) => seq('-', choice($.integer_literal, $.float_literal)),
|
|
1395
1407
|
|
|
1396
1408
|
integer_literal: () =>
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1409
|
+
choice(
|
|
1410
|
+
/[0-9][0-9_]*/,
|
|
1411
|
+
token(
|
|
1412
|
+
choice(
|
|
1413
|
+
seq(
|
|
1414
|
+
choice(/[1-9][0-9_]*/, /0[0-9_]+/, /0b_*[01][01_]*/, /0o_*[0-7][0-7_]*/),
|
|
1415
|
+
optional(numericSuffixWithoutExponent)
|
|
1416
|
+
),
|
|
1417
|
+
/0[box]_+/,
|
|
1418
|
+
seq('0', optional(zeroNumericSuffix)),
|
|
1419
|
+
seq(/0x_*[0-9a-fA-F][0-9a-fA-F_]*/, optional(hexadecimalSuffix))
|
|
1420
|
+
)
|
|
1406
1421
|
)
|
|
1407
1422
|
),
|
|
1408
1423
|
|
package/package.json
CHANGED
package/src/node-types.json
CHANGED
|
@@ -2674,6 +2674,11 @@
|
|
|
2674
2674
|
"named": true,
|
|
2675
2675
|
"fields": {}
|
|
2676
2676
|
},
|
|
2677
|
+
{
|
|
2678
|
+
"type": "integer_literal",
|
|
2679
|
+
"named": true,
|
|
2680
|
+
"fields": {}
|
|
2681
|
+
},
|
|
2677
2682
|
{
|
|
2678
2683
|
"type": "label",
|
|
2679
2684
|
"named": true,
|
|
@@ -5590,10 +5595,6 @@
|
|
|
5590
5595
|
"type": "in",
|
|
5591
5596
|
"named": false
|
|
5592
5597
|
},
|
|
5593
|
-
{
|
|
5594
|
-
"type": "integer_literal",
|
|
5595
|
-
"named": true
|
|
5596
|
-
},
|
|
5597
5598
|
{
|
|
5598
5599
|
"type": "item",
|
|
5599
5600
|
"named": false
|
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|