Expand description
§Peeker
A library for extracting code structure from source files using tree-sitter.
§Example
use peeker::{parse_file, CodeStructure};
let source = r#"
pub fn hello() {
println!("Hello, world!");
}
"#;
let structure = parse_file(source, "rs").unwrap();
assert_eq!(structure.functions.len(), 1);
assert_eq!(structure.functions[0].name, "hello");§Supported Languages
- Rust (
.rs) - Python (
.py) - TypeScript (
.ts,.tsx) - JavaScript (
.js,.jsx) - Go (
.go) - Java (
.java) - C (
.c,.h) - C++ (
.cpp,.cc,.cxx,.hpp,.hxx)
Re-exports§
pub use languages::LanguageConfig;pub use languages::get_language_config;pub use parser::CodeStructure;pub use parser::EnumDef;pub use parser::FieldDef;pub use parser::FunctionDef;pub use parser::Import;pub use parser::StructDef;pub use parser::TraitDef;pub use parser::parse_file;