summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/text/parser.rs
diff options
context:
space:
mode:
authorNadrieril2020-09-15 00:10:48 +0100
committerGitHub2020-09-15 00:10:48 +0100
commit12752fb0ff108fcbc37f209384eb3d2720809fb7 (patch)
treeb7aa0f75932426461234e4b7568a6681247482ff /dhall/src/syntax/text/parser.rs
parent97a3719a3b4fa88873cd128fb193444c5d4bb387 (diff)
parentd1ac40eea5d1e62762c4a20ba9d2dc5ed0d5e06e (diff)
Merge pull request #176 from Nadrieril/catchup-spec
Diffstat (limited to 'dhall/src/syntax/text/parser.rs')
-rw-r--r--dhall/src/syntax/text/parser.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs
index 06c1ac3..377f5e4 100644
--- a/dhall/src/syntax/text/parser.rs
+++ b/dhall/src/syntax/text/parser.rs
@@ -105,26 +105,6 @@ fn insert_recordlit_entry(map: &mut BTreeMap<Label, Expr>, l: Label, e: Expr) {
}
}
-fn desugar_with_expr(x: Expr, labels: &[Label], y: Expr) -> Expr {
- use crate::operations::BinOp::RightBiasedRecordMerge;
- let expr = |k| Expr::new(k, Span::WithSugar);
- match labels {
- [] => y,
- [l, rest @ ..] => {
- let res = desugar_with_expr(
- expr(Op(Field(x.clone(), l.clone()))),
- rest,
- y,
- );
- expr(Op(BinOp(
- RightBiasedRecordMerge,
- x,
- expr(RecordLit(once((l.clone(), res)).collect())),
- )))
- }
- }
-}
-
lazy_static::lazy_static! {
static ref PRECCLIMBER: PrecClimber<Rule> = {
use Rule::*;
@@ -778,7 +758,11 @@ impl DhallParser {
clauses.fold(
first,
|acc, (labels, e)| {
- desugar_with_expr(acc, &labels, e)
+ spanned_union(
+ acc.span(),
+ e.span(),
+ Op(With(acc, labels, e))
+ )
}
)
},