@willbooster/tree-sitter-cpp 4.0.0 → 5.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 +6 -6
- package/package.json +4 -4
- package/queries/c/highlights.scm +25 -0
- package/queries/highlights.scm +0 -2
- package/src/node-types.json +72 -72
- package/tree-sitter-cpp.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ This fork fixes parsing bugs and raises conformance with the ISO C++ standard
|
|
|
20
20
|
The npm package ships `tree-sitter-cpp.wasm` for
|
|
21
21
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
22
22
|
browsers, and Cloudflare Workers. The parser carries the ABI number of the WillBooster/tree-sitter fork, so it loads
|
|
23
|
-
only with that runtime, version
|
|
23
|
+
only with that runtime, version 4.0.2 or later within major version 4; upstream's runtime rejects it. Install both:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
26
|
npm install @willbooster/tree-sitter-cpp @willbooster/web-tree-sitter
|
|
@@ -68,12 +68,12 @@ grammar's in `queries/` and, in `queries/c/`, the highlights of the C grammar it
|
|
|
68
68
|
|
|
69
69
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-cpp) and on
|
|
70
70
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
71
|
-
fuzzed with. The parser loads only with that runtime, version
|
|
71
|
+
fuzzed with. The parser loads only with that runtime, version 4.0.2 or later within major version 4:
|
|
72
72
|
|
|
73
73
|
```toml
|
|
74
74
|
[dependencies]
|
|
75
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
76
|
-
tree-sitter-cpp = { package = "willbooster-tree-sitter-cpp", version = "
|
|
75
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "4.0.2" }
|
|
76
|
+
tree-sitter-cpp = { package = "willbooster-tree-sitter-cpp", version = "5" }
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
```rust
|
|
@@ -125,8 +125,8 @@ and the release build regenerate the parsers before compiling them.
|
|
|
125
125
|
keyword-led arguments that make `Foo* p(nullptr);` a variable start only with such keywords or `this`, which starts
|
|
126
126
|
a parameter only when a declaration follows it;
|
|
127
127
|
- a check (`test/unit/queries.test.ts`) that the queries `tree-sitter.json` lists compile against the grammar, are
|
|
128
|
-
published in the npm package and the crate, and that
|
|
129
|
-
@willbooster/tree-sitter-c. After updating that dependency, run `script/copy-c-queries` and `script/copy-c-scanner`.
|
|
128
|
+
published in the npm package and the crate, and that the vendored scanner headers match the installed
|
|
129
|
+
@willbooster/tree-sitter-c. The copied C highlight query excludes the C-only `_Countof` capture. After updating that dependency, run `script/copy-c-queries` and `script/copy-c-scanner`.
|
|
130
130
|
The scanner headers are verbatim copies from that package; their generator paths refer to the C repository.
|
|
131
131
|
Review the C scanner dispatch and external-token order against `src/scanner.c` when updating the dependency;
|
|
132
132
|
- a check (`test/unit/runtimeVersion.test.ts`) that `@willbooster/web-tree-sitter` in `package.json` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-cpp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "C++ grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@vitest/browser-playwright": "5.0.3",
|
|
46
46
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
47
47
|
"@willbooster/oxlint-config": "1.4.8",
|
|
48
|
-
"@willbooster/tree-sitter-c": "
|
|
48
|
+
"@willbooster/tree-sitter-c": "6.0.0",
|
|
49
49
|
"@willbooster/wb": "22.26.1",
|
|
50
|
-
"@willbooster/web-tree-sitter": "
|
|
50
|
+
"@willbooster/web-tree-sitter": "4.0.2",
|
|
51
51
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
52
52
|
"lefthook": "2.2.1",
|
|
53
53
|
"oxfmt": "0.72.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"wrangler": "4.149.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^
|
|
64
|
+
"@willbooster/web-tree-sitter": "^4.0.2"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@willbooster/web-tree-sitter": {
|
package/queries/c/highlights.scm
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
((storage_class_specifier) @keyword
|
|
7
7
|
(#eq? @keyword "auto"))
|
|
8
|
+
"_Generic" @keyword
|
|
8
9
|
"_Thread_local" @keyword
|
|
9
10
|
"break" @keyword
|
|
10
11
|
"case" @keyword
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"enum" @keyword
|
|
17
18
|
"extern" @keyword
|
|
18
19
|
"for" @keyword
|
|
20
|
+
"goto" @keyword
|
|
19
21
|
"if" @keyword
|
|
20
22
|
"inline" @keyword
|
|
21
23
|
"return" @keyword
|
|
@@ -30,6 +32,8 @@
|
|
|
30
32
|
|
|
31
33
|
"#define" @keyword
|
|
32
34
|
"#elif" @keyword
|
|
35
|
+
"#elifdef" @keyword
|
|
36
|
+
"#elifndef" @keyword
|
|
33
37
|
"#else" @keyword
|
|
34
38
|
"#endif" @keyword
|
|
35
39
|
"#if" @keyword
|
|
@@ -54,6 +58,27 @@
|
|
|
54
58
|
"==" @operator
|
|
55
59
|
">" @operator
|
|
56
60
|
"||" @operator
|
|
61
|
+
"*=" @operator
|
|
62
|
+
"/=" @operator
|
|
63
|
+
"%=" @operator
|
|
64
|
+
"<<=" @operator
|
|
65
|
+
">>=" @operator
|
|
66
|
+
"&=" @operator
|
|
67
|
+
"|=" @operator
|
|
68
|
+
"^=" @operator
|
|
69
|
+
"/" @operator
|
|
70
|
+
"%" @operator
|
|
71
|
+
"<=" @operator
|
|
72
|
+
">=" @operator
|
|
73
|
+
"<<" @operator
|
|
74
|
+
">>" @operator
|
|
75
|
+
"|" @operator
|
|
76
|
+
"^" @operator
|
|
77
|
+
"~" @operator
|
|
78
|
+
"!" @operator
|
|
79
|
+
|
|
80
|
+
(conditional_expression
|
|
81
|
+
["?" ":"] @operator)
|
|
57
82
|
|
|
58
83
|
"." @delimiter
|
|
59
84
|
";" @delimiter
|
package/queries/highlights.scm
CHANGED
package/src/node-types.json
CHANGED
|
@@ -1442,27 +1442,7 @@
|
|
|
1442
1442
|
"required": false,
|
|
1443
1443
|
"types": [
|
|
1444
1444
|
{
|
|
1445
|
-
"type": "
|
|
1446
|
-
"named": true
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
"type": "break_statement",
|
|
1450
|
-
"named": true
|
|
1451
|
-
},
|
|
1452
|
-
{
|
|
1453
|
-
"type": "co_return_statement",
|
|
1454
|
-
"named": true
|
|
1455
|
-
},
|
|
1456
|
-
{
|
|
1457
|
-
"type": "co_yield_statement",
|
|
1458
|
-
"named": true
|
|
1459
|
-
},
|
|
1460
|
-
{
|
|
1461
|
-
"type": "compound_statement",
|
|
1462
|
-
"named": true
|
|
1463
|
-
},
|
|
1464
|
-
{
|
|
1465
|
-
"type": "continue_statement",
|
|
1445
|
+
"type": "attribute_declaration",
|
|
1466
1446
|
"named": true
|
|
1467
1447
|
},
|
|
1468
1448
|
{
|
|
@@ -1470,68 +1450,20 @@
|
|
|
1470
1450
|
"named": true
|
|
1471
1451
|
},
|
|
1472
1452
|
{
|
|
1473
|
-
"type": "
|
|
1474
|
-
"named": true
|
|
1475
|
-
},
|
|
1476
|
-
{
|
|
1477
|
-
"type": "expansion_statement",
|
|
1478
|
-
"named": true
|
|
1479
|
-
},
|
|
1480
|
-
{
|
|
1481
|
-
"type": "expression_statement",
|
|
1482
|
-
"named": true
|
|
1483
|
-
},
|
|
1484
|
-
{
|
|
1485
|
-
"type": "for_range_loop",
|
|
1486
|
-
"named": true
|
|
1487
|
-
},
|
|
1488
|
-
{
|
|
1489
|
-
"type": "for_statement",
|
|
1490
|
-
"named": true
|
|
1491
|
-
},
|
|
1492
|
-
{
|
|
1493
|
-
"type": "goto_statement",
|
|
1494
|
-
"named": true
|
|
1495
|
-
},
|
|
1496
|
-
{
|
|
1497
|
-
"type": "if_statement",
|
|
1498
|
-
"named": true
|
|
1499
|
-
},
|
|
1500
|
-
{
|
|
1501
|
-
"type": "labeled_statement",
|
|
1502
|
-
"named": true
|
|
1503
|
-
},
|
|
1504
|
-
{
|
|
1505
|
-
"type": "return_statement",
|
|
1506
|
-
"named": true
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
"type": "seh_leave_statement",
|
|
1510
|
-
"named": true
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
"type": "seh_try_statement",
|
|
1514
|
-
"named": true
|
|
1515
|
-
},
|
|
1516
|
-
{
|
|
1517
|
-
"type": "switch_statement",
|
|
1453
|
+
"type": "preproc_if",
|
|
1518
1454
|
"named": true
|
|
1519
1455
|
},
|
|
1520
1456
|
{
|
|
1521
|
-
"type": "
|
|
1457
|
+
"type": "preproc_ifdef",
|
|
1522
1458
|
"named": true
|
|
1523
1459
|
},
|
|
1524
1460
|
{
|
|
1525
|
-
"type": "
|
|
1461
|
+
"type": "statement",
|
|
1526
1462
|
"named": true
|
|
1527
1463
|
},
|
|
1528
1464
|
{
|
|
1529
1465
|
"type": "type_definition",
|
|
1530
1466
|
"named": true
|
|
1531
|
-
},
|
|
1532
|
-
{
|
|
1533
|
-
"type": "while_statement",
|
|
1534
|
-
"named": true
|
|
1535
1467
|
}
|
|
1536
1468
|
]
|
|
1537
1469
|
}
|
|
@@ -1603,6 +1535,10 @@
|
|
|
1603
1535
|
{
|
|
1604
1536
|
"type": "escape_sequence",
|
|
1605
1537
|
"named": true
|
|
1538
|
+
},
|
|
1539
|
+
{
|
|
1540
|
+
"type": "invalid_escape_sequence",
|
|
1541
|
+
"named": true
|
|
1606
1542
|
}
|
|
1607
1543
|
]
|
|
1608
1544
|
}
|
|
@@ -5678,6 +5614,20 @@
|
|
|
5678
5614
|
}
|
|
5679
5615
|
]
|
|
5680
5616
|
}
|
|
5617
|
+
},
|
|
5618
|
+
"children": {
|
|
5619
|
+
"multiple": true,
|
|
5620
|
+
"required": false,
|
|
5621
|
+
"types": [
|
|
5622
|
+
{
|
|
5623
|
+
"type": "comment",
|
|
5624
|
+
"named": true
|
|
5625
|
+
},
|
|
5626
|
+
{
|
|
5627
|
+
"type": "pragma_operator",
|
|
5628
|
+
"named": true
|
|
5629
|
+
}
|
|
5630
|
+
]
|
|
5681
5631
|
}
|
|
5682
5632
|
},
|
|
5683
5633
|
{
|
|
@@ -5704,6 +5654,20 @@
|
|
|
5704
5654
|
}
|
|
5705
5655
|
]
|
|
5706
5656
|
}
|
|
5657
|
+
},
|
|
5658
|
+
"children": {
|
|
5659
|
+
"multiple": true,
|
|
5660
|
+
"required": false,
|
|
5661
|
+
"types": [
|
|
5662
|
+
{
|
|
5663
|
+
"type": "comment",
|
|
5664
|
+
"named": true
|
|
5665
|
+
},
|
|
5666
|
+
{
|
|
5667
|
+
"type": "pragma_operator",
|
|
5668
|
+
"named": true
|
|
5669
|
+
}
|
|
5670
|
+
]
|
|
5707
5671
|
}
|
|
5708
5672
|
},
|
|
5709
5673
|
{
|
|
@@ -6306,6 +6270,20 @@
|
|
|
6306
6270
|
}
|
|
6307
6271
|
]
|
|
6308
6272
|
}
|
|
6273
|
+
},
|
|
6274
|
+
"children": {
|
|
6275
|
+
"multiple": true,
|
|
6276
|
+
"required": false,
|
|
6277
|
+
"types": [
|
|
6278
|
+
{
|
|
6279
|
+
"type": "comment",
|
|
6280
|
+
"named": true
|
|
6281
|
+
},
|
|
6282
|
+
{
|
|
6283
|
+
"type": "pragma_operator",
|
|
6284
|
+
"named": true
|
|
6285
|
+
}
|
|
6286
|
+
]
|
|
6309
6287
|
}
|
|
6310
6288
|
},
|
|
6311
6289
|
{
|
|
@@ -6730,6 +6708,20 @@
|
|
|
6730
6708
|
}
|
|
6731
6709
|
]
|
|
6732
6710
|
}
|
|
6711
|
+
},
|
|
6712
|
+
"children": {
|
|
6713
|
+
"multiple": true,
|
|
6714
|
+
"required": false,
|
|
6715
|
+
"types": [
|
|
6716
|
+
{
|
|
6717
|
+
"type": "comment",
|
|
6718
|
+
"named": true
|
|
6719
|
+
},
|
|
6720
|
+
{
|
|
6721
|
+
"type": "pragma_operator",
|
|
6722
|
+
"named": true
|
|
6723
|
+
}
|
|
6724
|
+
]
|
|
6733
6725
|
}
|
|
6734
6726
|
},
|
|
6735
6727
|
{
|
|
@@ -7316,6 +7308,10 @@
|
|
|
7316
7308
|
"type": "escape_sequence",
|
|
7317
7309
|
"named": true
|
|
7318
7310
|
},
|
|
7311
|
+
{
|
|
7312
|
+
"type": "invalid_escape_sequence",
|
|
7313
|
+
"named": true
|
|
7314
|
+
},
|
|
7319
7315
|
{
|
|
7320
7316
|
"type": "string_content",
|
|
7321
7317
|
"named": true
|
|
@@ -9353,6 +9349,10 @@
|
|
|
9353
9349
|
"type": "inline",
|
|
9354
9350
|
"named": false
|
|
9355
9351
|
},
|
|
9352
|
+
{
|
|
9353
|
+
"type": "invalid_escape_sequence",
|
|
9354
|
+
"named": true
|
|
9355
|
+
},
|
|
9356
9356
|
{
|
|
9357
9357
|
"type": "literal_suffix",
|
|
9358
9358
|
"named": true
|
package/tree-sitter-cpp.wasm
CHANGED
|
Binary file
|