summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/binary
diff options
context:
space:
mode:
authorNadrieril2019-12-22 19:02:18 +0000
committerNadrieril2019-12-22 19:02:18 +0000
commite294450e1e76491e96019b8a3695463e09d1739b (patch)
tree01ef89cdc8c20960636bd9c2f46828c0a95f9427 /dhall/src/syntax/binary
parent54d7e61ad40682ee24e36288980ee4164ea87c34 (diff)
Implement parsing for record completion
Diffstat (limited to 'dhall/src/syntax/binary')
-rw-r--r--dhall/src/syntax/binary/decode.rs5
-rw-r--r--dhall/src/syntax/binary/encode.rs3
2 files changed, 8 insertions, 0 deletions
diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs
index 254ab07..c18deb5 100644
--- a/dhall/src/syntax/binary/decode.rs
+++ b/dhall/src/syntax/binary/decode.rs
@@ -98,6 +98,11 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
let l = Label::from(l.as_str());
Pi(l, x, y)
}
+ [U64(3), U64(13), x, y] => {
+ let x = cbor_value_to_dhall(&x)?;
+ let y = cbor_value_to_dhall(&y)?;
+ Completion(x, y)
+ }
[U64(3), U64(n), x, y] => {
let x = cbor_value_to_dhall(&x)?;
let y = cbor_value_to_dhall(&y)?;
diff --git a/dhall/src/syntax/binary/encode.rs b/dhall/src/syntax/binary/encode.rs
index 25a545c..867fc9c 100644
--- a/dhall/src/syntax/binary/encode.rs
+++ b/dhall/src/syntax/binary/encode.rs
@@ -164,6 +164,9 @@ where
ProjectionByExpr(x, y) => {
ser_seq!(ser; tag(10), expr(x), vec![expr(y)])
}
+ Completion(x, y) => {
+ ser_seq!(ser; tag(3), tag(13), expr(x), expr(y))
+ }
Import(import) => serialize_import(ser, import),
Embed(_) => unimplemented!(
"An expression with resolved imports cannot be binary-encoded"