Diffstat (limited to 'src/parser/types.rs')
| -rw-r--r-- | src/parser/types.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/parser/types.rs b/src/parser/types.rs index 1cb23e3..dc44e42 100644 --- a/src/parser/types.rs +++ b/src/parser/types.rs @@ -1,9 +1,6 @@ -use std::{ - fmt::{Debug, FormattingOptions}, - ops::Deref, -}; +use std::{fmt::FormattingOptions, ops::Deref}; -use crate::lexer::Token; +use crate::{exec::Argc, lexer::Token}; use beef::lean::Cow; use chumsky::{ input::{MappedInput, Stream}, @@ -19,7 +16,16 @@ pub type Input<'s> = MappedInput< >; #[derive(Clone, Default)] -pub struct Λ<'s>(pub Vec<Spanned<Expr<'s>>>); +pub struct Λ<'s>(pub Vec<Spanned<Expr<'s>>>, Argc); +impl<'s> Λ<'s> { + pub fn of(x: Vec<Spanned<Expr<'s>>>) -> Self { + let s = Λ::sized(&x); + Self(x, s) + } + pub fn argc(&self) -> Argc { + self.1 + } +} impl std::fmt::Debug for Λ<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match &*self.0 { |