summaryrefslogtreecommitdiff
path: root/dhall_core/src/printer.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-21 22:08:23 +0100
committerNadrieril2019-03-21 22:08:23 +0100
commit4b99a3fb46191a83fa8551f21b98cff689bbb338 (patch)
tree0d07b39dbcf794c9fe1174aeb6fb4923df2fd9b7 /dhall_core/src/printer.rs
parentea08d2528d2ee46446ac8981e72af5c610e43ce1 (diff)
Improve import handling in parser
Diffstat (limited to '')
-rw-r--r--dhall_core/src/printer.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs
index e43f1be..bd38863 100644
--- a/dhall_core/src/printer.rs
+++ b/dhall_core/src/printer.rs
@@ -286,7 +286,19 @@ impl Display for Const {
impl Display for Import {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
- <Self as fmt::Debug>::fmt(self, f)
+ use FilePrefix::*;
+ use ImportLocation::*;
+ match &self.location {
+ Local(prefix, path) => {
+ let prefix = match prefix {
+ Here => ".",
+ Parent => "..",
+ Home => "~",
+ Absolute => "",
+ };
+ write!(f, "{}/{}", prefix, path.to_str().unwrap())
+ }
+ }
}
}