diff options
author | Nadrieril | 2020-12-06 18:18:05 +0000 |
---|---|---|
committer | GitHub | 2020-12-06 18:18:05 +0000 |
commit | 35ed301e8de5a2b1102e370e638564d3c3d204a8 (patch) | |
tree | 0f84a9d5b60e00c49168fcf92eb34c903c088dde /dhall/src/semantics/parse.rs | |
parent | 3c0a850d1522701e136f4fafbcf69d46560fe0ee (diff) | |
parent | ee941f668977b66d9d829bc9c359f3a3b64f9dc1 (diff) |
Merge pull request #203 from Nadrieril/fix-import-bug
Diffstat (limited to 'dhall/src/semantics/parse.rs')
-rw-r--r-- | dhall/src/semantics/parse.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/dhall/src/semantics/parse.rs b/dhall/src/semantics/parse.rs index a770c15..5870d47 100644 --- a/dhall/src/semantics/parse.rs +++ b/dhall/src/semantics/parse.rs @@ -3,39 +3,38 @@ use url::Url; use crate::error::Error; use crate::semantics::resolve::{download_http_text, ImportLocation}; -use crate::syntax::binary; -use crate::syntax::parse_expr; +use crate::syntax::{binary, parse_expr}; use crate::Parsed; pub fn parse_file(f: &Path) -> Result<Parsed, Error> { let text = std::fs::read_to_string(f)?; let expr = parse_expr(&text)?; - let root = ImportLocation::Local(f.to_owned()); + let root = ImportLocation::local_dhall_code(f.to_owned()); Ok(Parsed(expr, root)) } pub fn parse_remote(url: Url) -> Result<Parsed, Error> { let body = download_http_text(url.clone())?; let expr = parse_expr(&body)?; - let root = ImportLocation::Remote(url); + let root = ImportLocation::remote_dhall_code(url); Ok(Parsed(expr, root)) } pub fn parse_str(s: &str) -> Result<Parsed, Error> { let expr = parse_expr(s)?; - let root = ImportLocation::Missing; + let root = ImportLocation::dhall_code_of_unknown_origin(); Ok(Parsed(expr, root)) } pub fn parse_binary(data: &[u8]) -> Result<Parsed, Error> { let expr = binary::decode(data)?; - let root = ImportLocation::Missing; + let root = ImportLocation::dhall_code_of_unknown_origin(); Ok(Parsed(expr, root)) } pub fn parse_binary_file(f: &Path) -> Result<Parsed, Error> { let data = crate::utils::read_binary_file(f)?; let expr = binary::decode(&data)?; - let root = ImportLocation::Local(f.to_owned()); + let root = ImportLocation::local_dhall_code(f.to_owned()); Ok(Parsed(expr, root)) } |