Add warning for undefined operator
In practice this will probably always not typecheck, but it's a valid parse
This commit is contained in:
parent
f00fee0e37
commit
2c298c7247
@ -73,7 +73,11 @@ impl BinOp {
|
|||||||
RAngleBracket => ">",
|
RAngleBracket => ">",
|
||||||
_ => return None
|
_ => 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),
|
||||||
"==" => (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),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user