summaryrefslogtreecommitdiff
path: root/dhall_syntax
diff options
context:
space:
mode:
authorNadrieril2019-08-06 23:03:01 +0200
committerNadrieril2019-08-06 23:03:01 +0200
commitf7b0c6b9c52f65624dc765fb9eaa7d0d94eeae76 (patch)
treeb72b50561bb3f6f335699c76402819ed20bf42b9 /dhall_syntax
parenta307a13738ccca538635ae796e6c998439025b9b (diff)
Generalize empty list annotations
Diffstat (limited to 'dhall_syntax')
-rw-r--r--dhall_syntax/src/core/expr.rs2
-rw-r--r--dhall_syntax/src/parser.rs10
2 files changed, 7 insertions, 5 deletions
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<SubExpr, Embed> {
DoubleLit(Double),
/// `"Some ${interpolated} text"`
TextLit(InterpolatedText<SubExpr>),
- /// `[] : List t`
+ /// `[] : t`
EmptyListLit(SubExpr),
/// `[x, y, z]`
NEListLit(Vec<SubExpr>),
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<ParsedSubExpr> as expression; span; children!(
+ [expression(e)] => {
+ spanned(span, EmptyListLit(e))
+ },
+ ));
+
rule!(expression<ParsedSubExpr> 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,
));