From f7b0c6b9c52f65624dc765fb9eaa7d0d94eeae76 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 23:03:01 +0200 Subject: Generalize empty list annotations --- dhall_syntax/src/core/expr.rs | 2 +- dhall_syntax/src/parser.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'dhall_syntax') diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs index e33859b..14dc165 100644 --- a/dhall_syntax/src/core/expr.rs +++ b/dhall_syntax/src/core/expr.rs @@ -190,7 +190,7 @@ pub enum ExprF { DoubleLit(Double), /// `"Some ${interpolated} text"` TextLit(InterpolatedText), - /// `[] : List t` + /// `[] : t` EmptyListLit(SubExpr), /// `[x, y, z]` NEListLit(Vec), diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs index 0832af3..8a84b00 100644 --- a/dhall_syntax/src/parser.rs +++ b/dhall_syntax/src/parser.rs @@ -727,6 +727,12 @@ make_parser! { token_rule!(if_<()>); token_rule!(in_<()>); + rule!(empty_list_literal as expression; span; children!( + [expression(e)] => { + spanned(span, EmptyListLit(e)) + }, + )); + rule!(expression as expression; span; children!( [lambda(()), label(l), expression(typ), arrow(()), expression(body)] => { @@ -751,10 +757,6 @@ make_parser! { [merge(()), expression(x), expression(y), expression(z)] => { spanned(span, Merge(x, y, Some(z))) }, - [List(()), expression(x)] => { - let list = unspanned(Builtin(crate::Builtin::List)); - spanned(span, EmptyListLit(unspanned(App(list, x)))) - }, [expression(e)] => e, )); -- cgit v1.2.3