@willbooster/tree-sitter-rust 1.5.0 → 1.7.0

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
@@ -138,6 +138,8 @@ module.exports = grammar({
138
138
  ],
139
139
 
140
140
  conflicts: ($) => [
141
+ [$.function_modifiers, $.modified_trait_bound],
142
+ [$.function_modifiers, $.impl_item, $.modified_trait_bound],
141
143
  [$.const_item, $.function_modifiers],
142
144
  // Local ambiguity due to anonymous types:
143
145
  // See https://internals.rust-lang.org/t/pre-rfc-deprecating-anonymous-parameters/3710
@@ -523,7 +525,7 @@ module.exports = grammar({
523
525
  field('type_parameters', optional($.type_parameters)),
524
526
  optional(
525
527
  seq(
526
- optional('!'),
528
+ optional(choice('!', 'const', seq('~', 'const'))),
527
529
  field('trait', choice($._type_identifier, $.scoped_type_identifier, $.generic_type)),
528
530
  'for'
529
531
  )
@@ -563,6 +565,7 @@ module.exports = grammar({
563
565
 
564
566
  associated_type: ($) =>
565
567
  seq(
568
+ optional($.visibility_modifier),
566
569
  'type',
567
570
  field('name', $._type_identifier),
568
571
  field('type_parameters', optional($.type_parameters)),
@@ -577,6 +580,12 @@ module.exports = grammar({
577
580
 
578
581
  removed_trait_bound: ($) => seq('?', $._type),
579
582
 
583
+ modified_trait_bound: ($) =>
584
+ prec.dynamic(
585
+ -1,
586
+ seq(choice('const', seq('~', 'const'), seq('[', 'const', ']'), 'async'), field('type', $._type))
587
+ ),
588
+
580
589
  type_parameters: ($) =>
581
590
  prec(
582
591
  1,
@@ -680,6 +689,7 @@ module.exports = grammar({
680
689
  $.dynamic_type,
681
690
  $.bounded_type,
682
691
  $.removed_trait_bound,
692
+ $.modified_trait_bound,
683
693
  alias(choice(...primitiveTypes), $.primitive_type)
684
694
  ),
685
695
 
@@ -779,6 +789,7 @@ module.exports = grammar({
779
789
  $._type_identifier,
780
790
  $.scoped_type_identifier,
781
791
  $.removed_trait_bound,
792
+ $.modified_trait_bound,
782
793
  $.generic_type,
783
794
  $.function_type,
784
795
  $.tuple_type,
@@ -795,6 +806,7 @@ module.exports = grammar({
795
806
  'trait',
796
807
  choice(
797
808
  $.higher_ranked_trait_bound,
809
+ $.modified_trait_bound,
798
810
  $._type_identifier,
799
811
  $.scoped_type_identifier,
800
812
  $.generic_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -445,6 +445,10 @@
445
445
  "type": "metavariable",
446
446
  "named": true
447
447
  },
448
+ {
449
+ "type": "modified_trait_bound",
450
+ "named": true
451
+ },
448
452
  {
449
453
  "type": "never_type",
450
454
  "named": true
@@ -503,6 +507,10 @@
503
507
  "type": "generic_type",
504
508
  "named": true
505
509
  },
510
+ {
511
+ "type": "modified_trait_bound",
512
+ "named": true
513
+ },
506
514
  {
507
515
  "type": "removed_trait_bound",
508
516
  "named": true
@@ -670,9 +678,13 @@
670
678
  }
671
679
  },
672
680
  "children": {
673
- "multiple": false,
681
+ "multiple": true,
674
682
  "required": false,
675
683
  "types": [
684
+ {
685
+ "type": "visibility_modifier",
686
+ "named": true
687
+ },
676
688
  {
677
689
  "type": "where_clause",
678
690
  "named": true
@@ -1579,6 +1591,10 @@
1579
1591
  "type": "higher_ranked_trait_bound",
1580
1592
  "named": true
1581
1593
  },
1594
+ {
1595
+ "type": "modified_trait_bound",
1596
+ "named": true
1597
+ },
1582
1598
  {
1583
1599
  "type": "scoped_type_identifier",
1584
1600
  "named": true
@@ -3081,6 +3097,22 @@
3081
3097
  ]
3082
3098
  }
3083
3099
  },
3100
+ {
3101
+ "type": "modified_trait_bound",
3102
+ "named": true,
3103
+ "fields": {
3104
+ "type": {
3105
+ "multiple": false,
3106
+ "required": true,
3107
+ "types": [
3108
+ {
3109
+ "type": "_type",
3110
+ "named": true
3111
+ }
3112
+ ]
3113
+ }
3114
+ }
3115
+ },
3084
3116
  {
3085
3117
  "type": "mut_pattern",
3086
3118
  "named": true,
Binary file
package/tree-sitter.json CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "metadata": {
25
- "version": "1.5.0",
25
+ "version": "1.7.0",
26
26
  "license": "MIT",
27
27
  "description": "Rust grammar for tree-sitter",
28
28
  "authors": [