summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/ast
diff options
context:
space:
mode:
authorNadrieril Feneanar2020-03-05 16:20:07 +0000
committerGitHub2020-03-05 16:20:07 +0000
commit3f9194f47185fe30c9e410aa7c5e651df9694b3f (patch)
tree6d24b2e824822134da4976b65b413dc09ca4e567 /dhall/src/syntax/ast
parent2ca97e97f1718141d826a78ab3da8197b2d55c69 (diff)
parent8e6b020ba1426c215382a81395b809b688fa7726 (diff)
Merge pull request #139 from Nadrieril/missing-features
Implement a bunch of missing features
Diffstat (limited to 'dhall/src/syntax/ast')
-rw-r--r--dhall/src/syntax/ast/expr.rs2
-rw-r--r--dhall/src/syntax/ast/import.rs10
-rw-r--r--dhall/src/syntax/ast/text.rs29
3 files changed, 6 insertions, 35 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs
index bb1a5b3..ce0a3d2 100644
--- a/dhall/src/syntax/ast/expr.rs
+++ b/dhall/src/syntax/ast/expr.rs
@@ -178,7 +178,7 @@ pub enum ExprKind<SubExpr> {
Field(SubExpr, Label),
/// `e.{ x, y, z }`
Projection(SubExpr, DupTreeSet<Label>),
- /// `e.(s)`
+ /// `e.(t)`
ProjectionByExpr(SubExpr, SubExpr),
/// `x::y`
Completion(SubExpr, SubExpr),
diff --git a/dhall/src/syntax/ast/import.rs b/dhall/src/syntax/ast/import.rs
index 7bde6e0..75d7946 100644
--- a/dhall/src/syntax/ast/import.rs
+++ b/dhall/src/syntax/ast/import.rs
@@ -18,7 +18,7 @@ pub struct FilePath {
/// The location of import (i.e. local vs. remote vs. environment)
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
-pub enum ImportLocation<SubExpr> {
+pub enum ImportTarget<SubExpr> {
Local(FilePrefix, FilePath),
Remote(URL<SubExpr>),
Env(String),
@@ -57,7 +57,7 @@ pub enum Hash {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Import<SubExpr> {
pub mode: ImportMode,
- pub location: ImportLocation<SubExpr>,
+ pub location: ImportTarget<SubExpr>,
pub hash: Option<Hash>,
}
@@ -77,12 +77,12 @@ impl<SE> URL<SE> {
}
}
-impl<SE> ImportLocation<SE> {
+impl<SE> ImportTarget<SE> {
pub fn traverse_ref<'a, Err, SE2>(
&'a self,
f: impl FnOnce(&'a SE) -> Result<SE2, Err>,
- ) -> Result<ImportLocation<SE2>, Err> {
- use ImportLocation::*;
+ ) -> Result<ImportTarget<SE2>, Err> {
+ use ImportTarget::*;
Ok(match self {
Local(prefix, path) => Local(*prefix, path.clone()),
Remote(url) => Remote(url.traverse_ref(f)?),
diff --git a/dhall/src/syntax/ast/text.rs b/dhall/src/syntax/ast/text.rs
index 83aaf9a..c40f4a1 100644
--- a/dhall/src/syntax/ast/text.rs
+++ b/dhall/src/syntax/ast/text.rs
@@ -54,16 +54,6 @@ impl<SubExpr> InterpolatedTextContents<SubExpr> {
Text(s) => Text(s.clone()),
})
}
- pub fn traverse_mut<'a, E, F>(&'a mut self, mut f: F) -> Result<(), E>
- where
- F: FnMut(&'a mut SubExpr) -> Result<(), E>,
- {
- use InterpolatedTextContents::Expr;
- if let Expr(e) = self {
- f(e)?;
- }
- Ok(())
- }
pub fn map_ref<'a, SubExpr2, F>(
&'a self,
mut f: F,
@@ -77,15 +67,6 @@ impl<SubExpr> InterpolatedTextContents<SubExpr> {
Text(s) => Text(s.clone()),
}
}
- pub fn map_mut<'a, F>(&'a mut self, mut f: F)
- where
- F: FnMut(&'a mut SubExpr),
- {
- use InterpolatedTextContents::Expr;
- if let Expr(e) = self {
- f(e);
- }
- }
}
impl<SubExpr> InterpolatedText<SubExpr> {
@@ -126,16 +107,6 @@ impl<SubExpr> InterpolatedText<SubExpr> {
})
}
- pub fn traverse_mut<'a, E, F>(&'a mut self, mut f: F) -> Result<(), E>
- where
- F: FnMut(&'a mut SubExpr) -> Result<(), E>,
- {
- for (e, _) in &mut self.tail {
- f(e)?
- }
- Ok(())
- }
-
pub fn iter<'a>(
&'a self,
) -> impl Iterator<Item = InterpolatedTextContents<&'a SubExpr>> + 'a {