Parse LaTeX source into Atrium's own AST.
Turns text into a tree of what the source says; it does not expand
macros, does not know what any command means, and does not resolve
\input (see the module doc comment in ast.ts for the full scope line).
file is stamped onto every SourceRef in the result — it should be the
project-relative path the caller knows this source as (compile()'s keys
into its files map), so a diagnostic or later error can point back at a
file the caller recognises.
Never throws. Malformed input (an unclosed environment or group, a
stray }) is reported as a syntax diagnostic with an accurate position,
not an exception — consistent with the rest of the engine (see compile()
in compile.ts). This function does not itself wrap anything in try/catch:
@unified-latex's base parser is lenient by construction (confirmed by
direct testing — see from-unified-latex.ts) and never throws for bad
input; a genuine crash here would be an engine bug, which is exactly what
compile()'s outer boundary exists to catch and convert to internal.
Duplicating that net at every internal layer would hide the difference
between "bad input" and "our bug" instead of preserving it.
The pipeline stages, in the order
compile()runs them. Exported so a caller can drive one stage alone — the golden tests do, and an editor could ask for diagnostics without paying for layout.Named rather than
export *on purpose: two chunks independently defined aTextStyle, and a star re-export would have merged or shadowed them silently.layout's is nowTextFace(a resolved handle at a size);doc's staysTextStyle(semantic — aFontSelectionplus underline, deliberately no size). Listing every name is what makes the next such collision a build error.