From 0524efef039021c44350d0223b3b9951edec0475 Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Wed, 13 Nov 2024 10:43:00 -0600 Subject: [PATCH] Rip out objects --- src/parser.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 45623b4..a2a21f0 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -20,7 +20,6 @@ pub enum Expr { Mult(Box, Box), Div(Box, Box), Block(Vec), - Object(Vec), } #[derive(Debug,PartialEq,Clone)] @@ -69,7 +68,6 @@ peg::parser! { f:funcall() { f } f:funcdef() { f } b:boolean() _ { Expr::Atom(Atom::Bool(b)) } - o:object() { o } i:id() _ { Expr::Id(i) } n:num() _ { Expr::Atom(Atom::Num(n)) } @@ -89,9 +87,6 @@ peg::parser! { = i:id()? "->" _ e:(expr() / block()) { Expr::Funcdef(i, Box::new(e)) } rule conditional() -> Stmt = i:_if() __* ei:elif()* __* e:_else()? __* { Stmt::Conditional([vec![i], ei].concat(), e) } - rule object() -> Expr - = "{" _ stop() indent() __* a:assignment()+ dedent() __* "}" _ { Expr::Object(a) } - rule _if() -> GuardedBlock = "if" _ g:expr() b:block() { GuardedBlock { @@ -344,22 +339,6 @@ else )]; assert_eq!(deelang_parser::program(prgm).unwrap(), expected); } - #[test] - fn test_object() { - let prgm = r"fruit <- { ->>>apple <- 1 -pear <- 2 -<<< -}"; - let expected = vec![Stmt::Assignment( - "fruit".to_string(), - Expr::Object(vec![ - Stmt::Assignment("apple".to_string(), Expr::Atom(Atom::Num(1.0))), - Stmt::Assignment("pear".to_string(), Expr::Atom(Atom::Num(2.0))), - ]), - )]; - assert_eq!(deelang_parser::program(prgm).unwrap(), expected); - } #[test] fn test_preprocess() {