@willbooster/tree-sitter-rust 3.1.0 → 3.1.2

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 CHANGED
@@ -575,6 +575,12 @@ module.exports = grammar({
575
575
  $.reference_type,
576
576
  $.pointer_type,
577
577
  $.tuple_type,
578
+ $.unit_type,
579
+ $.function_type,
580
+ $.dynamic_type,
581
+ $.bounded_type,
582
+ $.macro_invocation,
583
+ $.never_type,
578
584
  $.array_type,
579
585
  $.higher_ranked_trait_bound,
580
586
  alias(choice(...primitiveTypes), sym('primitive_type'))
@@ -650,7 +656,10 @@ module.exports = grammar({
650
656
  ';'
651
657
  ),
652
658
 
653
- trait_bounds: ($) => seq(':', sepBy1('+', choice($._type, $.lifetime, $.higher_ranked_trait_bound))),
659
+ trait_bounds: ($) =>
660
+ prec.right(
661
+ seq(':', optional(seq(sepBy1('+', choice($._type, $.lifetime, $.higher_ranked_trait_bound)), optional('+'))))
662
+ ),
654
663
 
655
664
  higher_ranked_trait_bound: ($) => seq('for', field('type_parameters', $.type_parameters), field('type', $._type)),
656
665
 
@@ -667,14 +676,18 @@ module.exports = grammar({
667
676
  1,
668
677
  seq(
669
678
  '<',
670
- sepBy1(
671
- ',',
679
+ optional(
672
680
  seq(
673
- repeat($.attribute_item),
674
- choice($.metavariable, $.type_parameter, $.lifetime_parameter, $.const_parameter)
681
+ sepBy1(
682
+ ',',
683
+ seq(
684
+ repeat($.attribute_item),
685
+ choice($.metavariable, $.type_parameter, $.lifetime_parameter, $.const_parameter)
686
+ )
687
+ ),
688
+ optional(',')
675
689
  )
676
690
  ),
677
- optional(','),
678
691
  '>'
679
692
  )
680
693
  ),
@@ -777,7 +790,7 @@ module.exports = grammar({
777
790
 
778
791
  array_type: ($) => seq('[', field('element', $._type), optional(seq(';', field('length', $._expression))), ']'),
779
792
 
780
- for_lifetimes: ($) => seq('for', '<', sepBy1(',', $.lifetime), optional(','), '>'),
793
+ for_lifetimes: ($) => seq('for', '<', optional(seq(sepBy1(',', $.lifetime), optional(','))), '>'),
781
794
 
782
795
  function_type: ($) =>
783
796
  seq(
@@ -865,14 +878,18 @@ module.exports = grammar({
865
878
  type_arguments: ($) =>
866
879
  seq(
867
880
  token(prec(1, '<')),
868
- sepBy1(
869
- ',',
870
- choice(
871
- seq(choice($._type, $.type_binding, $.lifetime, $._literal, $.block), optional($.trait_bounds)),
872
- prec(1, seq(alias(choice(...primitiveTypes), sym('type_identifier')), $.trait_bounds))
881
+ optional(
882
+ seq(
883
+ sepBy1(
884
+ ',',
885
+ choice(
886
+ seq(choice($._type, $.type_binding, $.lifetime, $._literal, $.block), optional($.trait_bounds)),
887
+ prec(1, seq(alias(choice(...primitiveTypes), sym('type_identifier')), $.trait_bounds))
888
+ )
889
+ ),
890
+ optional(',')
873
891
  )
874
892
  ),
875
- optional(','),
876
893
  '>'
877
894
  ),
878
895
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -2103,7 +2103,7 @@
2103
2103
  "fields": {},
2104
2104
  "children": {
2105
2105
  "multiple": true,
2106
- "required": true,
2106
+ "required": false,
2107
2107
  "types": [
2108
2108
  {
2109
2109
  "type": "lifetime",
@@ -4391,7 +4391,7 @@
4391
4391
  "fields": {},
4392
4392
  "children": {
4393
4393
  "multiple": true,
4394
- "required": true,
4394
+ "required": false,
4395
4395
  "types": [
4396
4396
  {
4397
4397
  "type": "_type",
@@ -4591,7 +4591,7 @@
4591
4591
  "fields": {},
4592
4592
  "children": {
4593
4593
  "multiple": true,
4594
- "required": true,
4594
+ "required": false,
4595
4595
  "types": [
4596
4596
  {
4597
4597
  "type": "_literal",
@@ -4774,7 +4774,7 @@
4774
4774
  "fields": {},
4775
4775
  "children": {
4776
4776
  "multiple": true,
4777
- "required": true,
4777
+ "required": false,
4778
4778
  "types": [
4779
4779
  {
4780
4780
  "type": "attribute_item",
@@ -5200,6 +5200,18 @@
5200
5200
  "type": "array_type",
5201
5201
  "named": true
5202
5202
  },
5203
+ {
5204
+ "type": "bounded_type",
5205
+ "named": true
5206
+ },
5207
+ {
5208
+ "type": "dynamic_type",
5209
+ "named": true
5210
+ },
5211
+ {
5212
+ "type": "function_type",
5213
+ "named": true
5214
+ },
5203
5215
  {
5204
5216
  "type": "generic_type",
5205
5217
  "named": true
@@ -5212,6 +5224,14 @@
5212
5224
  "type": "lifetime",
5213
5225
  "named": true
5214
5226
  },
5227
+ {
5228
+ "type": "macro_invocation",
5229
+ "named": true
5230
+ },
5231
+ {
5232
+ "type": "never_type",
5233
+ "named": true
5234
+ },
5215
5235
  {
5216
5236
  "type": "pointer_type",
5217
5237
  "named": true
@@ -5235,6 +5255,10 @@
5235
5255
  {
5236
5256
  "type": "type_identifier",
5237
5257
  "named": true
5258
+ },
5259
+ {
5260
+ "type": "unit_type",
5261
+ "named": true
5238
5262
  }
5239
5263
  ]
5240
5264
  }
Binary file
package/tree-sitter.json CHANGED
@@ -25,7 +25,7 @@
25
25
  }
26
26
  ],
27
27
  "metadata": {
28
- "version": "3.1.0",
28
+ "version": "3.1.2",
29
29
  "license": "MIT",
30
30
  "description": "Rust grammar for tree-sitter",
31
31
  "authors": [