diff options
Diffstat (limited to 'dhall_core/src')
-rw-r--r-- | dhall_core/src/parser.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index a335ccc..b463073 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -895,7 +895,8 @@ make_parser! { )); rule!(union_type_entry<(Label, Option<ParsedSubExpr<'a>>)>; children!( - [label(name), expression(expr)] => (name, Option::Some(rc(expr))) + [label(name), expression(expr)] => (name, Option::Some(rc(expr))), + [label(name)] => (name, Option::None), )); // TODO: unary union variants @@ -910,6 +911,12 @@ make_parser! { [expression(e)] => { (Option::Some(rc(e)), (Option::None, BTreeMap::new())) }, + [non_empty_union_type_or_literal(rest)] => { + (Option::None, rest) + }, + [] => { + (Option::None, (Option::None, BTreeMap::new())) + }, )); rule!(non_empty_list_literal<ParsedExpr<'a>> as expression; span; |