mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 03:36:42 +01:00
AstToken -> Ast <- AstValue
This commit is contained in:
parent
f77139c8fd
commit
e9d4c7e0bc
5 changed files with 30 additions and 40 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use crate::*;
|
||||
|
||||
impl<S, A> Dsl<S> for When<A> where S: Eval<Ast, bool> + Eval<Ast, A> {
|
||||
fn try_provide (state: S, source: impl Ast) -> Perhaps<Self> {
|
||||
fn try_provide (state: S, source: Ast) -> Perhaps<Self> {
|
||||
if let Ast::Exp(exp) = source {
|
||||
let mut iter = source.clone();
|
||||
if let Some(Ast::Key(id)) = iter.next() && *id == *"when" {
|
||||
|
|
@ -16,7 +16,7 @@ impl<S, A> Dsl<S> for When<A> where S: Eval<Ast, bool> + Eval<Ast, A> {
|
|||
}
|
||||
|
||||
impl<S, A, B> Dsl<S> for Either<A, B> where S: Eval<Ast, bool> + Eval<Ast, A> + Eval<Ast, B> {
|
||||
fn try_provide (state: S, source: impl Ast) -> Perhaps<Self> {
|
||||
fn try_provide (state: S, source: Ast) -> Perhaps<Self> {
|
||||
if let Ast::Exp(source) = source {
|
||||
let mut iter = source.clone();
|
||||
if let Some(Ast::Key(id)) = iter.next() && *id == *"either" {
|
||||
|
|
@ -32,7 +32,7 @@ impl<S, A, B> Dsl<S> for Either<A, B> where S: Eval<Ast, bool> + Eval<Ast, A> +
|
|||
}
|
||||
|
||||
impl<S, A, B> Dsl<S> for Bsp<A, B> where S: Eval<Option<Ast>, A> + Eval<Option<Ast>, B> {
|
||||
fn try_provide (state: S, source: impl Ast) -> Perhaps<Self> {
|
||||
fn try_provide (state: S, source: Ast) -> Perhaps<Self> {
|
||||
Ok(Some(if let Ast::Exp(source) = source {
|
||||
let mut iter = source.clone();
|
||||
match iter.next() {
|
||||
|
|
@ -69,7 +69,7 @@ impl<S, A, B> Dsl<S> for Bsp<A, B> where S: Eval<Option<Ast>, A> + Eval<Option<A
|
|||
}
|
||||
|
||||
impl<S, A> Dsl<S> for Align<A> where S: Eval<Option<Ast>, A> {
|
||||
fn try_provide (state: S, source: impl Ast) -> Perhaps<Self> {
|
||||
fn try_provide (state: S, source: Ast) -> Perhaps<Self> {
|
||||
Ok(Some(if let Ast::Exp(source) = source {
|
||||
let mut iter = source.clone();
|
||||
match iter.next() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue