Expand description
Multi-file loading layer for SATySFi documents: resolves @require: /
@import: headers to files on disk, recursively parses the whole
dependency graph, and returns it in dependency-first (topological) load
order.
Transcribed from v0.0.6’s src/frontend/main.ml (lines ~95-140):
@import: nameresolves relative to the directory of the file containing the header (not the entry document’s directory).@require: nameresolves against the package/library root (LoadOptions::lib_root).- Candidate extensions, tried in order:
.satyh, then.satyg(the mode-specific.satyh-<mode>extensions frommain.mlare out of scope here). - The same file reached through two different headers is one graph node (deduplicated by canonical path).
- Every dependency must be a library file (
body: None); the entry must be a document (body: Some(..)). - A cycle in the dependency graph is an error naming the files involved.
Re-exports§
pub use v006::resolve::resolve_import;pub use v006::resolve::resolve_require;
Modules§
- v006
- v0.0.6 / dev-0-1-0-Legacy resolution backend:
@require:/@import:header resolution against a lib-root (resolve.rs). Shared by BOTHV0_0andV0_1-under-LoadMode::Legacy(dev-0-1-0’s headers are byte-identical to 0.0.6’s minus@stage:, so this backend needs no per-version branch). The dependency-graph toposort/cycle bookkeeping lives at the crate root (graph.rs): it is mode-agnostic (u32/PathBufonly) and the Envelopes backend (v01x/) needs the identical machinery.
Structs§
- FsSources
- The real filesystem —
SourceProvider’s default. - Load
Options - Options controlling header resolution.
- Loaded
File - One parsed file in a loaded program.
- Loaded
Program - A fully loaded, dependency-resolved program.
Enums§
- File
Origin - Where a loaded file came from — metadata for diagnostics and for a
future
used_as→ module binding. Nothing inrustyfi-langreads it yet. - Load
Error - Everything that can go wrong while loading a multi-file SATySFi program.
- Load
Mode - How multi-file dependencies are declared and resolved — Axis B,
orthogonal to
RustyfiVersion(Axis A, the grammar generation), except that the one combination with no upstream analogue —V0_0+Envelopes— is rejected byloadup front. - Loaded
Cst - A parsed file’s CST, tagged by which grammar generation produced it.
load()picks the variant per file, from that file’s ownLoadedFile::version— which a cross-version Legacy load can vary WITHIN one program (see that field). The enum exists soLoadedFilehas a single field type rather than forcing every consumer ofLoadedProgramto be generic over the CST type. - Rustyfi
Version - Target SATySFi language version.
Traits§
- Source
Provider - Where the Legacy loader gets source text from.
Functions§
- load
- Load
entry(a.satydocument) and its full transitive dependency graph, dispatching onLoadOptions::mode(Axis B).LoadMode::Legacyresolves@require:/@import:headers (load_legacy);LoadMode::Envelopesresolvesuse package/use … ofheaders (v01x::open_doc).