diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index e31c693..79cc2fa 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -6,12 +6,12 @@ pub type Spanned = (T, std::ops::Range); #[derive(Clone, Debug)] pub enum Expr { Int(i64), Float(f64), Boolean(bool), - String(String), Identifier(String), + String(String), Identifier(String), Unary { op: String, rhs: Box> }, Binary { lhs: Box>, op: String, rhs: Box> }, Call { name: Box>, args: Spanned>> }, - + Let { name: String, type_hint: String, @@ -24,7 +24,7 @@ pub enum Expr { body: Box> }, Return { expr: Box> }, - + If { cond: Box>, then: Box>, @@ -69,13 +69,15 @@ fn expr_parser() -> impl Parser>, Error = Simple ) .repeated() ) - .foldl(|name, args| {( + .foldl(|name, args| { + ( Expr::Call { name: Box::new(name.clone()), args: (args, name.1.clone()), }, name.1, - )}); + ) + }); let unary = choice(( just(Token::Plus),