Fixed bug

This commit is contained in:
Greg Shuflin 2021-11-20 22:46:48 -08:00
parent 5a38ff8f41
commit 194cb2202a

View File

@ -333,10 +333,16 @@ fn type_body(input: Span) -> ParseResult<TypeBody> {
}
fn record_variant(input: Span) -> ParseResult<VariantKind> {
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<Variant> {
@ -360,9 +366,9 @@ fn variant_spec(input: Span) -> ParseResult<Variant> {
fn record_variant_item(input: Span) -> ParseResult<(Rc<String>, 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<Declaration> {