@willbooster/tree-sitter-rust 1.6.0 → 1.8.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
@@ -150,6 +152,8 @@ module.exports = grammar({
150
152
  [$.visibility_modifier],
151
153
  [$.visibility_modifier, $.scoped_identifier, $.scoped_type_identifier],
152
154
  [$.foreign_mod_item, $.function_modifiers],
155
+ [$.function_modifiers, $.impl_item, $.trait_item],
156
+ [$.function_modifiers, $.trait_item],
153
157
  ],
154
158
 
155
159
  word: ($) => $.identifier,
@@ -518,12 +522,13 @@ module.exports = grammar({
518
522
 
519
523
  impl_item: ($) =>
520
524
  seq(
525
+ optional('const'),
521
526
  optional('unsafe'),
522
527
  'impl',
523
528
  field('type_parameters', optional($.type_parameters)),
524
529
  optional(
525
530
  seq(
526
- optional('!'),
531
+ optional(choice('!', 'const', seq('~', 'const'))),
527
532
  field('trait', choice($._type_identifier, $.scoped_type_identifier, $.generic_type)),
528
533
  'for'
529
534
  )
@@ -536,6 +541,7 @@ module.exports = grammar({
536
541
  trait_item: ($) =>
537
542
  seq(
538
543
  optional($.visibility_modifier),
544
+ optional('const'),
539
545
  optional('unsafe'),
540
546
  'trait',
541
547
  field('name', $._type_identifier),
@@ -578,6 +584,12 @@ module.exports = grammar({
578
584
 
579
585
  removed_trait_bound: ($) => seq('?', $._type),
580
586
 
587
+ modified_trait_bound: ($) =>
588
+ prec.dynamic(
589
+ -1,
590
+ seq(choice('const', seq('~', 'const'), seq('[', 'const', ']'), 'async'), field('type', $._type))
591
+ ),
592
+
581
593
  type_parameters: ($) =>
582
594
  prec(
583
595
  1,
@@ -681,6 +693,7 @@ module.exports = grammar({
681
693
  $.dynamic_type,
682
694
  $.bounded_type,
683
695
  $.removed_trait_bound,
696
+ $.modified_trait_bound,
684
697
  alias(choice(...primitiveTypes), $.primitive_type)
685
698
  ),
686
699
 
@@ -780,6 +793,7 @@ module.exports = grammar({
780
793
  $._type_identifier,
781
794
  $.scoped_type_identifier,
782
795
  $.removed_trait_bound,
796
+ $.modified_trait_bound,
783
797
  $.generic_type,
784
798
  $.function_type,
785
799
  $.tuple_type,
@@ -796,6 +810,7 @@ module.exports = grammar({
796
810
  'trait',
797
811
  choice(
798
812
  $.higher_ranked_trait_bound,
813
+ $.modified_trait_bound,
799
814
  $._type_identifier,
800
815
  $.scoped_type_identifier,
801
816
  $.generic_type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "1.6.0",
3
+ "version": "1.8.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
@@ -1583,6 +1591,10 @@
1583
1591
  "type": "higher_ranked_trait_bound",
1584
1592
  "named": true
1585
1593
  },
1594
+ {
1595
+ "type": "modified_trait_bound",
1596
+ "named": true
1597
+ },
1586
1598
  {
1587
1599
  "type": "scoped_type_identifier",
1588
1600
  "named": true
@@ -3085,6 +3097,22 @@
3085
3097
  ]
3086
3098
  }
3087
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
+ },
3088
3116
  {
3089
3117
  "type": "mut_pattern",
3090
3118
  "named": true,
Binary file
package/tree-sitter.json CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "metadata": {
25
- "version": "1.6.0",
25
+ "version": "1.8.0",
26
26
  "license": "MIT",
27
27
  "description": "Rust grammar for tree-sitter",
28
28
  "authors": [