diff options
author | Nadrieril | 2019-05-04 12:38:36 +0200 |
---|---|---|
committer | Nadrieril | 2019-05-04 12:38:36 +0200 |
commit | 45be2ff1f5bb3d6e0faa098402adf985b3d5e7ca (patch) | |
tree | a7b15b0bf4b5b211eb42a559bc3cfde9a14b7749 /dhall | |
parent | ca4e2b39c838cde6da835470699579e8eddc1535 (diff) |
Rename dhall_core to dhall_syntax
Diffstat (limited to 'dhall')
-rw-r--r-- | dhall/Cargo.toml | 2 | ||||
-rw-r--r-- | dhall/src/binary.rs | 4 | ||||
-rw-r--r-- | dhall/src/error.rs | 6 | ||||
-rw-r--r-- | dhall/src/expr.rs | 4 | ||||
-rw-r--r-- | dhall/src/imports.rs | 6 | ||||
-rw-r--r-- | dhall/src/normalize.rs | 8 | ||||
-rw-r--r-- | dhall/src/serde.rs | 2 | ||||
-rw-r--r-- | dhall/src/traits/dynamic_type.rs | 2 | ||||
-rw-r--r-- | dhall/src/traits/static_type.rs | 2 | ||||
-rw-r--r-- | dhall/src/typecheck.rs | 28 | ||||
-rw-r--r-- | dhall/tests/traits.rs | 2 |
11 files changed, 33 insertions, 33 deletions
diff --git a/dhall/Cargo.toml b/dhall/Cargo.toml index 637d511..28123e5 100644 --- a/dhall/Cargo.toml +++ b/dhall/Cargo.toml @@ -13,7 +13,7 @@ term-painter = "0.2.3" serde = { version = "1.0", features = ["derive"] } serde_cbor = "0.9.0" improved_slice_patterns = { version = "2.0.0", path = "../improved_slice_patterns" } -dhall_core = { path = "../dhall_core" } +dhall_syntax = { path = "../dhall_syntax" } dhall_generator = { path = "../dhall_generator" } [dev-dependencies] 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<ParsedExpr, DecodeError> { fn cbor_value_to_dhall(data: &cbor::Value) -> Result<ParsedExpr, DecodeError> { 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<T> = std::result::Result<T, Error>; #[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<std::io::Error> for Error { Error::IO(err) } } -impl From<dhall_core::ParseError> for Error { - fn from(err: dhall_core::ParseError) -> Error { +impl From<dhall_syntax::ParseError> 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<Normalized<'static>, 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<Thunk>) -> 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<Const, ()> { - 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<Type<'static>>, U: Borrow<Type<'static>>, { - use dhall_core::ExprF::*; + use dhall_syntax::ExprF::*; fn go<'a, S, T>( ctx: &mut Vec<(&'a Label, &'a Label)>, el: &'a SubExpr<S, X>, @@ -368,7 +368,7 @@ fn type_of_const<'a>(c: Const) -> Result<Type<'a>, TypeError> { } fn type_of_builtin<N, E>(b: Builtin) -> Expr<N, E> { - 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<X, Normalized<'static>>, ) -> Result<Typed<'static>, 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<Typed<'static>, Label, X, Normalized<'static>>, ) -> Result<Ret, TypeError> { - 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::*; diff --git a/dhall/tests/traits.rs b/dhall/tests/traits.rs index a7cd530..e26a6c7 100644 --- a/dhall/tests/traits.rs +++ b/dhall/tests/traits.rs @@ -1,6 +1,6 @@ #![feature(proc_macro_hygiene)] use dhall::de::SimpleStaticType; -use dhall_core::{SubExpr, X}; +use dhall_syntax::{SubExpr, X}; use dhall_generator; #[test] |