From 45be2ff1f5bb3d6e0faa098402adf985b3d5e7ca Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 4 May 2019 12:38:36 +0200 Subject: Rename dhall_core to dhall_syntax --- dhall/src/binary.rs | 4 ++-- dhall/src/error.rs | 6 +++--- dhall/src/expr.rs | 4 ++-- dhall/src/imports.rs | 6 +++--- dhall/src/normalize.rs | 8 ++++---- dhall/src/serde.rs | 2 +- dhall/src/traits/dynamic_type.rs | 2 +- dhall/src/traits/static_type.rs | 2 +- dhall/src/typecheck.rs | 28 ++++++++++++++-------------- 9 files changed, 31 insertions(+), 31 deletions(-) (limited to 'dhall/src') diff --git a/dhall/src/binary.rs b/dhall/src/binary.rs index cadd456..9c31d4c 100644 --- a/dhall/src/binary.rs +++ b/dhall/src/binary.rs @@ -1,4 +1,4 @@ -use dhall_core::*; +use dhall_syntax::*; use itertools::*; use serde_cbor::value::value as cbor; @@ -19,7 +19,7 @@ pub fn decode(data: &[u8]) -> Result { fn cbor_value_to_dhall(data: &cbor::Value) -> Result { use cbor::Value::*; - use dhall_core::{BinOp, Builtin, Const}; + use dhall_syntax::{BinOp, Builtin, Const}; use ExprF::*; Ok(rc(match data { String(s) => match Builtin::parse(s) { diff --git a/dhall/src/error.rs b/dhall/src/error.rs index b987165..6ed0bfb 100644 --- a/dhall/src/error.rs +++ b/dhall/src/error.rs @@ -4,7 +4,7 @@ pub type Result = std::result::Result; #[non_exhaustive] pub enum Error { IO(std::io::Error), - Parse(dhall_core::ParseError), + Parse(dhall_syntax::ParseError), Decode(crate::binary::DecodeError), Resolve(crate::imports::ImportError), Typecheck(crate::typecheck::TypeError), @@ -30,8 +30,8 @@ impl From for Error { Error::IO(err) } } -impl From for Error { - fn from(err: dhall_core::ParseError) -> Error { +impl From for Error { + fn from(err: dhall_syntax::ParseError) -> Error { Error::Parse(err) } } diff --git a/dhall/src/expr.rs b/dhall/src/expr.rs index 9a161bd..b0b6215 100644 --- a/dhall/src/expr.rs +++ b/dhall/src/expr.rs @@ -1,6 +1,6 @@ use crate::imports::ImportRoot; use crate::normalize::{Thunk, Value}; -use dhall_core::*; +use dhall_syntax::*; use std::marker::PhantomData; macro_rules! derive_other_traits { @@ -71,7 +71,7 @@ mod typed { use crate::typecheck::{ TypeError, TypeInternal, TypeMessage, TypecheckContext, }; - use dhall_core::{Const, Label, SubExpr, V, X}; + use dhall_syntax::{Const, Label, SubExpr, V, X}; use std::borrow::Cow; use std::marker::PhantomData; diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs index e367725..306d4e6 100644 --- a/dhall/src/imports.rs +++ b/dhall/src/imports.rs @@ -1,6 +1,6 @@ use crate::error::Error; use crate::expr::*; -use dhall_core::*; +use dhall_syntax::*; use std::collections::HashMap; use std::fs::File; use std::io::Read; @@ -31,8 +31,8 @@ fn resolve_import( import_stack: &ImportStack, ) -> Result, ImportError> { use self::ImportRoot::*; - use dhall_core::FilePrefix::*; - use dhall_core::ImportLocation::*; + use dhall_syntax::FilePrefix::*; + use dhall_syntax::ImportLocation::*; let cwd = match root { LocalDir(cwd) => cwd, }; diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index 9327a34..c64bb4a 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -2,8 +2,8 @@ use std::collections::BTreeMap; use std::rc::Rc; -use dhall_core::context::Context; -use dhall_core::{ +use dhall_syntax::context::Context; +use dhall_syntax::{ rc, BinOp, Builtin, Const, ExprF, Integer, InterpolatedText, InterpolatedTextContents, Label, Natural, SubExpr, V, X, }; @@ -633,7 +633,7 @@ mod thunk { OutputSubExpr, Value, }; use crate::expr::Typed; - use dhall_core::{Label, V}; + use dhall_syntax::{Label, V}; use std::cell::{Ref, RefCell}; use std::rc::Rc; @@ -893,7 +893,7 @@ impl TypeThunk { } fn apply_builtin(b: Builtin, args: Vec) -> Value { - use dhall_core::Builtin::*; + use dhall_syntax::Builtin::*; use Value::*; // Return Ok((unconsumed args, returned value)), or Err(()) if value could not be produced. diff --git a/dhall/src/serde.rs b/dhall/src/serde.rs index 6f143cb..96bc765 100644 --- a/dhall/src/serde.rs +++ b/dhall/src/serde.rs @@ -1,7 +1,7 @@ use crate::error::{Error, Result}; use crate::expr::{Normalized, Type}; use crate::traits::Deserialize; -use dhall_core::*; +use dhall_syntax::*; use std::borrow::Cow; impl<'a, T: serde::Deserialize<'a>> Deserialize<'a> for T { diff --git a/dhall/src/traits/dynamic_type.rs b/dhall/src/traits/dynamic_type.rs index 74c2e0a..b8f6f6d 100644 --- a/dhall/src/traits/dynamic_type.rs +++ b/dhall/src/traits/dynamic_type.rs @@ -3,7 +3,7 @@ use crate::traits::StaticType; #[allow(unused_imports)] use crate::typecheck::{TypeError, TypeMessage, TypecheckContext}; #[allow(unused_imports)] -use dhall_core::{Const, ExprF}; +use dhall_syntax::{Const, ExprF}; use std::borrow::Cow; pub trait DynamicType { diff --git a/dhall/src/traits/static_type.rs b/dhall/src/traits/static_type.rs index df6a177..6e42da8 100644 --- a/dhall/src/traits/static_type.rs +++ b/dhall/src/traits/static_type.rs @@ -1,5 +1,5 @@ use crate::expr::*; -use dhall_core::*; +use dhall_syntax::*; use dhall_generator as dhall; /// A value that has a statically-known Dhall type. diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index 598ae1f..1683fbf 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -7,9 +7,9 @@ use std::fmt; use crate::expr::*; use crate::normalize::{NormalizationContext, Thunk, TypeThunk, Value}; use crate::traits::DynamicType; -use dhall_core; -use dhall_core::context::Context; -use dhall_core::*; +use dhall_syntax; +use dhall_syntax::context::Context; +use dhall_syntax::*; use dhall_generator as dhall; use self::TypeMessage::*; @@ -113,7 +113,7 @@ impl TypeThunk { } } -/// A semantic type. This is partially redundant with `dhall_core::Expr`, on purpose. `TypeInternal` should +/// A semantic type. This is partially redundant with `dhall_syntax::Expr`, on purpose. `TypeInternal` should /// be limited to syntactic expressions: either written by the user or meant to be printed. /// The rule is the following: we must _not_ construct values of type `Expr` while typechecking, /// but only construct `TypeInternal`s. @@ -245,7 +245,7 @@ impl PartialEq for TypecheckContext { impl Eq for TypecheckContext {} fn function_check(a: Const, b: Const) -> Result { - use dhall_core::Const::*; + use dhall_syntax::Const::*; match (a, b) { (_, Type) => Ok(Type), (Kind, Kind) => Ok(Kind), @@ -279,7 +279,7 @@ where T: Borrow>, U: Borrow>, { - use dhall_core::ExprF::*; + use dhall_syntax::ExprF::*; fn go<'a, S, T>( ctx: &mut Vec<(&'a Label, &'a Label)>, el: &'a SubExpr, @@ -368,7 +368,7 @@ fn type_of_const<'a>(c: Const) -> Result, TypeError> { } fn type_of_builtin(b: Builtin) -> Expr { - use dhall_core::Builtin::*; + use dhall_syntax::Builtin::*; match b { Bool | Natural | Integer | Double | Text => dhall::expr!(Type), List | Optional => dhall::expr!( @@ -464,7 +464,7 @@ macro_rules! ensure_equal { macro_rules! ensure_simple_type { ($x:expr, $err:expr $(,)*) => {{ match $x.get_type()?.as_const() { - Some(dhall_core::Const::Type) => {} + Some(dhall_syntax::Const::Type) => {} _ => return Err($err), } }}; @@ -553,7 +553,7 @@ impl TypeIntermediate { } } // An empty record type has type Type - let k = k.unwrap_or(dhall_core::Const::Type); + let k = k.unwrap_or(dhall_syntax::Const::Type); Typed::from_thunk_and_type( Value::RecordType( @@ -587,7 +587,7 @@ impl TypeIntermediate { // An empty union type has type Type; // an union type with only unary variants also has type Type - let k = k.unwrap_or(dhall_core::Const::Type); + let k = k.unwrap_or(dhall_syntax::Const::Type); Typed::from_thunk_and_type( Value::UnionType( @@ -664,7 +664,7 @@ fn type_with( ctx: &TypecheckContext, e: SubExpr>, ) -> Result, TypeError> { - use dhall_core::ExprF::*; + use dhall_syntax::ExprF::*; use Ret::*; let ret = match e.as_ref() { @@ -738,9 +738,9 @@ fn type_last_layer( ctx: &TypecheckContext, e: ExprF, Label, X, Normalized<'static>>, ) -> Result { - use dhall_core::BinOp::*; - use dhall_core::Builtin::*; - use dhall_core::ExprF::*; + use dhall_syntax::BinOp::*; + use dhall_syntax::Builtin::*; + use dhall_syntax::ExprF::*; let mkerr = |msg: TypeMessage<'static>| TypeError::new(ctx, msg); use Ret::*; -- cgit v1.2.3