Skip to main content

Module version

Module version 

Source
Expand description

Target SATySFi language version.

0.0.6 and 0.1.x diverge at several points in the pipeline (lexing headers, module resolution in the loader, elaboration in rustyfi-lang, …). Rather than let each divergence point grow its own ad-hoc flag, the target version is threaded through the pipeline as a single RustyfiVersion value (see crate’s consumers: rustyfi-loader’s LoadOptions and rustyfi’s --lang flag), and each divergence point is expressed as a method on it, rather than scattering if opt_a && opt_b checks across the crate graph.

§Verification note on the 0.1 header syntax

The exact SATySFi 0.1.0 use header grammar is not independently confirmed from upstream sources here (the sandbox this was written in had no network access), so the sniff_version heuristic below for 0.1 (use -prefixed header lines) is best-effort. The 0.0.6 side (@require: / @import: / @stage:) is verified, directly against this port’s own crate::cst/crate::lexer implementation of the v0.0.6 grammar.

Structs§

HeaderSniff
What sniff_headers learned from the header block. version is exactly sniff_version’s result (Axis A); envelope_headers is the Axis-B signal the CLI’s detection ladder needs — a use-shaped header pins Axis B = LoadMode::Envelopes, and sets BOTH fields.
ParseVersionError
Error returned by RustyfiVersion’s FromStr impl for a string that does not name a recognized version.

Enums§

RustyfiVersion
Target SATySFi language version.

Functions§

sniff_headers
Best-effort detection of a document’s target version AND packaging axis from its source text — see sniff_version’s doc comment for the version-detection rules. The one addition: a use-shaped header line (is_use_header) sets both version = Some(V0_1) and envelope_headers = true, so the CLI’s detection ladder can pin LoadMode::Envelopes off it.
sniff_version
Best-effort detection of a document’s target version from its source text, by inspecting the header-like lines at the top of the file (before any prelude bindings), and, failing that, the first content line.