Module parser

Module parser 

Source
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.

§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
    );
}

Structs§

Parser
Main parser struct for extracting code symbols Uses lazy initialization - parsers are only created when first needed

Enums§

Language
Supported programming languages
ParserError
Parser errors