From 505e6a34cc5aadac1831d31ef64b94b61c2ace13 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 Mar 2019 00:42:46 +0100 Subject: First import works ! --- dhall_core/src/core.rs | 10 ++++++++++ dhall_core/src/parser.rs | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'dhall_core/src') 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 Expr> { + pub fn squash_embed(&self) -> Expr + { + 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; } ); -rule!(path; captured_str!(s) => s.into()); +rule!(path; + captured_str!(s) => (".".to_owned() + s).into() +); rule!(parent_path<(FilePrefix, PathBuf)>; children!(p: path) => (FilePrefix::Parent, p) -- cgit v1.2.3