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]
|
[workspace]
|
||||||
name = "sing"
|
members = [
|
||||||
version = "0.1.0"
|
"sing_derive",
|
||||||
edition = "2021"
|
"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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
build = "build.rs"
|
# build = "build.rs"
|
||||||
|
#
|
||||||
[lib]
|
# [build-dependencies]
|
||||||
proc-macro = true
|
# lalrpop = "0.19"
|
||||||
|
#
|
||||||
[build-dependencies]
|
# [dependencies]
|
||||||
lalrpop = "0.19"
|
# syn = "1"
|
||||||
|
# regex = "1"
|
||||||
[dependencies]
|
# lalrpop-util = "0.19"
|
||||||
syn = "1"
|
# lalrpop = "0.19"
|
||||||
regex = "1"
|
|
||||||
lalrpop-util = "0.19"
|
|
||||||
lalrpop = "0.19"
|
|
7
TODO
7
TODO
|
@ -18,9 +18,12 @@ Generator
|
||||||
- Maybe utilize serde
|
- Maybe utilize serde
|
||||||
- Look at how clap handles states between macro calls
|
- Look at how clap handles states between macro calls
|
||||||
- They operate on a singleton lol
|
- They operate on a singleton lol
|
||||||
- This would need to store All traits and their functions
|
- 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)
|
- 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.
|
|
||||||
|
|
||||||
## Links oder so lül
|
## 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;
|
#[macro_use] extern crate lalrpop_util;
|
||||||
extern crate lalrpop;
|
extern crate lalrpop;
|
||||||
|
|
||||||
|
@ -7,14 +5,6 @@ mod callobj;
|
||||||
|
|
||||||
lalrpop_mod!(fun_parser);
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::fun_parser;
|
use crate::fun_parser;
|
Loading…
Reference in a new issue