Function sway_core::parse[][src]

pub fn parse<'sc>(
    input: &'sc str,
    config: Option<&BuildConfig>
) -> CompileResult<'sc, HllParseTree<'sc>>
Expand description

Given an input str and an optional BuildConfig, parse the input into a HllParseTree.

Here, the 'sc lifetime is introduced to the compilation process. It stands for source code, and all references to 'sc in the compiler refer to the lifetime of the original source input str.

Example

    let input = "script; fn main() -> bool { true }";
    let result = parse(input, Default::default());

Panics

Panics if the generated parser from Pest panics.