Skip to content

Commit

Permalink
Only need this for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neunenak committed Jun 27, 2023
1 parent dc3f1b5 commit 3814867
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ use super::*;
pub(crate) struct Compiler;

impl Compiler {
#[cfg(test)]
pub(crate) fn compile(src: &str) -> CompileResult<Compilation> {
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<Ast> {
let tokens = Lexer::lex(src)?;
Parser::parse(&tokens)
Expand Down

0 comments on commit 3814867

Please sign in to comment.