27 lines
744 B
Rust
27 lines
744 B
Rust
use arcstr::ArcStr;
|
|
use leaf_allocators::SyncArenaAllocator;
|
|
use leaf_assembly::assembly::{AssemblyIdentifier, Version};
|
|
use leaf_compiler::CompilationContext;
|
|
use leaf_parser::SourceCode;
|
|
use std::{path::PathBuf, sync::Arc};
|
|
|
|
fn main() {
|
|
let alloc = SyncArenaAllocator::default();
|
|
let context = CompilationContext::new(&alloc);
|
|
let ident = AssemblyIdentifier {
|
|
version: Version::default(),
|
|
name: std::borrow::Cow::Borrowed("leaf_test"),
|
|
};
|
|
if let Err(err) = context.extend(
|
|
ident.clone(),
|
|
&[Arc::new(SourceCode {
|
|
text: ArcStr::from(std::fs::read_to_string("../test.leaf").unwrap()),
|
|
file: PathBuf::from("../test.leaf"),
|
|
})],
|
|
) {
|
|
println!("{:#?}", err);
|
|
} else {
|
|
println!("{:#?}", context.get_assembly(&ident));
|
|
}
|
|
}
|