1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
use shm_rs::lexer::lexer;
use shm_rs::static_scheme::generator::RustCode;
use shm_rs::static_scheme::init;
use shm_rs::dynamic_scheme::environment;
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/another/init_l.shm", None).unwrap();
let resser = res.get("logsmon").unwrap().clone();
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);
}
}
let anres = resser.analyze().unwrap();
println!("errors:\n{}", anres);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/another/data_l.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 resser = res.get("logsmon").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());
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);
}
}
*/
}