Function sway_core::parse

source ·
pub fn parse(
    input: Arc<str>,
    handler: &Handler,
    engines: &Engines,
    config: Option<&BuildConfig>,
) -> Result<(LexedProgram, ParseProgram), ErrorEmitted>
Expand description

Given an input Arc<str> and an optional BuildConfig, parse the input into a lexed::LexedProgram and parsed::ParseProgram.

§Example

    let input = "script; fn main() -> bool { true }";
    let result = parse(input.into(), <_>::default(), None);

§Panics

Panics if the parser panics.