Function brane_ast::compile::compile_snippet

source ·
pub fn compile_snippet<R: Read>(
    state: &mut CompileState,
    reader: R,
    package_index: &PackageIndex,
    data_index: &DataIndex,
    options: &ParserOptions,
) -> CompileResult
Expand description

Runs the compiler in a stateful manner so that it may compile multiple snippets of the given workflow in succession.

§Generic arguments

  • R: The Read-implementing type of the source text.

§Arguments

  • state: The CompileState of any previous runs (use CompileState::new() if there have not been any).
  • reader: The reader that provides access to the source code to compile.
  • package_index: The PackageIndex that is used to resolve imports.
  • data_index: The DataIndex that is used to resolve Data-structs.
  • options: The ParserOptions with which we parse the given file.

§Returns

A compiled Workflow and its associated warning as a CompileResult (i.e., is guaranteed to be either CompileResult::Workflow or any of the error states).

§Errors

This function may error if the program was ill-formed. Multiple errors are returned simultaneously per-stage.