diff options
author | Nadrieril Feneanar | 2020-03-05 16:20:07 +0000 |
---|---|---|
committer | GitHub | 2020-03-05 16:20:07 +0000 |
commit | 3f9194f47185fe30c9e410aa7c5e651df9694b3f (patch) | |
tree | 6d24b2e824822134da4976b65b413dc09ca4e567 /dhall/src/syntax/text | |
parent | 2ca97e97f1718141d826a78ab3da8197b2d55c69 (diff) | |
parent | 8e6b020ba1426c215382a81395b809b688fa7726 (diff) |
Merge pull request #139 from Nadrieril/missing-features
Implement a bunch of missing features
Diffstat (limited to 'dhall/src/syntax/text')
-rw-r--r-- | dhall/src/syntax/text/parser.rs | 18 | ||||
-rw-r--r-- | dhall/src/syntax/text/printer.rs | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index ba64a75..7140332 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -10,7 +10,7 @@ use crate::syntax::map::{DupTreeMap, DupTreeSet}; use crate::syntax::ExprKind::*; use crate::syntax::LitKind::*; use crate::syntax::{ - Double, Expr, FilePath, FilePrefix, Hash, ImportLocation, ImportMode, + Double, Expr, FilePath, FilePrefix, Hash, ImportMode, ImportTarget, Integer, InterpolatedText, InterpolatedTextContents, Label, NaiveDouble, Natural, Scheme, Span, UnspannedExpr, URL, V, }; @@ -483,9 +483,9 @@ impl DhallParser { } #[alias(import_type)] - fn local(input: ParseInput) -> ParseResult<ImportLocation<Expr>> { + fn local(input: ParseInput) -> ParseResult<ImportTarget<Expr>> { Ok(match_nodes!(input.into_children(); - [local_path((prefix, p))] => ImportLocation::Local(prefix, p), + [local_path((prefix, p))] => ImportTarget::Local(prefix, p), )) } @@ -550,17 +550,17 @@ impl DhallParser { } #[alias(import_type)] - fn http(input: ParseInput) -> ParseResult<ImportLocation<Expr>> { - Ok(ImportLocation::Remote(match_nodes!(input.into_children(); + fn http(input: ParseInput) -> ParseResult<ImportTarget<Expr>> { + Ok(ImportTarget::Remote(match_nodes!(input.into_children(); [http_raw(url)] => url, [http_raw(url), expression(e)] => URL { headers: Some(e), ..url }, ))) } #[alias(import_type)] - fn env(input: ParseInput) -> ParseResult<ImportLocation<Expr>> { + fn env(input: ParseInput) -> ParseResult<ImportTarget<Expr>> { Ok(match_nodes!(input.into_children(); - [environment_variable(v)] => ImportLocation::Env(v), + [environment_variable(v)] => ImportTarget::Env(v), )) } #[alias(environment_variable)] @@ -593,8 +593,8 @@ impl DhallParser { } #[alias(import_type)] - fn missing(_input: ParseInput) -> ParseResult<ImportLocation<Expr>> { - Ok(ImportLocation::Missing) + fn missing(_input: ParseInput) -> ParseResult<ImportTarget<Expr>> { + Ok(ImportTarget::Missing) } fn hash(input: ParseInput) -> ParseResult<Hash> { diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index 8891d41..5bb987b 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -379,8 +379,8 @@ impl Display for Hash { impl<SubExpr: Display> Display for Import<SubExpr> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { use FilePrefix::*; - use ImportLocation::*; use ImportMode::*; + use ImportTarget::*; let quote_if_needed = |s: &str| -> String { if s.chars().all(|c| c.is_ascii_alphanumeric()) { s.to_string() @@ -406,7 +406,7 @@ impl<SubExpr: Display> Display for Import<SubExpr> { f.write_str(&path)?; } Remote(url) => { - write!(f, "{}://{}/", url.scheme, url.authority,)?; + write!(f, "{}://{}/", url.scheme, url.authority)?; let path: String = url.path.file_path.iter().join("/"); f.write_str(&path)?; if let Some(q) = &url.query { |