@willbooster/tree-sitter-c 14.0.1 → 15.0.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/README.md +4 -4
- package/grammar.js +14 -7
- 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],
|
|
@@ -213,7 +211,9 @@ module.exports = Object.assign(
|
|
|
213
211
|
$.statement,
|
|
214
212
|
$._single_noncompound_statement,
|
|
215
213
|
$._non_case_statement,
|
|
214
|
+
$._unattributed_non_case_statement,
|
|
216
215
|
$._single_non_case_statement,
|
|
216
|
+
$._single_unattributed_non_case_statement,
|
|
217
217
|
$._case_body_statement,
|
|
218
218
|
$._case_body_unattributed_statement,
|
|
219
219
|
$._case_label_tail,
|
|
@@ -1079,11 +1079,13 @@ module.exports = Object.assign(
|
|
|
1079
1079
|
repeat($.attribute_specifier)
|
|
1080
1080
|
),
|
|
1081
1081
|
|
|
1082
|
-
attributed_statement: ($) =>
|
|
1082
|
+
attributed_statement: ($) =>
|
|
1083
|
+
seq(repeat1($.attribute_declaration), alias($._unattributed_non_case_statement, $.statement)),
|
|
1083
1084
|
|
|
1084
1085
|
statement: ($) => choice($.case_statement, alias($._non_case_statement, $.statement)),
|
|
1085
1086
|
|
|
1086
|
-
_non_case_statement: ($) =>
|
|
1087
|
+
_non_case_statement: ($) =>
|
|
1088
|
+
choice($.attributed_statement, alias($._unattributed_non_case_statement, $.statement)),
|
|
1087
1089
|
|
|
1088
1090
|
_unattributed_non_case_statement: ($) => choice($.labeled_statement, $._unlabeled_non_case_statement),
|
|
1089
1091
|
|
|
@@ -1155,6 +1157,12 @@ module.exports = Object.assign(
|
|
|
1155
1157
|
choice(alias($._single_case_statement, $.case_statement), alias($._single_non_case_statement, $.statement)),
|
|
1156
1158
|
|
|
1157
1159
|
_single_non_case_statement: ($) =>
|
|
1160
|
+
choice(
|
|
1161
|
+
alias($._single_unattributed_non_case_statement, $.statement),
|
|
1162
|
+
alias($._single_attributed_statement, $.attributed_statement)
|
|
1163
|
+
),
|
|
1164
|
+
|
|
1165
|
+
_single_unattributed_non_case_statement: ($) =>
|
|
1158
1166
|
choice(
|
|
1159
1167
|
$.expression_statement,
|
|
1160
1168
|
$.switch_statement,
|
|
@@ -1168,8 +1176,7 @@ module.exports = Object.assign(
|
|
|
1168
1176
|
$.if_statement,
|
|
1169
1177
|
$.while_statement,
|
|
1170
1178
|
$.do_statement,
|
|
1171
|
-
$.for_statement
|
|
1172
|
-
alias($._single_attributed_statement, $.attributed_statement)
|
|
1179
|
+
$.for_statement
|
|
1173
1180
|
),
|
|
1174
1181
|
|
|
1175
1182
|
_single_case_statement: ($) =>
|
|
@@ -1207,7 +1214,7 @@ module.exports = Object.assign(
|
|
|
1207
1214
|
_single_attributed_statement: ($) =>
|
|
1208
1215
|
seq(
|
|
1209
1216
|
repeat1($.attribute_declaration),
|
|
1210
|
-
choice($.compound_statement, alias($.
|
|
1217
|
+
choice($.compound_statement, alias($._single_unattributed_non_case_statement, $.statement))
|
|
1211
1218
|
),
|
|
1212
1219
|
|
|
1213
1220
|
case_statement: ($) =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
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
|