From 194cb2202a63e90815ba6069c188874f392092ca Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 20 Nov 2021 22:46:48 -0800 Subject: [PATCH] Fixed bug --- schala-lang/src/parsing/combinator.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/schala-lang/src/parsing/combinator.rs b/schala-lang/src/parsing/combinator.rs index f8ba61c..484ca2f 100644 --- a/schala-lang/src/parsing/combinator.rs +++ b/schala-lang/src/parsing/combinator.rs @@ -333,10 +333,16 @@ fn type_body(input: Span) -> ParseResult { } fn record_variant(input: Span) -> ParseResult { + context("record-variant", map( - delimited(tok(char('{')), separated_list1(tok(char(',')), record_variant_item), tok(char('}'))), + delimited( + pair(tok(char('{')), many0(statement_delimiter)), + terminated(separated_list1(pair(tok(char(',')), many0(statement_delimiter)), record_variant_item), + opt(tok(char(',')))), + pair(many0(statement_delimiter), tok(char('}'))) + ), VariantKind::Record, - )(input) + ))(input) } fn variant_spec(input: Span) -> ParseResult { @@ -360,9 +366,9 @@ fn variant_spec(input: Span) -> ParseResult { fn record_variant_item(input: Span) -> ParseResult<(Rc, TypeIdentifier)> { context("record-variant-item", - cut(map(tuple((identifier, tok(char(':')), type_identifier)), |(name, _, ty)| { + map(tuple((identifier, tok(char(':')), type_identifier)), |(name, _, ty)| { (rc_string(name.fragment()), ty) - })))(input) + }))(input) } fn binding(input: Span) -> ParseResult {