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§
- Header
Sniff - What
sniff_headerslearned from the header block.versionis exactlysniff_version’s result (Axis A);envelope_headersis the Axis-B signal the CLI’s detection ladder needs — ause-shaped header pins Axis B =LoadMode::Envelopes, and sets BOTH fields. - Parse
Version Error - Error returned by
RustyfiVersion’sFromStrimpl for a string that does not name a recognized version.
Enums§
- Rustyfi
Version - 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: ause-shaped header line (is_use_header) sets bothversion = Some(V0_1)andenvelope_headers = true, so the CLI’s detection ladder can pinLoadMode::Envelopesoff 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.