didn't need that
This commit is contained in:
parent
b397c4680e
commit
ad9e9d8888
2 changed files with 4 additions and 6 deletions
|
|
@ -19,8 +19,7 @@ mod value;
|
||||||
pub mod vm;
|
pub mod vm;
|
||||||
pub mod errors;
|
pub mod errors;
|
||||||
|
|
||||||
pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,Chunk>), Error>{
|
pub fn compile_sourcedir(source_dir:&str)-> Result<HashMap<String,Chunk>, Error>{
|
||||||
let mut paths = vec![];
|
|
||||||
let mut registry = HashMap::new();
|
let mut registry = HashMap::new();
|
||||||
|
|
||||||
for entry in WalkDir::new(source_dir).into_iter().filter_map(|e| e.ok()) {
|
for entry in WalkDir::new(source_dir).into_iter().filter_map(|e| e.ok()) {
|
||||||
|
|
@ -36,7 +35,6 @@ pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.replace(".crud", "");
|
.replace(".crud", "");
|
||||||
bytecode_compiler::compile(Some(&path), &statements, &mut registry)?;
|
bytecode_compiler::compile(Some(&path), &statements, &mut registry)?;
|
||||||
paths.push(path);
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{}", e);
|
println!("{}", e);
|
||||||
|
|
@ -46,7 +44,7 @@ pub fn compile_sourcedir(source_dir:&str)-> Result<(Vec<String>, HashMap<String,
|
||||||
println!();
|
println!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok((paths,registry))
|
Ok(registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_underlying() -> fn(std::io::Error) -> Error {
|
pub fn map_underlying() -> fn(std::io::Error) -> Error {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ use std::sync::Arc;
|
||||||
async fn main() -> Result<(), crudlang::errors::Error> {
|
async fn main() -> Result<(), crudlang::errors::Error> {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
let (paths,registry) = compile_sourcedir("source")?;
|
let registry = compile_sourcedir("source")?;
|
||||||
|
|
||||||
let registry = Arc::new(registry);
|
let registry = Arc::new(registry);
|
||||||
if !paths.is_empty() {
|
if !registry.is_empty() {
|
||||||
let state = Arc::new(AppState {
|
let state = Arc::new(AppState {
|
||||||
registry: registry.clone(),
|
registry: registry.clone(),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue