mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: try to get a simplified parser going
This commit is contained in:
parent
fc82d6ff9b
commit
600d0b3aca
17 changed files with 676 additions and 133 deletions
|
|
@ -1,47 +0,0 @@
|
|||
use crate::*;
|
||||
use ::tek_engine::edn::*;
|
||||
|
||||
macro_rules! edn_module {
|
||||
($name:literal = $Host:ident<$E:ident: $Engine:path> { $(
|
||||
(defn $fn:ident
|
||||
$(<$($G:ident: $Generic:ty),+>)?
|
||||
$Struct:ident($($arg:ident : $Arg:ty),*))
|
||||
)* }) => {
|
||||
pub trait $Host<$E: Engine> {
|
||||
pub fn read_one <'e> (edn: &[Edn<'e>]) -> impl Content<$E> {
|
||||
if let Some(Edn::Symbol(name)) = edn.get(0) {
|
||||
match name {
|
||||
$(
|
||||
stringify!($fn) =>
|
||||
),*
|
||||
}
|
||||
} else {
|
||||
panic!("invalid edn")
|
||||
}
|
||||
}
|
||||
$(
|
||||
|
||||
)*
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//edn_module! {
|
||||
//(host LayoutEdn<E>)
|
||||
//(name "layout")
|
||||
|
||||
//(defn when <A: Content<E>>
|
||||
//When(cond: bool, item: A))
|
||||
|
||||
//(defn either <A: Content<E>, B: Content<E>>
|
||||
//Either(cond: bool, a: A, b: B))
|
||||
|
||||
//(defn map <
|
||||
//A: Content<E>,
|
||||
//B: Content<E>,
|
||||
//I: Iterator<Item = A> + Send + Sync,
|
||||
//F: Fn() -> I + Send + Sync,
|
||||
//G: Fn(A, usize)->B + Send + Sync
|
||||
//>
|
||||
//Map(get_iterator: I, callback: G))
|
||||
//}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
//mod collection; pub use self::collection::*;
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
|
||||
mod align; pub use self::align::*;
|
||||
mod direction; pub use self::direction::*;
|
||||
mod layout_edn; pub use self::edn::*;
|
||||
mod measure; pub use self::measure::*;
|
||||
mod ops; pub use self::ops::*;
|
||||
mod transform_xy; pub use self::transform_xy::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue