diff --git a/schala-lang/src/builtin.rs b/schala-lang/src/builtin.rs index 32b3d73..61f0400 100644 --- a/schala-lang/src/builtin.rs +++ b/schala-lang/src/builtin.rs @@ -73,7 +73,11 @@ impl BinOp { RAngleBracket => ">", _ => return None }; - Some(BINOPS.get(s).map(|x| x.2.clone()).expect("Custom operators not handled yet")) + let default = 10_000_000; + Some(BINOPS.get(s).map(|x| x.2.clone()).unwrap_or_else(|| { + println!("Warning: operator {} not defined", s); + default + })) } } @@ -128,5 +132,6 @@ lazy_static! { "<" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), "<=" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), "==" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), + "=" => (Func(bx!(Const(Nat)), bx!(Func(bx!(Const(Nat)), bx!(Const(Nat))))), (), 20), }; }