mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-13 23:26:41 +01:00
remove Atom. almost there
This commit is contained in:
parent
dc7b713108
commit
cf1fd5b45a
20 changed files with 539 additions and 739 deletions
|
|
@ -31,35 +31,35 @@ impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
|
|||
}
|
||||
}
|
||||
}
|
||||
try_from_atoms!(<'a, E>: Bsp<RenderBox<'a, E>, RenderBox<'a, E>>: |state, atoms| {
|
||||
let head = atoms.next()?;
|
||||
if head.kind() != TokenKind::Key { return None }
|
||||
match head.text() {
|
||||
"bsp/n" => return Some(Self::n(
|
||||
state.get_content(&atoms.next()?).expect("no south"),
|
||||
state.get_content(&atoms.next()?).expect("no north")
|
||||
)),
|
||||
"bsp/s" => return Some(Self::s(
|
||||
state.get_content(&atoms.next()?).expect("no north"),
|
||||
state.get_content(&atoms.next()?).expect("no south")
|
||||
)),
|
||||
"bsp/e" => return Some(Self::e(
|
||||
state.get_content(&atoms.next()?).expect("no west"),
|
||||
state.get_content(&atoms.next()?).expect("no east")
|
||||
)),
|
||||
"bsp/w" => return Some(Self::w(
|
||||
state.get_content(&atoms.next()?).expect("no east"),
|
||||
state.get_content(&atoms.next()?).expect("no west")
|
||||
)),
|
||||
"bsp/a" => return Some(Self::a(
|
||||
state.get_content(&atoms.next()?).expect("no above"),
|
||||
state.get_content(&atoms.next()?).expect("no below")
|
||||
)),
|
||||
"bsp/b" => return Some(Self::b(
|
||||
state.get_content(&atoms.next()?).expect("no above"),
|
||||
state.get_content(&atoms.next()?).expect("no below")
|
||||
)),
|
||||
_ => {}
|
||||
try_from_expr!(<'a, E>: Bsp<RenderBox<'a, E>, RenderBox<'a, E>>: |state, iter| {
|
||||
if let Some((Token { value: Value::Key(key), .. }, _)) = iter.next() {
|
||||
match key {
|
||||
"bsp/n" => return Some(Self::n(
|
||||
state.get_content(&iter.next()?.0.value).expect("no south"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no north")
|
||||
)),
|
||||
"bsp/s" => return Some(Self::s(
|
||||
state.get_content(&iter.next()?.0.value).expect("no north"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no south")
|
||||
)),
|
||||
"bsp/e" => return Some(Self::e(
|
||||
state.get_content(&iter.next()?.0.value).expect("no west"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no east")
|
||||
)),
|
||||
"bsp/w" => return Some(Self::w(
|
||||
state.get_content(&iter.next()?.0.value).expect("no east"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no west")
|
||||
)),
|
||||
"bsp/a" => return Some(Self::a(
|
||||
state.get_content(&iter.next()?.0.value).expect("no above"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no below")
|
||||
)),
|
||||
"bsp/b" => return Some(Self::b(
|
||||
state.get_content(&iter.next()?.0.value).expect("no above"),
|
||||
state.get_content(&iter.next()?.0.value).expect("no below")
|
||||
)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
});
|
||||
impl<A, B> Bsp<A, B> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue