@willbooster/tree-sitter-rust 3.0.3 → 3.0.4

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
@@ -32,6 +32,8 @@ const PREC = {
32
32
  closure: -1,
33
33
  };
34
34
 
35
+ const literalSuffix = /[_\p{XID_Start}][_\p{XID_Continue}]*/u;
36
+
35
37
  const numericSuffixWithoutExponent = new RegExp(String.raw`[\p{XID_Start}--[eE]][_\p{XID_Continue}]*`, 'v');
36
38
  const zeroNumericSuffix = new RegExp(String.raw`[\p{XID_Start}--[eEbox]][_\p{XID_Continue}]*`, 'v');
37
39
  const hexadecimalSuffix = new RegExp(String.raw`[\p{XID_Start}--[a-fA-F]][_\p{XID_Continue}]*`, 'v');
@@ -136,6 +138,7 @@ module.exports = grammar({
136
138
  sym('_foreign_declaration_context'),
137
139
  sym('_foreign_declaration_start'),
138
140
  sym('_macro_metavariable_name'),
141
+ sym('_literal_suffix_start'),
139
142
  ],
140
143
 
141
144
  supertypes: ($) => [$._declaration_statement, $._expression, $._type, $._literal, $._literal_pattern, $._pattern],
@@ -1492,14 +1495,16 @@ module.exports = grammar({
1492
1495
  seq(
1493
1496
  alias(/[bc]?"/, '"'),
1494
1497
  repeat(choice($.escape_sequence, sym('string_content'))),
1495
- alias(sym('string_close'), '"')
1498
+ alias(sym('string_close'), '"'),
1499
+ optional(seq(sym('_literal_suffix_start'), token.immediate(prec(1, literalSuffix))))
1496
1500
  ),
1497
1501
 
1498
1502
  raw_string_literal: () =>
1499
1503
  seq(
1500
1504
  sym('_raw_string_literal_start'),
1501
1505
  alias(sym('_raw_string_literal_content'), sym('string_content')),
1502
- sym('_raw_string_literal_end')
1506
+ sym('_raw_string_literal_end'),
1507
+ optional(seq(sym('_literal_suffix_start'), token.immediate(prec(1, literalSuffix))))
1503
1508
  ),
1504
1509
 
1505
1510
  char_literal: () =>
@@ -1513,7 +1518,8 @@ module.exports = grammar({
1513
1518
  /[^\\']/
1514
1519
  )
1515
1520
  ),
1516
- "'"
1521
+ "'",
1522
+ optional(literalSuffix)
1517
1523
  )
1518
1524
  ),
1519
1525
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-rust",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "Rust grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
Binary file
package/tree-sitter.json CHANGED
@@ -22,7 +22,7 @@
22
22
  }
23
23
  ],
24
24
  "metadata": {
25
- "version": "3.0.3",
25
+ "version": "3.0.4",
26
26
  "license": "MIT",
27
27
  "description": "Rust grammar for tree-sitter",
28
28
  "authors": [