1b0fafea75
This commit adds a `Loader` type, which can be used to load multiple source strings. This was done to support the work on modules, but coincidentally enabled consolidating errors, since now `Config::run` can take a `&Loader`, and in the event of an error, return and `Error` that borrows from loaded strings. Multiple error types have been consolidated, and a bunch of ad-hoc error printing was removed.
14 lines
241 B
Rust
14 lines
241 B
Rust
use crate::common::*;
|
|
|
|
pub(crate) struct Compiler;
|
|
|
|
impl Compiler {
|
|
pub(crate) fn compile(src: &str) -> CompileResult<Justfile> {
|
|
let tokens = Lexer::lex(src)?;
|
|
|
|
let ast = Parser::parse(&tokens)?;
|
|
|
|
Analyzer::analyze(ast)
|
|
}
|
|
}
|