diff options
author | Nadrieril | 2019-03-09 00:42:46 +0100 |
---|---|---|
committer | Nadrieril | 2019-03-09 00:43:13 +0100 |
commit | 505e6a34cc5aadac1831d31ef64b94b61c2ace13 (patch) | |
tree | 1cca4b507552df613c9852d755e9ada8dee67d7d /dhall_core/src | |
parent | c6aafe818ca56ec8bc6d3cd27824eba0a2d6b874 (diff) |
First import works !
Diffstat (limited to 'dhall_core/src')
-rw-r--r-- | dhall_core/src/core.rs | 10 | ||||
-rw-r--r-- | dhall_core/src/parser.rs | 4 |
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) |