Skip to main content

Module parser

Module parser 

Source
Expand description

Rust source file parser built on syn.

Parses .rs files into a structured representation that captures the information the Detector needs: function boundaries, call sites, use imports, and extern blocks. Handles free functions, impl block methods, and trait default methods.

The parser uses syn::visit::Visit to walk the AST. It does not perform type resolution — all matching is done on syntactic path segments. Import aliases are tracked so the Detector can expand them.

Structs§

CallSite
A single call expression inside a function body.
ExternBlock
An extern block declaring foreign functions.
ImportPath
A use import statement, with optional alias.
ParsedFile
The parsed representation of a single .rs source file.
ParsedFunction
A single function (free, impl method, or trait default method) and its call sites.

Enums§

CallKind
Distinguishes qualified function calls from method calls.

Functions§

parse_file
Parses a .rs file from disk into a ParsedFile.
parse_source
Parses Rust source code from a string into a ParsedFile.