diff --git a/Cargo.toml b/Cargo.toml index 6f31493..658ca1a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,5 @@ rand = "0.8.5" serde_json = "1.0" serde = "1.0.203" serde_derive = "1.0.203" -lsp-types = "0.97.0" \ No newline at end of file +lsp-types = "0.97.0" +zip = "2.1.3" diff --git a/src/file_writer.rs b/src/file_writer.rs index 1fb21e5..7d21299 100644 --- a/src/file_writer.rs +++ b/src/file_writer.rs @@ -1,6 +1,6 @@ use std::fs; -use crate::{transpiler::Transpiler, variable::Variables}; +use crate::{dll_reader::read_dll, transpiler::Transpiler, variable::Variables}; #[derive(Clone, Debug)] pub struct Module { @@ -46,6 +46,10 @@ impl FileWriter { } } pub fn add(&mut self, filepath: String, variables: &mut Variables) -> String { + if filepath.ends_with(".dll") { + read_dll(filepath.clone()); + return "xyz".to_string(); + } if let Some(module) = self.check(filepath.clone()) { return module.mod_rs.clone(); } diff --git a/src/main.rs b/src/main.rs index 6a61db2..318cd6c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ mod compile; +mod dll_reader; mod file_writer; mod lexer; mod lsp; @@ -41,7 +42,8 @@ fn main() { let mut trsp = Transpiler::default(); let mut vars = Variables::new(); let mut transpiled_code = trsp.transpile(file_content, 0, &mut vars); - transpiled_code += "\nfn main() {std::process::exit("; + transpiled_code += "\nfn main() {"; + transpiled_code += "std::process::exit("; transpiled_code += vars.get_var("main".to_string(), &mut trsp).as_str(); transpiled_code += "())}"; for problem in trsp.problems { diff --git a/test/main b/test/main deleted file mode 100755 index 5f6b997..0000000 Binary files a/test/main and /dev/null differ