use shm_rs::lexer::lexer; use shm_rs::static_scheme::generator::RustCode; use shm_rs::static_scheme::init; use shm_rs::dynamic_scheme::environment; use shm_rs::serializator::serializator; fn main() { let curdir = std::env::current_dir().unwrap(); println!("{}", curdir.display()); let schm = init::SchemeInit::new_with_path(curdir).unwrap(); let res = schm.run_from_file("examples/complex_example_1/init_networking.shm", None).unwrap(); let resser = res.get("networking").unwrap().clone(); let anres = resser.analyze().unwrap(); println!("errors:\n{}", anres); let mut curdir = std::env::current_dir().unwrap(); curdir.push("examples/complex_example_1/init_networking_dyn1.shm"); let lex = lexer::Lexer::from_file(curdir).unwrap(); let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap(); let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap(); let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap(); let serialized = serde_json::to_string(&ret).unwrap(); println!("Result:\n{}", serialized); let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]); println!("Structures: "); match resser.generate_rust_structs(&mut rc) { Ok(_) => { println!("{}", rc); }, Err(e) => { println!("{}", e); } } }