Skip to main content

Crate mos_eval

Crate mos_eval 

Source
Expand description

Expression and scripting evaluator (manifest §4, §25).

The “evaluator” is really a lowerer + resolver: it walks a [SyntaxTree] from mos-parse and builds the typed semantic [Document] graph from mos-core (manifest §6 stage 2), then runs the resolve pass to assign section numbers and rewrite @label cross-references (§6 stage 3, MVP 1).

Modules§

bibliography 🔒
Lower #bibliography(...) directives into a semantic node.
image 🔒
Raster image resolution and decode for #image(...) directives.
image_lower 🔒
Lower #image and #figure parser directives into semantic nodes.
inline 🔒
Lower inline parser nodes into semantic document children.
list 🔒
Lower parsed lists into semantic list nodes.
pageref 🔒
Page-reference resolution and its layout fixpoint (issue #72).
resolve 🔒
Cross-reference resolver (manifest §6 stage 3, MVP 1).
set 🔒
Lower #set directives and coerce directive values.
set_schema 🔒
Schema for #set directives recognised in MVP 1.5.

Structs§

DocumentMetadata
Document-level metadata harvested from #set document(...) directives. The PDF backend writes title and author to the Info dictionary; language is captured for the catalog /Lang entry that the next PDF-metadata slice will wire up.
Evaluator
Lowerer from parse syntax to semantic document graph.
LowerResult
Result of lowering a [SyntaxTree] into a [Document].

Enums§

PageFixpointOutcome
The result of driving page references to a fixpoint.

Constants§

LABEL_SPAN_END_ATTR 🔒
LABEL_SPAN_START_ATTR 🔒

Functions§

insert_label_attributes 🔒
lower
Convenience: parse + lower + resolve in one step. Concatenates the diagnostics from each stage so callers can render them uniformly.
lower_raw_block 🔒
lower_tree
Lower an already-parsed [SyntaxTree]: evaluate it, then run the §6 stage-3 resolver. The CLI calls this after mos_parse::parse so a phase barrier can sit between parsing and lowering; lower is the parse-and-lower convenience used by tests and embedders.
resolve
Run the resolver pass over document in place. Returns any diagnostics produced; the document is modified regardless of whether errors are present so partial output is still renderable.
resolve_page_reference_fixpoint
Drive page-reference resolution to a fixpoint against an injected layout.
resolve_page_references
Rewrite every @page(label) reference’s visible text to its target’s page number, drawn from label_pages (a label→1-based-page map produced by layout). Returns whether any text changed, so the fixpoint driver can tell when the document settled.