@willbooster/tree-sitter-c 16.0.0 → 17.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 +7 -6
- package/package.json +17 -20
- 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,10 +18,11 @@ 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 14.0.0 or later within 14.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter generator (`0x5742000a`), 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';
|
|
25
|
+
|
|
25
26
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
26
27
|
|
|
27
28
|
await Parser.init();
|
|
@@ -34,9 +35,9 @@ const tree = parser.parse('int main(void) { return 0; }\n');
|
|
|
34
35
|
In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
|
|
35
36
|
|
|
36
37
|
```js
|
|
38
|
+
import cUrl from '@willbooster/tree-sitter-c/tree-sitter-c.wasm?url';
|
|
37
39
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
38
40
|
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
39
|
-
import cUrl from '@willbooster/tree-sitter-c/tree-sitter-c.wasm?url';
|
|
40
41
|
|
|
41
42
|
await Parser.init({ locateFile: () => runtimeUrl });
|
|
42
43
|
const parser = new Parser();
|
|
@@ -47,9 +48,9 @@ Cloudflare Workers do not allow compiling Wasm at run time, so import both `.was
|
|
|
47
48
|
Node.js compatibility:
|
|
48
49
|
|
|
49
50
|
```js
|
|
51
|
+
import c from '@willbooster/tree-sitter-c/tree-sitter-c.wasm';
|
|
50
52
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
51
53
|
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
52
|
-
import c from '@willbooster/tree-sitter-c/tree-sitter-c.wasm';
|
|
53
54
|
|
|
54
55
|
await Parser.init({ wasmModule: runtime });
|
|
55
56
|
const parser = new Parser();
|
|
@@ -118,11 +119,11 @@ arrays, parenthesized/function declarators, initializers and multiple declarator
|
|
|
118
119
|
|
|
119
120
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-c) and on
|
|
120
121
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
121
|
-
fuzzed with, at version
|
|
122
|
+
fuzzed with, at version 14.0.0 or later within 14.x. No other runtime loads the parser:
|
|
122
123
|
|
|
123
124
|
```toml
|
|
124
125
|
[dependencies]
|
|
125
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
126
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "14.0.0" }
|
|
126
127
|
tree-sitter-c = { package = "willbooster-tree-sitter-c", version = "16" }
|
|
127
128
|
```
|
|
128
129
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-c",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "C grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"c",
|
|
6
7
|
"incremental",
|
|
7
8
|
"parsing",
|
|
8
|
-
"tree-sitter"
|
|
9
|
-
"c"
|
|
9
|
+
"tree-sitter"
|
|
10
10
|
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "WillBooster Inc.",
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
13
15
|
"url": "git+https://github.com/WillBooster/tree-sitter-c.git"
|
|
14
16
|
},
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"author": "WillBooster Inc.",
|
|
17
17
|
"files": [
|
|
18
18
|
"grammar.js",
|
|
19
19
|
"types/*",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"src/conditionalMacro.h",
|
|
30
30
|
"src/scanner.c"
|
|
31
31
|
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
},
|
|
32
36
|
"scripts": {
|
|
33
37
|
"build-wasm": "script/generate --build-wasm",
|
|
34
38
|
"build/ci": "bun run build-wasm",
|
|
@@ -51,32 +55,25 @@
|
|
|
51
55
|
"devDependencies": {
|
|
52
56
|
"@tsconfig/bun": "1.0.11",
|
|
53
57
|
"@types/bun": "1.4.3",
|
|
54
|
-
"@vitest/browser-playwright": "5.0.
|
|
55
|
-
"@willbooster/
|
|
56
|
-
"@willbooster/
|
|
57
|
-
"@willbooster/
|
|
58
|
-
"@willbooster/web-tree-sitter": "13.0.0",
|
|
58
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
59
|
+
"@willbooster/oxlint-config": "1.4.9",
|
|
60
|
+
"@willbooster/wb": "22.29.3",
|
|
61
|
+
"@willbooster/web-tree-sitter": "14.0.2",
|
|
59
62
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
60
63
|
"lefthook": "2.2.2",
|
|
61
|
-
"oxfmt": "0.73.0",
|
|
62
64
|
"oxlint": "1.88.0",
|
|
63
65
|
"oxlint-tsgolint": "7.0.2004",
|
|
64
|
-
"playwright": "1.64.
|
|
66
|
+
"playwright": "1.64.1",
|
|
65
67
|
"semantic-release": "25.0.9",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"wrangler": "4.149.0"
|
|
68
|
+
"vitest": "5.0.5",
|
|
69
|
+
"wrangler": "4.151.1"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
|
-
"@willbooster/web-tree-sitter": "^
|
|
72
|
+
"@willbooster/web-tree-sitter": "^14.0.0"
|
|
72
73
|
},
|
|
73
74
|
"peerDependenciesMeta": {
|
|
74
75
|
"@willbooster/web-tree-sitter": {
|
|
75
76
|
"optional": true
|
|
76
77
|
}
|
|
77
|
-
},
|
|
78
|
-
"publishConfig": {
|
|
79
|
-
"access": "public",
|
|
80
|
-
"registry": "https://registry.npmjs.org/"
|
|
81
78
|
}
|
|
82
79
|
}
|
package/tree-sitter-c.wasm
CHANGED
|
Binary file
|