Function sway_core::parse

source ·
pub fn parse(
    input: Arc<str>,
    engines: Engines<'_>,
    config: Option<&BuildConfig>
) -> CompileResult<(LexedProgram, ParseProgram)>
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.