summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Cargo.lock169
-rw-r--r--dhall/Cargo.toml5
-rw-r--r--dhall/src/syntax/ast/map.rs316
3 files changed, 170 insertions, 320 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b196894..de01002 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -13,8 +13,8 @@ name = "abnf_to_pest"
version = "0.1.1"
dependencies = [
"abnf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -27,11 +27,16 @@ dependencies = [
]
[[package]]
+name = "autocfg"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "block-buffer"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -39,7 +44,7 @@ dependencies = [
[[package]]
name = "block-padding"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -51,22 +56,17 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "bytecount"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "byteorder"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ctor"
-version = "0.1.10"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -74,20 +74,17 @@ name = "dhall"
version = "0.1.0"
dependencies = [
"abnf_to_pest 0.1.1",
- "bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "improved_slice_patterns 2.0.0",
- "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_consume 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_cbor 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -95,10 +92,10 @@ dependencies = [
name = "dhall_proc_macros"
version = "0.1.0"
dependencies = [
- "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -116,7 +113,7 @@ dependencies = [
[[package]]
name = "either"
-version = "1.5.2"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -134,7 +131,7 @@ dependencies = [
[[package]]
name = "half"
-version = "1.3.0"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -148,24 +145,18 @@ version = "2.0.0"
[[package]]
name = "indexmap"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "itertools"
-version = "0.8.0"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
-name = "kernel32-sys"
-version = "0.2.2"
+name = "itertools"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -226,7 +217,7 @@ dependencies = [
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_consume_macros 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -234,10 +225,10 @@ name = "pest_consume_macros"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -256,9 +247,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pest 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pest_meta 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -276,7 +267,7 @@ name = "pretty"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "typed-arena 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typed-arena 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -285,24 +276,24 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ctor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro-hack"
-version = "0.5.9"
+version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
-version = "1.0.2"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -313,7 +304,7 @@ name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -326,10 +317,10 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.99"
+version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -338,18 +329,18 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "half 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
-version = "1.0.99"
+version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -358,7 +349,7 @@ version = "0.1.0"
dependencies = [
"dhall 0.1.0",
"dhall_proc_macros 0.1.0",
- "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -373,11 +364,16 @@ dependencies = [
]
[[package]]
+name = "smallvec"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "syn"
-version = "1.0.5"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -388,25 +384,8 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "term"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "term-painter"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "typed-arena"
-version = "1.5.0"
+version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -441,11 +420,6 @@ dependencies = [
[[package]]
name = "winapi"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -454,11 +428,6 @@ dependencies = [
]
[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -479,22 +448,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum abnf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d972ae01fad2d4693b272854546bd763966c95575a4f1d6333dc95b85ff182db"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
+"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
-"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09"
+"checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
-"checksum bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be0fdd54b507df8f22012890aadd099979befdba27713c767993f8380112ca7c"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
-"checksum ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5b6b2f4752cc29efbfd03474c532ce8f916f2d44ec5bb8c21f93bc76e5365528"
+"checksum ctor 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8ce37ad4184ab2ce004c33bf6379185d3b1c95801cab51026bd271bf68eedc"
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
-"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b"
+"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
-"checksum half 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9353c2a89d550b58fa0061d8ed8d002a7d8cdf2494eb0e432859bd3a9e543836"
+"checksum half 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ff54597ea139063f4225f1ec47011b03c9de4a486957ff3fc506881dac951d0"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
-"checksum indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4d6d89e0948bf10c08b9ecc8ac5b83f07f857ebe2c0cbe38de15b4e4f510356"
-"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
-"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
+"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2"
+"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
@@ -510,27 +478,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum pest_meta 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "df43fd99896fd72c485fe47542c7b500e4ac1e8700bf995544d1317a60ded547"
"checksum pretty 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f60c0d9f6fc88ecdd245d90c1920ff76a430ab34303fc778d33b1d0a4c3bf6d3"
"checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427"
-"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8"
-"checksum proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "175a40b9cf564ce9bf050654633dbf339978706b8ead1a907bb970b63185dd95"
+"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
+"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"
-"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
+"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
"checksum serde_cbor 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45cd6d95391b16cd57e88b68be41d504183b7faae22030c0cc3b3f73dd57b2fd"
-"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
+"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68"
-"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
+"checksum smallvec 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44e59e0c9fa00817912ae6e4e6e3c4fe04455e75699d06eedc7d85917ed8e8f4"
+"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
-"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"
-"checksum term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dcaa948f0e3e38470cd8dc8dcfe561a75c9e43f28075bb183845be2b9b3c08cf"
-"checksum typed-arena 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f70f5c346cc11bc044ae427ab2feae213350dca9e2d637047797d5ff316a646"
+"checksum typed-arena 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
"checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
-"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
-"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/dhall/Cargo.toml b/dhall/Cargo.toml
index 962b466..a93153d 100644
--- a/dhall/Cargo.toml
+++ b/dhall/Cargo.toml
@@ -7,9 +7,6 @@ edition = "2018"
build = "build.rs"
[dependencies]
-bytecount = "0.5.1"
-either = "1.5.2"
-improved_slice_patterns = { version = "2.0.0", path = "../improved_slice_patterns" }
itertools = "0.8.0"
hex = "0.3.2"
lazy_static = "1.4.0"
@@ -19,8 +16,8 @@ pest = "2.1"
pest_consume = "1.0"
serde = { version = "1.0" }
serde_cbor = "0.9.0"
+smallvec = "1.0.0"
take_mut = "0.2.2"
-term-painter = "0.2.3"
[dev-dependencies]
pretty_assertions = "0.6.1"
diff --git a/dhall/src/syntax/ast/map.rs b/dhall/src/syntax/ast/map.rs
index c4c6126..8b896c0 100644
--- a/dhall/src/syntax/ast/map.rs
+++ b/dhall/src/syntax/ast/map.rs
@@ -2,136 +2,112 @@
pub use dup_tree_map::DupTreeMap;
pub use dup_tree_set::DupTreeSet;
-mod one_or_more {
- use either::Either;
- use std::{iter, slice, vec};
-
- #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
- pub enum OneOrMore<T> {
- One(T),
- More(Vec<T>),
+mod known_size_iter {
+ pub struct KnownSizeIterator<I> {
+ pub iter: I,
+ pub size: usize,
}
- pub type Iter<'a, T> = Either<slice::Iter<'a, T>, iter::Once<&'a T>>;
- pub type IterMut<'a, T> =
- Either<slice::IterMut<'a, T>, iter::Once<&'a mut T>>;
- pub type IntoIter<T> = Either<vec::IntoIter<T>, iter::Once<T>>;
-
- impl<T> OneOrMore<T> {
- pub fn new(x: T) -> Self {
- OneOrMore::One(x)
- }
+ impl<I: Iterator> Iterator for KnownSizeIterator<I> {
+ type Item = I::Item;
- pub fn push(&mut self, x: T) {
- take_mut::take(self, |sef| match sef {
- OneOrMore::More(mut vec) => {
- vec.push(x);
- OneOrMore::More(vec)
- }
- OneOrMore::One(one) => OneOrMore::More(vec![one, x]),
- })
- }
-
- pub fn iter(&self) -> Iter<'_, T> {
- match self {
- OneOrMore::More(vec) => Either::Left(vec.iter()),
- OneOrMore::One(x) => Either::Right(iter::once(x)),
+ fn next(&mut self) -> Option<Self::Item> {
+ let next = self.iter.next();
+ if next.is_some() {
+ self.size -= 1;
}
+ next
}
- pub fn iter_mut(&mut self) -> IterMut<'_, T> {
- match self {
- OneOrMore::More(vec) => Either::Left(vec.iter_mut()),
- OneOrMore::One(x) => Either::Right(iter::once(x)),
- }
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ (self.size, Some(self.size))
}
}
- impl<T> IntoIterator for OneOrMore<T> {
- type Item = T;
- type IntoIter = IntoIter<T>;
+ // unsafe impl<I: Iterator> iter::TrustedLen for KnownSizeIterator<I> {}
+}
- fn into_iter(self) -> Self::IntoIter {
- match self {
- OneOrMore::More(vec) => Either::Left(vec.into_iter()),
- OneOrMore::One(x) => Either::Right(iter::once(x)),
- }
- }
+mod tuple {
+ mod sealed {
+ pub trait Sealed {}
+ }
+ pub trait Tuple: sealed::Sealed {
+ type First;
+ type Second;
+ }
+ impl<A, B> sealed::Sealed for (A, B) {}
+ impl<A, B> Tuple for (A, B) {
+ type First = A;
+ type Second = B;
}
}
mod dup_tree_map {
- use super::one_or_more;
- use super::one_or_more::OneOrMore;
- use std::collections::{btree_map, BTreeMap};
+ use super::known_size_iter::KnownSizeIterator;
+ use super::tuple::Tuple;
+ use smallvec::SmallVec;
+ use std::collections::BTreeMap;
use std::iter;
+ type OneOrMore<V> = SmallVec<[V; 1]>;
+ type DupTreeMapInternal<K, V> = BTreeMap<K, OneOrMore<V>>;
+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DupTreeMap<K, V> {
- map: BTreeMap<K, OneOrMore<V>>,
+ map: DupTreeMapInternal<K, V>,
size: usize,
}
- pub type IterInternalIntermediate<'a, K, V> =
- iter::Zip<iter::Repeat<&'a K>, one_or_more::Iter<'a, V>>;
- pub type IterInternal<'a, K, V> = iter::FlatMap<
- btree_map::Iter<'a, K, OneOrMore<V>>,
- IterInternalIntermediate<'a, K, V>,
- for<'b> fn(
- (&'b K, &'b OneOrMore<V>),
- ) -> IterInternalIntermediate<'b, K, V>,
+ // Generic types and functions to construct the iterators for this struct.
+ type ZipRepeatIter<T> = iter::Zip<
+ iter::Repeat<<T as Tuple>::First>,
+ <<T as Tuple>::Second as IntoIterator>::IntoIter,
>;
- pub struct Iter<'a, K, V> {
- iter: IterInternal<'a, K, V>,
- size: usize,
- }
- pub type IterMutInternalIntermediate<'a, K, V> =
- iter::Zip<iter::Repeat<&'a K>, one_or_more::IterMut<'a, V>>;
- pub type IterMutInternal<'a, K, V> = iter::FlatMap<
- btree_map::IterMut<'a, K, OneOrMore<V>>,
- IterMutInternalIntermediate<'a, K, V>,
- for<'b> fn(
- (&'b K, &'b mut OneOrMore<V>),
- ) -> IterMutInternalIntermediate<'b, K, V>,
+ type DupTreeMapIter<M> = KnownSizeIterator<
+ iter::FlatMap<
+ <M as IntoIterator>::IntoIter,
+ ZipRepeatIter<<M as IntoIterator>::Item>,
+ fn(
+ <M as IntoIterator>::Item,
+ ) -> ZipRepeatIter<<M as IntoIterator>::Item>,
+ >,
>;
- pub struct IterMut<'a, K, V> {
- iter: IterMutInternal<'a, K, V>,
- size: usize,
+
+ fn zip_repeat<'a, K, I>((k, iter): (K, I)) -> ZipRepeatIter<(K, I)>
+ where
+ K: Clone,
+ I: IntoIterator,
+ {
+ iter::repeat(k).zip(iter.into_iter())
}
- pub type IntoIterInternalIntermediate<K, V> =
- iter::Zip<iter::Repeat<K>, one_or_more::IntoIter<V>>;
- pub type IntoIterInternal<K, V> = iter::FlatMap<
- btree_map::IntoIter<K, OneOrMore<V>>,
- IntoIterInternalIntermediate<K, V>,
- fn((K, OneOrMore<V>)) -> IntoIterInternalIntermediate<K, V>,
- >;
- pub struct IntoIter<K: Clone, V> {
- iter: IntoIterInternal<K, V>,
- size: usize,
+
+ fn make_map_iter<M, K, I>(map: M, size: usize) -> DupTreeMapIter<M>
+ where
+ M: IntoIterator<Item = (K, I)>,
+ K: Clone,
+ I: IntoIterator,
+ {
+ KnownSizeIterator {
+ iter: map.into_iter().flat_map(zip_repeat),
+ size,
+ }
}
- impl<K, V> DupTreeMap<K, V> {
- pub fn new() -> Self
- where
- K: Ord,
- {
+ pub type IterMut<'a, K, V> =
+ DupTreeMapIter<&'a mut DupTreeMapInternal<K, V>>;
+ pub type Iter<'a, K, V> = DupTreeMapIter<&'a DupTreeMapInternal<K, V>>;
+ pub type IntoIter<K, V> = DupTreeMapIter<DupTreeMapInternal<K, V>>;
+
+ impl<K: Ord, V> DupTreeMap<K, V> {
+ pub fn new() -> Self {
DupTreeMap {
map: BTreeMap::new(),
size: 0,
}
}
- pub fn insert(&mut self, key: K, value: V)
- where
- K: Ord,
- {
- use std::collections::btree_map::Entry;
- match self.map.entry(key) {
- Entry::Vacant(e) => {
- e.insert(OneOrMore::new(value));
- }
- Entry::Occupied(mut e) => e.get_mut().push(value),
- }
+ pub fn insert(&mut self, key: K, value: V) {
+ self.map.entry(key).or_default().push(value);
self.size += 1;
}
@@ -142,34 +118,12 @@ mod dup_tree_map {
self.size == 0
}
- pub fn iter(&self) -> Iter<'_, K, V>
- where
- K: Ord,
- {
- fn foo<'a, K, V>(
- (k, oom): (&'a K, &'a OneOrMore<V>),
- ) -> IterInternalIntermediate<'a, K, V> {
- iter::repeat(k).zip(oom.iter())
- }
- Iter {
- iter: self.map.iter().flat_map(foo),
- size: self.size,
- }
+ pub fn iter(&self) -> Iter<'_, K, V> {
+ make_map_iter(&self.map, self.size)
}
- pub fn iter_mut(&mut self) -> IterMut<'_, K, V>
- where
- K: Ord,
- {
- fn foo<'a, K, V>(
- (k, oom): (&'a K, &'a mut OneOrMore<V>),
- ) -> IterMutInternalIntermediate<'a, K, V> {
- iter::repeat(k).zip(oom.iter_mut())
- }
- IterMut {
- iter: self.map.iter_mut().flat_map(foo),
- size: self.size,
- }
+ pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
+ make_map_iter(&mut self.map, self.size)
}
}
@@ -190,24 +144,14 @@ mod dup_tree_map {
type IntoIter = IntoIter<K, V>;
fn into_iter(self) -> Self::IntoIter {
- fn foo<K, V>(
- (k, oom): (K, OneOrMore<V>),
- ) -> IntoIterInternalIntermediate<K, V>
- where
- K: Clone,
- {
- iter::repeat(k).zip(oom.into_iter())
- }
- IntoIter {
- iter: self.map.into_iter().flat_map(foo),
- size: self.size,
- }
+ make_map_iter(self.map, self.size)
}
}
impl<'a, K, V> IntoIterator for &'a DupTreeMap<K, V>
where
- K: Ord,
+ K: Ord + 'a,
+ V: 'a,
{
type Item = (&'a K, &'a V);
type IntoIter = Iter<'a, K, V>;
@@ -219,7 +163,8 @@ mod dup_tree_map {
impl<'a, K, V> IntoIterator for &'a mut DupTreeMap<K, V>
where
- K: Ord,
+ K: Ord + 'a,
+ V: 'a,
{
type Item = (&'a K, &'a mut V);
type IntoIter = IterMut<'a, K, V>;
@@ -244,62 +189,10 @@ mod dup_tree_map {
map
}
}
-
- impl<'a, K, V> Iterator for Iter<'a, K, V> {
- type Item = (&'a K, &'a V);
-
- fn next(&mut self) -> Option<Self::Item> {
- let next = self.iter.next();
- if next.is_some() {
- self.size -= 1;
- }
- next
- }
-
- fn size_hint(&self) -> (usize, Option<usize>) {
- (self.size, Some(self.size))
- }
- }
-
- impl<'a, K, V> Iterator for IterMut<'a, K, V> {
- type Item = (&'a K, &'a mut V);
-
- fn next(&mut self) -> Option<Self::Item> {
- let next = self.iter.next();
- if next.is_some() {
- self.size -= 1;
- }
- next
- }
-
- fn size_hint(&self) -> (usize, Option<usize>) {
- (self.size, Some(self.size))
- }
- }
-
- impl<K, V> Iterator for IntoIter<K, V>
- where
- K: Clone,
- {
- type Item = (K, V);
-
- fn next(&mut self) -> Option<Self::Item> {
- let next = self.iter.next();
- if next.is_some() {
- self.size -= 1;
- }
- next
- }
-
- fn size_hint(&self) -> (usize, Option<usize>) {
- (self.size, Some(self.size))
- }
- }
-
- // unsafe impl<K, V> iter::TrustedLen for IntoIter<K, V> {}
}
mod dup_tree_set {
+ use super::tuple::Tuple;
use super::DupTreeMap;
use std::iter;
@@ -308,18 +201,22 @@ mod dup_tree_set {
map: DupTreeMap<K, ()>,
}
- pub type Iter<'a, K> = iter::Map<
- super::dup_tree_map::Iter<'a, K, ()>,
- for<'b> fn((&'b K, &'b ())) -> &'b K,
+ type DupTreeSetIter<M> = iter::Map<
+ <M as IntoIterator>::IntoIter,
+ fn(
+ <M as IntoIterator>::Item,
+ ) -> <<M as IntoIterator>::Item as Tuple>::First,
>;
- pub type IntoIter<K> =
- iter::Map<super::dup_tree_map::IntoIter<K, ()>, fn((K, ())) -> K>;
- impl<K> DupTreeSet<K> {
- pub fn new() -> Self
- where
- K: Ord,
- {
+ pub type Iter<'a, K> = DupTreeSetIter<&'a DupTreeMap<K, ()>>;
+ pub type IntoIter<K> = DupTreeSetIter<DupTreeMap<K, ()>>;
+
+ fn drop_second<A, B>((a, _): (A, B)) -> A {
+ a
+ }
+
+ impl<K: Ord> DupTreeSet<K> {
+ pub fn new() -> Self {
DupTreeSet {
map: DupTreeMap::new(),
}
@@ -332,14 +229,8 @@ mod dup_tree_set {
self.map.is_empty()
}
- pub fn iter(&self) -> Iter<'_, K>
- where
- K: Ord,
- {
- fn foo<'a, K>((k, ()): (&'a K, &'a ())) -> &'a K {
- k
- }
- self.map.iter().map(foo)
+ pub fn iter<'a>(&'a self) -> Iter<'a, K> {
+ self.map.iter().map(drop_second)
}
}
@@ -360,16 +251,13 @@ mod dup_tree_set {
type IntoIter = IntoIter<K>;
fn into_iter(self) -> Self::IntoIter {
- fn foo<K>((k, ()): (K, ())) -> K {
- k
- }
- self.map.into_iter().map(foo)
+ self.map.into_iter().map(drop_second)
}
}
impl<'a, K> IntoIterator for &'a DupTreeSet<K>
where
- K: Ord,
+ K: Ord + 'a,
{
type Item = &'a K;
type IntoIter = Iter<'a, K>;