@willbooster/tree-sitter-c 14.0.1 → 15.0.1
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/README.md +4 -4
- package/grammar.js +19 -6
- package/package.json +3 -3
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ This fork fixes parsing bugs and raises conformance with the ISO C standard
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
20
|
The npm package ships `tree-sitter-c.wasm` for
|
|
21
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
21
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 10.0.2 or later within 10.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x57420007`), so it loads only with that runtime; upstream tree-sitter runtimes reject it. In Node.js and Bun, load the grammar from its path:
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
import { fileURLToPath } from 'node:url';
|
|
@@ -118,12 +118,12 @@ arrays, parenthesized/function declarators, initializers and multiple declarator
|
|
|
118
118
|
|
|
119
119
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c) and on
|
|
120
120
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
121
|
-
fuzzed with, at version
|
|
121
|
+
fuzzed with, at version 10.0.2 or later within 10.x. No other runtime loads the parser:
|
|
122
122
|
|
|
123
123
|
```toml
|
|
124
124
|
[dependencies]
|
|
125
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
126
|
-
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "
|
|
125
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "10.0.2" }
|
|
126
|
+
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "15" }
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
```rust
|
package/grammar.js
CHANGED
|
@@ -137,9 +137,7 @@ module.exports = Object.assign(
|
|
|
137
137
|
[$.type_definition, $._type_declarator],
|
|
138
138
|
[$.type_definition, $.sized_type_specifier],
|
|
139
139
|
[$.type_definition, $._sized_bit_int_specifier],
|
|
140
|
-
[$.attributed_statement],
|
|
141
140
|
[$.case_statement],
|
|
142
|
-
[$._single_attributed_statement],
|
|
143
141
|
[$._statement_declaration_modifiers, $._case_body_attributed_statement, $._case_label_attributes],
|
|
144
142
|
[$._statement_declaration_modifiers, $.attributed_statement, $.case_statement],
|
|
145
143
|
[$.enum_specifier],
|
|
@@ -196,6 +194,9 @@ module.exports = Object.assign(
|
|
|
196
194
|
extras: ($) => [$.pragma_operator, /\s|\\(?:\r\n?|\n\r?)/, $.comment],
|
|
197
195
|
|
|
198
196
|
inline: ($) => [
|
|
197
|
+
$._unattributed_non_case_statement,
|
|
198
|
+
$._single_unattributed_non_case_statement,
|
|
199
|
+
$._unlabeled_non_case_statement,
|
|
199
200
|
$._non_identifier_type_specifier,
|
|
200
201
|
$._non_macro_declaration_modifiers,
|
|
201
202
|
$._unattributed_declarator,
|
|
@@ -213,7 +214,9 @@ module.exports = Object.assign(
|
|
|
213
214
|
$.statement,
|
|
214
215
|
$._single_noncompound_statement,
|
|
215
216
|
$._non_case_statement,
|
|
217
|
+
$._attributed_body_statement,
|
|
216
218
|
$._single_non_case_statement,
|
|
219
|
+
$._single_attributed_body_statement,
|
|
217
220
|
$._case_body_statement,
|
|
218
221
|
$._case_body_unattributed_statement,
|
|
219
222
|
$._case_label_tail,
|
|
@@ -1079,7 +1082,10 @@ module.exports = Object.assign(
|
|
|
1079
1082
|
repeat($.attribute_specifier)
|
|
1080
1083
|
),
|
|
1081
1084
|
|
|
1082
|
-
attributed_statement: ($) =>
|
|
1085
|
+
attributed_statement: ($) =>
|
|
1086
|
+
seq(repeat1($.attribute_declaration), alias($._attributed_body_statement, $.statement)),
|
|
1087
|
+
|
|
1088
|
+
_attributed_body_statement: ($) => $._unattributed_non_case_statement,
|
|
1083
1089
|
|
|
1084
1090
|
statement: ($) => choice($.case_statement, alias($._non_case_statement, $.statement)),
|
|
1085
1091
|
|
|
@@ -1155,6 +1161,12 @@ module.exports = Object.assign(
|
|
|
1155
1161
|
choice(alias($._single_case_statement, $.case_statement), alias($._single_non_case_statement, $.statement)),
|
|
1156
1162
|
|
|
1157
1163
|
_single_non_case_statement: ($) =>
|
|
1164
|
+
choice(
|
|
1165
|
+
$._single_unattributed_non_case_statement,
|
|
1166
|
+
alias($._single_attributed_statement, $.attributed_statement)
|
|
1167
|
+
),
|
|
1168
|
+
|
|
1169
|
+
_single_unattributed_non_case_statement: ($) =>
|
|
1158
1170
|
choice(
|
|
1159
1171
|
$.expression_statement,
|
|
1160
1172
|
$.switch_statement,
|
|
@@ -1168,8 +1180,7 @@ module.exports = Object.assign(
|
|
|
1168
1180
|
$.if_statement,
|
|
1169
1181
|
$.while_statement,
|
|
1170
1182
|
$.do_statement,
|
|
1171
|
-
$.for_statement
|
|
1172
|
-
alias($._single_attributed_statement, $.attributed_statement)
|
|
1183
|
+
$.for_statement
|
|
1173
1184
|
),
|
|
1174
1185
|
|
|
1175
1186
|
_single_case_statement: ($) =>
|
|
@@ -1207,9 +1218,11 @@ module.exports = Object.assign(
|
|
|
1207
1218
|
_single_attributed_statement: ($) =>
|
|
1208
1219
|
seq(
|
|
1209
1220
|
repeat1($.attribute_declaration),
|
|
1210
|
-
choice($.compound_statement, alias($.
|
|
1221
|
+
choice($.compound_statement, alias($._single_attributed_body_statement, $.statement))
|
|
1211
1222
|
),
|
|
1212
1223
|
|
|
1224
|
+
_single_attributed_body_statement: ($) => $._single_unattributed_non_case_statement,
|
|
1225
|
+
|
|
1213
1226
|
case_statement: ($) =>
|
|
1214
1227
|
prec.dynamic(
|
|
1215
1228
|
1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"description": "C grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
56
56
|
"@willbooster/oxlint-config": "1.4.8",
|
|
57
57
|
"@willbooster/wb": "22.26.2",
|
|
58
|
-
"@willbooster/web-tree-sitter": "
|
|
58
|
+
"@willbooster/web-tree-sitter": "10.0.2",
|
|
59
59
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
60
60
|
"lefthook": "2.2.2",
|
|
61
61
|
"oxfmt": "0.73.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"wrangler": "4.149.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@willbooster/web-tree-sitter": "^
|
|
71
|
+
"@willbooster/web-tree-sitter": "^10.0.2"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|