Skip to main content

parse_with_context

Function parse_with_context 

Source
pub fn parse_with_context(
    input: &str,
    catalog: &Catalog,
    locale: &Locale,
    context: &dyn ExpectedDomain,
) -> Result<Program, WorkshopError>
Expand description

Compatibility entry point for crate-internal storage tests and migration checks. Ordinary consumers should use parse, which returns Program. Parse localized Workshop text into Workshop IR, resolving ambiguous bare enum members from the enclosing call’s canonical signature context (#111).

When a bare member spelling matches several enum domains, the parser asks ExpectedDomain::expected_domain for the domain the enclosing call’s signature expects at that argument position; the member resolves only when that expected domain is one of the matching domains (i.e. the signature pins exactly one). Without a pin all matching candidates are preserved.