conlang: PATTERN MATCHING AND DESTRUCTURED BINDINGS WOOOOO
- Integrate the Match and Pattern nodes into the AST
- TODO: `let x: T` is ambiguous with `let x: {}`. Currently the latter takes precedence in the parser.
- Implement pattern matching through unification in the interpreter.
- It's not fast, but it works!
- Refactor destructuring assignments to use the new pattern functionality
This commit is contained in:
@@ -119,6 +119,10 @@ pub enum Parsing {
|
||||
Break,
|
||||
Return,
|
||||
Continue,
|
||||
|
||||
Pattern,
|
||||
Match,
|
||||
MatchArm,
|
||||
}
|
||||
|
||||
impl Display for Error {
|
||||
@@ -225,6 +229,10 @@ impl Display for Parsing {
|
||||
Parsing::Break => "a break expression",
|
||||
Parsing::Return => "a return expression",
|
||||
Parsing::Continue => "a continue expression",
|
||||
|
||||
Parsing::Pattern => "a pattern",
|
||||
Parsing::Match => "a match expression",
|
||||
Parsing::MatchArm => "a match arm",
|
||||
}
|
||||
.fmt(f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user