aboutsummaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-04-24 08:37:02 +0100
committertslil <tslil@posteo.de>2026-04-24 09:36:19 +0100
commit85f0f5bd9ba573ad288ed582399b37e126f598c9 (patch)
treef7f8ccd2c3ab564bfffc7b4f65f2f513f668e282 /src/parser.rs
parentca4fb6dd0d47054688e8ce3cd3931983ddf7eecf (diff)
checking for injections, projections, rm vesitigial App
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 8b75c2c..5dd777b 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -120,7 +120,7 @@ parser! {
rule set() -> Set
= kw_record() _ "{" fs:(set_field() ** ",") _ "}" { Set::Record(fs) }
- / kw_variant() _ "{" _ vs:(variant_field() ** "|") "}" { Set::Variant(vs) }
+ / kw_variant() _ "[" _ vs:(variant_field() ** "|") "]" { Set::Variant(vs) }
/ b:builtin() { Set::BuiltIn(b) }
/ i:claimed_set() { Set::ClaimedSet(i) }
/ v:set_var() { Set::Var(v) }
@@ -165,20 +165,12 @@ parser! {
})
}
- rule app_elem() -> Element
- = head:dot_elem() tail:(__ d:dot_elem() { d })*
- {
- tail.into_iter().fold(head, |acc, a| {
- Element::App(Box::new(acc), Box::new(a))
- })
- }
-
rule case_arm() -> CaseArm
= t:inject() _ x:elem_var() _ "=>" _ body:element() { CaseArm { tag: t, bound: x, body } }
rule element() -> Element
= kw_case() __ scrut:element() _ kw_of() _ "{" arms:(_ a:case_arm() _ { a }) ** "|" _ "}" { Element::Case { scrutinee: Box::new(scrut), arms } }
- / app_elem()
+ / d:dot_elem() { d }
// instance layer
@@ -258,10 +250,10 @@ let set Config = record {
.label : Str
}
-let set Maybe = variant {
+let set Maybe = variant [
none. : record {}
| some. : Config
-}
+]
"#;
debug_parse(src);