@willbooster/tree-sitter-rust 3.0.2 → 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 +17 -6
- package/package.json +1 -1
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +1 -1
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: () =>
|
|
@@ -1508,14 +1513,20 @@ module.exports = grammar({
|
|
|
1508
1513
|
optional('b'),
|
|
1509
1514
|
"'",
|
|
1510
1515
|
optional(
|
|
1511
|
-
choice(
|
|
1516
|
+
choice(
|
|
1517
|
+
seq('\\', choice(/[^xu]/, /u[0-9a-fA-F]{4}/, /u\{[0-9a-fA-F][0-9a-fA-F_]*\}/, /x[0-9a-fA-F]{2}/)),
|
|
1518
|
+
/[^\\']/
|
|
1519
|
+
)
|
|
1512
1520
|
),
|
|
1513
|
-
"'"
|
|
1521
|
+
"'",
|
|
1522
|
+
optional(literalSuffix)
|
|
1514
1523
|
)
|
|
1515
1524
|
),
|
|
1516
1525
|
|
|
1517
1526
|
escape_sequence: () =>
|
|
1518
|
-
token.immediate(
|
|
1527
|
+
token.immediate(
|
|
1528
|
+
seq('\\', choice(/[^xu]/, /u[0-9a-fA-F]{4}/, /u\{[0-9a-fA-F][0-9a-fA-F_]*\}/, /x[0-9a-fA-F]{2}/))
|
|
1529
|
+
),
|
|
1519
1530
|
|
|
1520
1531
|
boolean_literal: () => choice('true', 'false'),
|
|
1521
1532
|
|
|
@@ -1603,7 +1614,7 @@ function macroRepetitionSeparator(start, content, end) {
|
|
|
1603
1614
|
return choice(
|
|
1604
1615
|
/[^\s/+*?$"][^/+*?$"]*|\/(?:[^/*+*?$"][^/+*?$"]*)?|\$/,
|
|
1605
1616
|
/[bc]?"(?:[^"\\]|\\[\s\S])*"/,
|
|
1606
|
-
/b?'(?:\\(?:[^xu]|u[0-9a-fA-F]{4}|u\{[0-9a-fA-F]
|
|
1617
|
+
/b?'(?:\\(?:[^xu]|u[0-9a-fA-F]{4}|u\{[0-9a-fA-F][0-9a-fA-F_]*\}|x[0-9a-fA-F]{2})|[^\\'])'/,
|
|
1607
1618
|
seq(start, content, end)
|
|
1608
1619
|
);
|
|
1609
1620
|
}
|
package/package.json
CHANGED
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|