mirror of
https://github.com/tree-sitter/tree-sitter-rust.git
synced 2025-12-05 22:28:52 +00:00
Rust grammar for tree-sitter
* Raw reference/identifier conflict * Added test * Regenerate with cli v0.25.10 * Upgrade tree-sitter dependency on node bindings * Upgrade tree-sitter dependency for Swift * Unsafe foreign_mod_item and CI updates |
||
|---|---|---|
| .github | ||
| bindings | ||
| examples | ||
| queries | ||
| src | ||
| test/corpus | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| binding.gyp | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CMakeLists.txt | ||
| eslint.config.mjs | ||
| go.mod | ||
| go.sum | ||
| grammar.js | ||
| LICENSE | ||
| Makefile | ||
| package-lock.json | ||
| package.json | ||
| Package.resolved | ||
| Package.swift | ||
| pyproject.toml | ||
| README.md | ||
| setup.py | ||
| tree-sitter.json | ||
tree-sitter-rust
Rust grammar for tree-sitter.
Features
-
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/msBut 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
- 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.