@willbooster/tree-sitter-rust 3.1.1 → 3.1.3

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
@@ -572,6 +572,7 @@ module.exports = grammar({
572
572
  $._type_identifier,
573
573
  $.scoped_type_identifier,
574
574
  $.generic_type,
575
+ alias($._generic_type_turbofish, $.generic_type),
575
576
  $.reference_type,
576
577
  $.pointer_type,
577
578
  $.tuple_type,
@@ -604,7 +605,8 @@ module.exports = grammar({
604
605
  $._type_identifier,
605
606
  alias(choice(...primitiveTypes), sym('type_identifier')),
606
607
  $.scoped_type_identifier,
607
- $.generic_type
608
+ $.generic_type,
609
+ alias($._generic_type_turbofish, $.generic_type)
608
610
  )
609
611
  ),
610
612
  'for'
@@ -676,14 +678,18 @@ module.exports = grammar({
676
678
  1,
677
679
  seq(
678
680
  '<',
679
- sepBy1(
680
- ',',
681
+ optional(
681
682
  seq(
682
- repeat($.attribute_item),
683
- choice($.metavariable, $.type_parameter, $.lifetime_parameter, $.const_parameter)
683
+ sepBy1(
684
+ ',',
685
+ seq(
686
+ repeat($.attribute_item),
687
+ choice($.metavariable, $.type_parameter, $.lifetime_parameter, $.const_parameter)
688
+ )
689
+ ),
690
+ optional(',')
684
691
  )
685
692
  ),
686
- optional(','),
687
693
  '>'
688
694
  )
689
695
  ),
@@ -763,6 +769,7 @@ module.exports = grammar({
763
769
  $.metavariable,
764
770
  $.pointer_type,
765
771
  $.generic_type,
772
+ alias($._generic_type_turbofish, $.generic_type),
766
773
  $.scoped_type_identifier,
767
774
  $.tuple_type,
768
775
  $.unit_type,
@@ -786,7 +793,7 @@ module.exports = grammar({
786
793
 
787
794
  array_type: ($) => seq('[', field('element', $._type), optional(seq(';', field('length', $._expression))), ']'),
788
795
 
789
- for_lifetimes: ($) => seq('for', '<', sepBy1(',', $.lifetime), optional(','), '>'),
796
+ for_lifetimes: ($) => seq('for', '<', optional(seq(sepBy1(',', $.lifetime), optional(','))), '>'),
790
797
 
791
798
  function_type: ($) =>
792
799
  seq(
@@ -874,14 +881,18 @@ module.exports = grammar({
874
881
  type_arguments: ($) =>
875
882
  seq(
876
883
  token(prec(1, '<')),
877
- sepBy1(
878
- ',',
879
- choice(
880
- seq(choice($._type, $.type_binding, $.lifetime, $._literal, $.block), optional($.trait_bounds)),
881
- prec(1, seq(alias(choice(...primitiveTypes), sym('type_identifier')), $.trait_bounds))
884
+ optional(
885
+ seq(
886
+ sepBy1(
887
+ ',',
888
+ choice(
889
+ seq(choice($._type, $.type_binding, $.lifetime, $._literal, $.block), optional($.trait_bounds)),
890
+ prec(1, seq(alias(choice(...primitiveTypes), sym('type_identifier')), $.trait_bounds))
891
+ )
892
+ ),
893
+ optional(',')
882
894
  )
883
895
  ),
884
- optional(','),
885
896
  '>'
886
897
  ),
887
898
 
@@ -914,6 +925,7 @@ module.exports = grammar({
914
925
  $.removed_trait_bound,
915
926
  $.modified_trait_bound,
916
927
  $.generic_type,
928
+ alias($._generic_type_turbofish, $.generic_type),
917
929
  $.function_type,
918
930
  $.tuple_type,
919
931
  $.bounded_type
@@ -934,6 +946,7 @@ module.exports = grammar({
934
946
  alias(choice(...primitiveTypes), sym('type_identifier')),
935
947
  $.scoped_type_identifier,
936
948
  $.generic_type,
949
+ alias($._generic_type_turbofish, $.generic_type),
937
950
  $.function_type,
938
951
  $.tuple_type
939
952
  )
@@ -1628,6 +1641,23 @@ module.exports = grammar({
1628
1641
  ),
1629
1642
 
1630
1643
  frontmatter_info_string: () => token.immediate(/[_\p{XID_Start}][_.\p{XID_Continue}-]*/u),
1644
+ _generic_type_turbofish: ($) =>
1645
+ prec(
1646
+ 1,
1647
+ seq(
1648
+ field(
1649
+ 'type',
1650
+ choice(
1651
+ $._type_identifier,
1652
+ alias(choice(...primitiveTypes), sym('type_identifier')),
1653
+ alias(choice(...reservedIdentifiers), $.identifier),
1654
+ $.scoped_type_identifier
1655
+ )
1656
+ ),
1657
+ '::',
1658
+ field('type_arguments', $.type_arguments)
1659
+ )
1660
+ ),
1631
1661
  },
1632
1662
  });
1633
1663
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
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",
@@ -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",
Binary file
package/tree-sitter.json CHANGED
@@ -25,7 +25,7 @@
25
25
  }
26
26
  ],
27
27
  "metadata": {
28
- "version": "3.1.1",
28
+ "version": "3.1.3",
29
29
  "license": "MIT",
30
30
  "description": "Rust grammar for tree-sitter",
31
31
  "authors": [