Skip to main content

Crate rustyfi_loader

Crate rustyfi_loader 

Source
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: name resolves relative to the directory of the file containing the header (not the entry document’s directory).
  • @require: name resolves against the package/library root (LoadOptions::lib_root).
  • Candidate extensions, tried in order: .satyh, then .satyg (the mode-specific .satyh-<mode> extensions from main.ml are 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 BOTH V0_0 and V0_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/PathBuf only) and the Envelopes backend (v01x/) needs the identical machinery.

Structs§

FsSources
The real filesystem — SourceProvider’s default.
LoadOptions
Options controlling header resolution.
LoadedFile
One parsed file in a loaded program.
LoadedProgram
A fully loaded, dependency-resolved program.

Enums§

FileOrigin
Where a loaded file came from — metadata for diagnostics and for a future used_as → module binding. Nothing in rustyfi-lang reads it yet.
LoadError
Everything that can go wrong while loading a multi-file SATySFi program.
LoadMode
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 by load up front.
LoadedCst
A parsed file’s CST, tagged by which grammar generation produced it. load() picks the variant per file, from that file’s own LoadedFile::version — which a cross-version Legacy load can vary WITHIN one program (see that field). The enum exists so LoadedFile has a single field type rather than forcing every consumer of LoadedProgram to be generic over the CST type.
RustyfiVersion
Target SATySFi language version.

Traits§

SourceProvider
Where the Legacy loader gets source text from.

Functions§

load
Load entry (a .saty document) and its full transitive dependency graph, dispatching on LoadOptions::mode (Axis B). LoadMode::Legacy resolves @require:/@import: headers (load_legacy); LoadMode::Envelopes resolves use package/use … of headers (v01x::open_doc).