Expand description
Tree-sitter based code parser for extracting symbols from source files
This module provides a unified interface for parsing source code across multiple programming languages and extracting symbols (functions, classes, methods, structs, enums, etc.) with their metadata.
§Module Structure
- [
core] - Main Parser struct and symbol extraction logic language- Language enum and support utilitiesqueries- Tree-sitter query strings for all languages
§Supported Languages
Full symbol extraction support (with tree-sitter queries):
- Python
- JavaScript
- TypeScript
- Rust
- Go
- Java
- C
- C++
- C#
- Ruby
- Bash
- PHP
- Kotlin
- Swift
- Scala
- Haskell
- Elixir
- Clojure
- OCaml
- Lua
- R
Note: F# is recognized by file extension but tree-sitter parser support is not yet implemented.
§Example
ⓘ
use infiniloom_engine::parser::{Parser, Language};
let parser = Parser::new();
let source_code = std::fs::read_to_string("example.py")?;
let symbols = parser.parse(&source_code, Language::Python)?;
for symbol in symbols {
println!("{}: {} (lines {}-{})",
symbol.kind.name(),
symbol.name,
symbol.start_line,
symbol.end_line
);
}Re-exports§
pub use language::Language;
Modules§
- extraction
- Symbol extraction utilities for parsing
- init
- Language-specific parser initializers
- language
- Language definitions and support traits
- queries
- Tree-sitter query strings for symbol extraction
- query_
builder - Tree-sitter query builders for symbol extraction
Structs§
- Parser
- Main parser struct for extracting code symbols Uses lazy initialization - parsers are only created when first needed
Enums§
- Parser
Error - Parser errors