From 67b98c47fce2b0795114b47291fcf467ebede63c Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 13 Mar 2020 22:52:20 -0700 Subject: [PATCH] tuple struct --- schala-lang/language/src/parser.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/schala-lang/language/src/parser.rs b/schala-lang/language/src/parser.rs index 6a3cff7..5c5538e 100644 --- a/schala-lang/language/src/parser.rs +++ b/schala-lang/language/src/parser.rs @@ -265,7 +265,14 @@ fn simple_pattern(text: &str) -> ParseResult { } fn tuple_struct_pattern(text: &str) -> ParseResult { - unimplemented!() + let p = tuple(( + qualified_name, + delimited(ws(tag("(")), + separated_nonempty_list(ws(tag(",")), ws(pattern)), + ws(tag(")")) + ) + )); + map(p, |(name, patterns)| Pattern::TupleStruct(name, patterns))(text) } fn record_pattern(text: &str) -> ParseResult {