diff --git a/src/compiler.rs b/src/compiler.rs index 9bdd66acfd..71e22a11ab 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -3,6 +3,19 @@ use super::*; pub(crate) struct Compiler; impl Compiler { + #[cfg(test)] + pub(crate) fn compile(src: &str) -> CompileResult { + let root_ast = Self::parse(src)?; + let root_justfile = Analyzer::analyze(&root_ast, &[])?; + + Ok(Compilation { + root_ast, + root_justfile, + root_source: src, + imported_asts: vec![], + }) + } + pub(crate) fn parse(src: &str) -> CompileResult { let tokens = Lexer::lex(src)?; Parser::parse(&tokens)