Expand description
Info-tree projection capability on crate::LeanSession.
Two sibling entry points project a Lean source into the FFI-safe
ProcessedFile structure:
crate::LeanSession::process_with_info_treetakes a body-only snippet (noimportheader). It drivesIO.processCommandsfrom byte 0 with an emptyModuleParserState— the right call for inline scratch buffers and tactic-level snippets.crate::LeanSession::process_module_with_info_treetakes a full Lean source file (header + body). It callsLean.Parser.parseHeaderfirst, then resumesIO.processCommandsfrom the parser state the header parser produced — the right call for real files beginning withimport …. Position coordinates in the returned projection are in the original file’s line/column system with no Rust-side offset arithmetic.
Both shims share the projection machinery (one Elab.InfoTree
walk that records four arrays of structurally distinct nodes plus
the elaborator’s diagnostics). The projection is the boundary —
raw InfoTree never crosses the FFI line, because it carries
metavariable contexts and Lean.Expr values that cannot be revived
outside the elaboration session that produced them.
Each node carries an explicit (start_line, start_column, end_line, end_column) source range so callers can build cursor-position
queries without further Lean calls. ProcessedFile::term_at,
ProcessedFile::tactic_at, and ProcessedFile::references_of
cover the three queries downstream cursor tooling needs; new lookup
shapes are pure Rust on top of the same projection.
Both Lean shims are optional: a capability dylib forked without
either shim collapses to the corresponding Unsupported arm at
dispatch time, matching the meta-service degradation pattern.
Structs§
- Command
Info Node - One top-level command the elaborator processed.
- Name
RefNode - One identifier occurrence the elaborator recorded.
- Processed
File - FFI-safe projection of a processed Lean source string’s
Elab.InfoTree. - Tactic
Info Node - One
Lean.Elab.TacticInfoprojection. - Term
Info Node - One
Lean.Elab.TermInfoprojection.