@willbooster/tree-sitter-c 4.0.7 → 5.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 +6 -6
- package/grammar.js +3 -3
- package/package.json +4 -4
- package/src/node-types.json +13 -1
- package/tree-sitter-c.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-c)
|
|
10
10
|
|
|
11
11
|
C grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -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 2.0.0 or later, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x57420001`), 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';
|
|
@@ -65,12 +65,12 @@ adjacency, so the parameter scanner must skip them again to reach `(`.
|
|
|
65
65
|
|
|
66
66
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c) and on
|
|
67
67
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
68
|
-
fuzzed with
|
|
68
|
+
fuzzed with, at version 2.0.0 or later. No other runtime loads the parser:
|
|
69
69
|
|
|
70
70
|
```toml
|
|
71
71
|
[dependencies]
|
|
72
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
73
|
-
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "
|
|
72
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "2" }
|
|
73
|
+
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "5" }
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
```rust
|
|
@@ -96,7 +96,7 @@ not the ones this package ships with. Its first run downloads that CLI from the
|
|
|
96
96
|
with `cargo` (whose build runs the CMake that `mise.toml` pins) when the download fails or the release has no binary that runs here. Run other CLI commands through it as
|
|
97
97
|
well (e.g. `script/tree-sitter parse file.c`).
|
|
98
98
|
|
|
99
|
-
`bun run generate` records a fresh
|
|
99
|
+
`bun run generate` records a fresh generation profile from the applicable `test/corpus` cases and Git-tracked
|
|
100
100
|
files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`. After changing a grammar,
|
|
101
101
|
`tree-sitter.json`, a corpus case, or a tracked example,
|
|
102
102
|
regenerate and commit `src/`. Stage added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
|
package/grammar.js
CHANGED
|
@@ -726,6 +726,7 @@ module.exports = Object.assign(
|
|
|
726
726
|
enum_specifier: ($) =>
|
|
727
727
|
seq(
|
|
728
728
|
'enum',
|
|
729
|
+
repeat(choice($.attribute_specifier, $.attribute_declaration)),
|
|
729
730
|
choice(
|
|
730
731
|
seq(
|
|
731
732
|
field('name', $._type_identifier),
|
|
@@ -784,8 +785,7 @@ module.exports = Object.assign(
|
|
|
784
785
|
prec.right(
|
|
785
786
|
seq(
|
|
786
787
|
'struct',
|
|
787
|
-
|
|
788
|
-
optional($.ms_declspec_modifier),
|
|
788
|
+
repeat(choice($.attribute_specifier, $.attribute_declaration, $.ms_declspec_modifier)),
|
|
789
789
|
choice(
|
|
790
790
|
seq(field('name', $._type_identifier), field('body', optional($.field_declaration_list))),
|
|
791
791
|
field('body', $.field_declaration_list)
|
|
@@ -798,7 +798,7 @@ module.exports = Object.assign(
|
|
|
798
798
|
prec.right(
|
|
799
799
|
seq(
|
|
800
800
|
'union',
|
|
801
|
-
|
|
801
|
+
repeat(choice($.attribute_specifier, $.attribute_declaration, $.ms_declspec_modifier)),
|
|
802
802
|
choice(
|
|
803
803
|
seq(field('name', $._type_identifier), field('body', optional($.field_declaration_list))),
|
|
804
804
|
field('body', $.field_declaration_list)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "C grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@vitest/browser-playwright": "5.0.3",
|
|
51
51
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
52
52
|
"@willbooster/oxlint-config": "1.4.8",
|
|
53
|
-
"@willbooster/wb": "22.
|
|
54
|
-
"@willbooster/web-tree-sitter": "
|
|
53
|
+
"@willbooster/wb": "22.24.0",
|
|
54
|
+
"@willbooster/web-tree-sitter": "2.0.1",
|
|
55
55
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
56
56
|
"lefthook": "2.1.16",
|
|
57
57
|
"oxfmt": "0.71.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"wrangler": "4.147.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@willbooster/web-tree-sitter": "^
|
|
68
|
+
"@willbooster/web-tree-sitter": "^2.0.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"@willbooster/web-tree-sitter": {
|
package/src/node-types.json
CHANGED
|
@@ -1520,9 +1520,13 @@
|
|
|
1520
1520
|
}
|
|
1521
1521
|
},
|
|
1522
1522
|
"children": {
|
|
1523
|
-
"multiple":
|
|
1523
|
+
"multiple": true,
|
|
1524
1524
|
"required": false,
|
|
1525
1525
|
"types": [
|
|
1526
|
+
{
|
|
1527
|
+
"type": "attribute_declaration",
|
|
1528
|
+
"named": true
|
|
1529
|
+
},
|
|
1526
1530
|
{
|
|
1527
1531
|
"type": "attribute_specifier",
|
|
1528
1532
|
"named": true
|
|
@@ -3746,6 +3750,10 @@
|
|
|
3746
3750
|
"multiple": true,
|
|
3747
3751
|
"required": false,
|
|
3748
3752
|
"types": [
|
|
3753
|
+
{
|
|
3754
|
+
"type": "attribute_declaration",
|
|
3755
|
+
"named": true
|
|
3756
|
+
},
|
|
3749
3757
|
{
|
|
3750
3758
|
"type": "attribute_specifier",
|
|
3751
3759
|
"named": true
|
|
@@ -4195,6 +4203,10 @@
|
|
|
4195
4203
|
"multiple": true,
|
|
4196
4204
|
"required": false,
|
|
4197
4205
|
"types": [
|
|
4206
|
+
{
|
|
4207
|
+
"type": "attribute_declaration",
|
|
4208
|
+
"named": true
|
|
4209
|
+
},
|
|
4198
4210
|
{
|
|
4199
4211
|
"type": "attribute_specifier",
|
|
4200
4212
|
"named": true
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|