diff --git a/Cargo.toml b/Cargo.toml index ddc7d0a..d7c9c2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,25 @@ -[package] -name = "sing" -version = "0.1.0" -edition = "2021" +[workspace] +members = [ + "sing_derive", + "sing_parse", +] + +# [package] +# name = "sing" +# version = "0.1.0" +# edition = "2021" +# +# [lib] +# bench = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -build = "build.rs" - -[lib] -proc-macro = true - -[build-dependencies] -lalrpop = "0.19" - -[dependencies] -syn = "1" -regex = "1" -lalrpop-util = "0.19" -lalrpop = "0.19" \ No newline at end of file +# build = "build.rs" +# +# [build-dependencies] +# lalrpop = "0.19" +# +# [dependencies] +# syn = "1" +# regex = "1" +# lalrpop-util = "0.19" +# lalrpop = "0.19" \ No newline at end of file diff --git a/TODO b/TODO index fa82024..93d8a2b 100644 --- a/TODO +++ b/TODO @@ -18,9 +18,12 @@ Generator - Maybe utilize serde - Look at how clap handles states between macro calls - They operate on a singleton lol - - This would need to store All traits and their functions - - It should also own (locked) Stdin, Stdout and Stderr (or any one Read and two Write objects) - - This bad boi would also implement the main loop for the cli application. + - We should, too + - Providing both a builder and derive interface makes sense + - Needs a list of traits and one for functions + - latter one should be created from the first with a macro + - should provide a method to match a call to these functions + - It should also own (locked) Stdin, Stdout and Stderr (or any one Read and two Write objects) ## Links oder so lül diff --git a/sing_derive/Cargo.toml b/sing_derive/Cargo.toml new file mode 100644 index 0000000..703a0b8 --- /dev/null +++ b/sing_derive/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sing_derive" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +proc-macro = true + + +[dependencies] diff --git a/sing_derive/src/lib.rs b/sing_derive/src/lib.rs new file mode 100644 index 0000000..da1e896 --- /dev/null +++ b/sing_derive/src/lib.rs @@ -0,0 +1,27 @@ + +use std::{collections::HashMap, io::Read, fmt::Write}; + +struct TraitProfile{} + +struct FunctionProfile{} + +struct Evaluator { + traits: HashMap, + functions: HashMap, + input: R, + output: W, + err: W, + worker: T +} + + +#[cfg(test)] +mod tests { + + #[test] + fn it_works() { + let result = 2 + 2; + assert_eq!(result, 4); + } + +} diff --git a/sing_parse/Cargo.toml b/sing_parse/Cargo.toml new file mode 100644 index 0000000..4fd9ec0 --- /dev/null +++ b/sing_parse/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "sing_parse" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +build = "build.rs" + +[lib] + + +[build-dependencies] +lalrpop = "0.19" + +[dependencies] +syn = "1" +regex = "1" +lalrpop-util = "0.19" +lalrpop = "0.19" \ No newline at end of file diff --git a/build.rs b/sing_parse/build.rs similarity index 100% rename from build.rs rename to sing_parse/build.rs diff --git a/src/callobj.rs b/sing_parse/src/callobj.rs similarity index 100% rename from src/callobj.rs rename to sing_parse/src/callobj.rs diff --git a/src/fun_parser.lalrpop b/sing_parse/src/fun_parser.lalrpop similarity index 100% rename from src/fun_parser.lalrpop rename to sing_parse/src/fun_parser.lalrpop diff --git a/src/lib.rs b/sing_parse/src/lib.rs similarity index 75% rename from src/lib.rs rename to sing_parse/src/lib.rs index efae85a..3a5cf3c 100644 --- a/src/lib.rs +++ b/sing_parse/src/lib.rs @@ -1,5 +1,3 @@ - -use proc_macro::TokenStream; #[macro_use] extern crate lalrpop_util; extern crate lalrpop; @@ -7,14 +5,6 @@ mod callobj; lalrpop_mod!(fun_parser); -#[proc_macro_derive(HelloMacro)] -pub fn hello_macro_derive(input: TokenStream) -> TokenStream { - let _friend = lalrpop::process_root(); - println!("Hello world!"); - fun_parser::CallParser::new(); - input -} - #[cfg(test)] mod tests { use crate::fun_parser;