Experiment with nested source authoring against source3 models
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
//! One-file command-line harness for inspecting the actual lowering result.
|
||||
use oa_core::{language, source_project::SourceBundle};
|
||||
use std::{collections::BTreeMap, env, fs, process::ExitCode};
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let args: Vec<_> = env::args().skip(1).collect();
|
||||
if args.len() != 1 {
|
||||
eprintln!(
|
||||
"Usage: source-authoring-experiment B_SOURCE_FILE\nIncludes require the library's explicit SourceBundle API."
|
||||
);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
let result = fs::read_to_string(&args[0])
|
||||
.map_err(|error| error.to_string())
|
||||
.and_then(|text| {
|
||||
source_authoring_experiment::compile(&SourceBundle {
|
||||
entry: "project.arcadia".into(),
|
||||
files: BTreeMap::from([("project.arcadia".into(), text)]),
|
||||
})
|
||||
});
|
||||
match result {
|
||||
Ok(project) => {
|
||||
print!("{}", language::format(&project));
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
Err(error) => {
|
||||
eprintln!("{error}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user