@willbooster/tree-sitter-rust 3.0.4 → 3.1.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 +18 -1
- package/package.json +1 -1
- package/queries/highlights.scm +1 -0
- package/src/node-types.json +31 -0
- package/tree-sitter-rust.wasm +0 -0
- package/tree-sitter.json +5 -2
package/grammar.js
CHANGED
|
@@ -139,6 +139,11 @@ module.exports = grammar({
|
|
|
139
139
|
sym('_foreign_declaration_start'),
|
|
140
140
|
sym('_macro_metavariable_name'),
|
|
141
141
|
sym('_literal_suffix_start'),
|
|
142
|
+
sym('_frontmatter_start'),
|
|
143
|
+
sym('_frontmatter_header_end'),
|
|
144
|
+
sym('frontmatter_content'),
|
|
145
|
+
sym('_frontmatter_end'),
|
|
146
|
+
sym('_frontmatter_context'),
|
|
142
147
|
],
|
|
143
148
|
|
|
144
149
|
supertypes: ($) => [$._declaration_statement, $._expression, $._type, $._literal, $._literal_pattern, $._pattern],
|
|
@@ -181,7 +186,8 @@ module.exports = grammar({
|
|
|
181
186
|
word: ($) => $.identifier,
|
|
182
187
|
|
|
183
188
|
rules: {
|
|
184
|
-
source_file: ($) =>
|
|
189
|
+
source_file: ($) =>
|
|
190
|
+
seq(sym('_frontmatter_context'), optional($.shebang), optional($.frontmatter), repeat($._statement)),
|
|
185
191
|
|
|
186
192
|
_statement: ($) => choice($.expression_statement, $._declaration_statement),
|
|
187
193
|
|
|
@@ -1602,6 +1608,17 @@ module.exports = grammar({
|
|
|
1602
1608
|
_spaced_metavariable: () =>
|
|
1603
1609
|
prec.dynamic(1, seq('$', choice(sym('_macro_metavariable_name'), token(prec(1, nonAsciiOrRawMacroName))))),
|
|
1604
1610
|
metavariable: () => /\$(r#)?[_\p{XID_Start}][_\p{XID_Continue}]*/u,
|
|
1611
|
+
|
|
1612
|
+
frontmatter: ($) =>
|
|
1613
|
+
seq(
|
|
1614
|
+
sym('_frontmatter_start'),
|
|
1615
|
+
optional($.frontmatter_info_string),
|
|
1616
|
+
sym('_frontmatter_header_end'),
|
|
1617
|
+
sym('frontmatter_content'),
|
|
1618
|
+
sym('_frontmatter_end')
|
|
1619
|
+
),
|
|
1620
|
+
|
|
1621
|
+
frontmatter_info_string: () => token.immediate(/[_\p{XID_Start}][_.\p{XID_Continue}-]*/u),
|
|
1605
1622
|
},
|
|
1606
1623
|
});
|
|
1607
1624
|
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
package/src/node-types.json
CHANGED
|
@@ -2143,6 +2143,25 @@
|
|
|
2143
2143
|
"named": true,
|
|
2144
2144
|
"fields": {}
|
|
2145
2145
|
},
|
|
2146
|
+
{
|
|
2147
|
+
"type": "frontmatter",
|
|
2148
|
+
"named": true,
|
|
2149
|
+
"fields": {},
|
|
2150
|
+
"children": {
|
|
2151
|
+
"multiple": true,
|
|
2152
|
+
"required": true,
|
|
2153
|
+
"types": [
|
|
2154
|
+
{
|
|
2155
|
+
"type": "frontmatter_content",
|
|
2156
|
+
"named": true
|
|
2157
|
+
},
|
|
2158
|
+
{
|
|
2159
|
+
"type": "frontmatter_info_string",
|
|
2160
|
+
"named": true
|
|
2161
|
+
}
|
|
2162
|
+
]
|
|
2163
|
+
}
|
|
2164
|
+
},
|
|
2146
2165
|
{
|
|
2147
2166
|
"type": "function_item",
|
|
2148
2167
|
"named": true,
|
|
@@ -3849,6 +3868,10 @@
|
|
|
3849
3868
|
"type": "expression_statement",
|
|
3850
3869
|
"named": true
|
|
3851
3870
|
},
|
|
3871
|
+
{
|
|
3872
|
+
"type": "frontmatter",
|
|
3873
|
+
"named": true
|
|
3874
|
+
},
|
|
3852
3875
|
{
|
|
3853
3876
|
"type": "shebang",
|
|
3854
3877
|
"named": true
|
|
@@ -5576,6 +5599,14 @@
|
|
|
5576
5599
|
"type": "for",
|
|
5577
5600
|
"named": false
|
|
5578
5601
|
},
|
|
5602
|
+
{
|
|
5603
|
+
"type": "frontmatter_content",
|
|
5604
|
+
"named": true
|
|
5605
|
+
},
|
|
5606
|
+
{
|
|
5607
|
+
"type": "frontmatter_info_string",
|
|
5608
|
+
"named": true
|
|
5609
|
+
},
|
|
5579
5610
|
{
|
|
5580
5611
|
"type": "gen",
|
|
5581
5612
|
"named": false
|
package/tree-sitter-rust.wasm
CHANGED
|
Binary file
|
package/tree-sitter.json
CHANGED
|
@@ -18,11 +18,14 @@
|
|
|
18
18
|
"tags": [
|
|
19
19
|
"queries/tags.scm"
|
|
20
20
|
],
|
|
21
|
-
"injection-regex": "rust"
|
|
21
|
+
"injection-regex": "rust",
|
|
22
|
+
"external-files": [
|
|
23
|
+
"src/frontmatter.h"
|
|
24
|
+
]
|
|
22
25
|
}
|
|
23
26
|
],
|
|
24
27
|
"metadata": {
|
|
25
|
-
"version": "3.0
|
|
28
|
+
"version": "3.1.0",
|
|
26
29
|
"license": "MIT",
|
|
27
30
|
"description": "Rust grammar for tree-sitter",
|
|
28
31
|
"authors": [
|