aboutsummaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-04-30 16:53:14 +0100
committertslil <tslil@posteo.de>2026-04-30 17:30:22 +0100
commit0f7efe7518b925d9688dad4c6f6e87f84015e2c1 (patch)
treef4cdfa08c7d3e7a69860570f3f7826119f3bcdef /src/ast.rs
parentd57f1d3c845220c741db73c1fada017a75b11992 (diff)
wip case for instances
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ast.rs b/src/ast.rs
index d13b2a8..24d5b9b 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -143,6 +143,14 @@ pub struct InstAssign {
}
#[derive(Clone, PartialEq, Display, Debug)]
+#[display(".{tag} {bound} => {body}")]
+pub struct InstCaseArm {
+ pub tag: String,
+ pub bound: String,
+ pub body: Instance,
+}
+
+#[derive(Clone, PartialEq, Display, Debug)]
pub enum Instance {
#[display("({_0} :: Set)")]
SetCoerce(Box<Set>),
@@ -167,6 +175,12 @@ pub enum Instance {
instance: Box<Instance>,
field: String,
},
+
+ #[display("case {} of {{ {} }}", scrutinee, arms.iter().map(|a| a.to_string()).collect::<Vec<_>>().join(" | "))]
+ Case {
+ scrutinee: Box<Element>,
+ arms: Vec<InstCaseArm>,
+ },
}
// Declarations