This is the Brokk-owned and independently maintained fork of
tree-sitter/tree-sitter-rust,
a Rust grammar for Tree-sitter.
Brokk maintains this fork for its code-intelligence tooling and publishes the
Rust package as
brokk-tree-sitter-rust.
It intentionally diverges where Brokk needs language support that is not yet
available upstream. Unless you specifically need Brokk's changes, you may
prefer the upstream project.
Add the Brokk-maintained Rust crate to your project:
cargo add brokk-tree-sitter-rust@=0.24.3Or add it directly to Cargo.toml:
[dependencies]
brokk-tree-sitter-rust = "=0.24.3"The npm and Python bindings retain their upstream-compatible package names but
are not published by this fork. The Brokk-namespaced Rust crate prefixes its
native symbols, so it can coexist with the upstream tree-sitter-rust crate in
one executable.
-
Speed — When initially parsing a file,
tree-sitter-rusttakes around two to three times as long as rustc's hand-written parser.$ wc -l examples/ast.rs 2157 examples/ast.rs $ rustc -Z unpretty=ast-tree -Z time-passes examples/ast.rs | head -n0 time: 0.002; rss: 55MB -> 60MB ( +5MB) parse_crate $ tree-sitter parse examples/ast.rs --quiet --time examples/ast.rs 6.48 ms 9908 bytes/ms
But if you edit the file after parsing it, tree-sitter can generally update the previous existing syntax tree to reflect your edit in less than a millisecond, thanks to its incremental parsing system.
- The Rust Reference — While Rust does not have a specification, the reference tries to describe its working in detail. It tends to be out of date.
- Keywords and Operators and Symbols.