tree-sitter-rust

module
v0.24.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT

README

Brokk's Rust Grammar for Tree-sitter

CI crates docs.rs

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.

Installation

Add the Brokk-maintained Rust crate to your project:

cargo add brokk-tree-sitter-rust@=0.24.5

Or add it directly to Cargo.toml:

[dependencies]
brokk-tree-sitter-rust = "=0.24.5"

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.

Features

  • Speed — When initially parsing a file, tree-sitter-rust takes 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.

References

Directories

Path Synopsis
bindings
go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL