Skip to main content

parse_with_declarations

Function parse_with_declarations 

Source
pub fn parse_with_declarations(
    input: &str,
    config: impl Into<LexConfig>,
    declared: &ResolvedDeclarations,
) -> Parse
Expand description

Parse LaTeX source under an explicit LexConfig and a project’s declarations — the one input to the tree that is not the text (AGENTS.md decision #12).

The declarations are applied to pass 1, so a declaring project pays no extra parse: they are known before a byte is lexed, unlike the file’s own definitions, which are what the two-pass scan exists to discover. The second pass is then decided by asking whether the scan contributed anything the declarations did not already say — not by asking whether the context is empty, which a seeded context never is.

ResolvedDeclarations rather than a bare SignatureDb: this is the only signature data the parser accepts, and a type that can only come from a declaration block is what keeps a document’s merged scope (package scans, scanned definitions, the CWL tier) from reaching the tree.