Add support for pattern matching on numbers

This commit is contained in:
Richard Feldman 2019-06-12 22:49:36 -04:00
parent 0062e83d03
commit 6afeedf10e
3 changed files with 118 additions and 1 deletions

View file

@ -101,6 +101,7 @@ pub enum Problem {
TypeMismatch(String),
ReassignedVarName(String),
WrongArity(u32 /* Expected */, u32 /* Provided */),
NotEqual, // Used when (for example) a string literal pattern match fails
NoBranchesMatched,
}
@ -108,6 +109,8 @@ pub enum Problem {
pub enum Pattern {
Identifier(String),
Variant(String, Option<Vec<Pattern>>),
Integer(i64),
Fraction(i64, u64),
EmptyRecord,
Underscore
}