mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: EdnItem -> Atom, rewrite tokenizer
This commit is contained in:
parent
143cd24e09
commit
ff31957fed
39 changed files with 477 additions and 376 deletions
|
|
@ -8,9 +8,9 @@ impl<E, A> When<E, A> {
|
|||
}
|
||||
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for When<E, RenderBox<'a, E>> {
|
||||
fn try_from_edn (
|
||||
state: &'a T, head: &EdnItem<impl AsRef<str>>, tail: &'a [EdnItem<impl AsRef<str>>]
|
||||
state: &'a T, head: &Atom<impl AsRef<str>>, tail: &'a [Atom<impl AsRef<str>>]
|
||||
) -> Option<Self> {
|
||||
use EdnItem::*;
|
||||
use Atom::*;
|
||||
if let (Key("when"), [condition, content]) = (head.to_ref(), tail) {
|
||||
Some(Self(
|
||||
Default::default(),
|
||||
|
|
@ -48,8 +48,8 @@ impl<E, A, B> Either<E, A, B> {
|
|||
}
|
||||
}
|
||||
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for Either<E, RenderBox<'a, E>, RenderBox<'a, E>> {
|
||||
fn try_from_edn (state: &'a T, head: &EdnItem<impl AsRef<str>>, tail: &'a [EdnItem<impl AsRef<str>>]) -> Option<Self> {
|
||||
use EdnItem::*;
|
||||
fn try_from_edn (state: &'a T, head: &Atom<impl AsRef<str>>, tail: &'a [Atom<impl AsRef<str>>]) -> Option<Self> {
|
||||
use Atom::*;
|
||||
if let (Key("either"), [condition, content, alternative]) = (head.to_ref(), tail) {
|
||||
Some(Self::new(
|
||||
state.get_bool(condition).expect("either: no condition"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue