This is the Brokk-owned and independently maintained fork of
tree-sitter/tree-sitter-cpp,
a C++ grammar for Tree-sitter.
Brokk maintains this fork for its code-intelligence tooling and publishes the
Rust package as
brokk-tree-sitter-cpp.
The grammar and bindings remain available under the upstream MIT license; see
LICENSE for the retained copyright and license notice.
Try the grammar in Brokk's web playground.
The npm and Python bindings retain their upstream-compatible package names but are not published by this fork. The Go, Swift, and C bindings are available from source in this repository.
The 0.24.x line tracks upstream commit
c009222808634c1014f82438d4883753516a2c24 and uses parser ABI 15. Loading
this grammar requires Tree-sitter 0.25 or newer. It adds upstream's module,
reflection, lambda, explicit object parameter, and operator-call changes
while retaining Brokk's quoted Windows include-path and split conditional
extern "C" guard fixes.
Generation uses the pinned C grammar 0.24.1 and Tree-sitter CLI 0.26.3. The 0.23.x line remains based on upstream 0.23.4 with parser ABI 14.
Add the Brokk-maintained Rust crate to your project:
cargo add brokk-tree-sitter-cpp@=0.24.0Or add it directly to Cargo.toml:
[dependencies]
tree-sitter-cpp = { package = "brokk-tree-sitter-cpp", version = "=0.24.0" }The crate prefixes its native parser symbols so it can coexist with the
upstream tree-sitter-cpp crate in one executable.
To regenerate the parser, install the locked JavaScript dependencies (npm ci) and run npx tree-sitter generate --abi 15. Run npx tree-sitter test to
check the full corpus and highlighting suite.