Split project into workspaces and started on implementing the first struct.
This commit is contained in:
parent
6ff32bd4a4
commit
ca6ebc1805
9 changed files with 87 additions and 30 deletions
40
Cargo.toml
40
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"
|
||||
# build = "build.rs"
|
||||
#
|
||||
# [build-dependencies]
|
||||
# lalrpop = "0.19"
|
||||
#
|
||||
# [dependencies]
|
||||
# syn = "1"
|
||||
# regex = "1"
|
||||
# lalrpop-util = "0.19"
|
||||
# lalrpop = "0.19"
|
9
TODO
9
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
|
||||
|
||||
|
|
12
sing_derive/Cargo.toml
Normal file
12
sing_derive/Cargo.toml
Normal file
|
@ -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]
|
27
sing_derive/src/lib.rs
Normal file
27
sing_derive/src/lib.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
use std::{collections::HashMap, io::Read, fmt::Write};
|
||||
|
||||
struct TraitProfile{}
|
||||
|
||||
struct FunctionProfile{}
|
||||
|
||||
struct Evaluator <R: Read, W: Write, T>{
|
||||
traits: HashMap<String, TraitProfile>,
|
||||
functions: HashMap<String, FunctionProfile>,
|
||||
input: R,
|
||||
output: W,
|
||||
err: W,
|
||||
worker: T
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = 2 + 2;
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
|
||||
}
|
19
sing_parse/Cargo.toml
Normal file
19
sing_parse/Cargo.toml
Normal file
|
@ -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"
|
|
@ -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;
|
Loading…
Reference in a new issue