summaryrefslogtreecommitdiff
path: root/dhall_core/src
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_core/src')
-rw-r--r--dhall_core/src/core.rs10
-rw-r--r--dhall_core/src/parser.rs4
2 files changed, 13 insertions, 1 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs
index 72389c5..3b98b39 100644
--- a/dhall_core/src/core.rs
+++ b/dhall_core/src/core.rs
@@ -376,6 +376,16 @@ impl<'i, S: Clone, A: Clone> Expr<&'i str, S, A> {
}
}
+impl<L: StringLike, S: Clone, A: Clone> Expr<L, S, Expr<L, S, A>> {
+ pub fn squash_embed(&self) -> Expr<L, S, A>
+ {
+ match self {
+ Expr::Embed(e) => e.clone(),
+ e => e.map_shallow(|e| e.squash_embed(), |x| x.clone(), |_| unreachable!(), |x| x.clone())
+ }
+ }
+}
+
// There is a one-to-one correspondence between the formatters in this section
// and the grammar in grammar.lalrpop. Each formatter is named after the
// corresponding grammar rule and the relationship between formatters exactly matches
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs
index 9d0a88b..164d410 100644
--- a/dhall_core/src/parser.rs
+++ b/dhall_core/src/parser.rs
@@ -486,7 +486,9 @@ rule!(integer_literal_raw<core::Integer>;
}
);
-rule!(path<PathBuf>; captured_str!(s) => s.into());
+rule!(path<PathBuf>;
+ captured_str!(s) => (".".to_owned() + s).into()
+);
rule!(parent_path<(FilePrefix, PathBuf)>;
children!(p: path) => (FilePrefix::Parent, p)