mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +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
|
|
@ -28,9 +28,9 @@ macro_rules! transform_xy {
|
|||
}
|
||||
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for $Enum<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::*;
|
||||
Some(match (head.to_ref(), tail) {
|
||||
(Key($x), [a]) => Self::x(state.get_content(a).expect("no content")),
|
||||
(Key($y), [a]) => Self::y(state.get_content(a).expect("no content")),
|
||||
|
|
@ -84,9 +84,9 @@ macro_rules! transform_xy_unit {
|
|||
}
|
||||
impl<'a, E: Output + 'a, T: EdnViewData<'a, E>> TryFromEdn<'a, T> for $Enum<E, E::Unit, 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::*;
|
||||
Some(match (head.to_ref(), tail) {
|
||||
(Key($x), [x, a]) => Self::x(
|
||||
state.get_unit(x).expect("no x"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue